hi,
im trying to divide two fields in a database like this: crterm=bal/pi but im not sure how to write it in sql. any suggestions?

update mytable set  crterm=bal/pi where somecolumn='my condition'

This is by no means a complete answer (that will depend on your exact scenario), but it should get you started:

CREATE TABLE [dbo].[Table_2](
	[Num1] [decimal](18,9) ,
	[Num2] [decimal](18,9) ,
	[Quotient] AS CAST(Num1/Num2 AS [decimal](18,9))
)

This should allow you to do this:

insert into Table_2 (Num1, Num2) values (1,2)

(The Quotient column will have the value of 0.5)

Note that this doesn't protect against division by zero.

Hope that helps.

-Brian

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.