Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hello there, I am quite new to SQL and programming in general and am desperate for some help for a task I need to submit urgently:I have the following formula which I need to code in SQL in the SQL Server Management Studio:KEY = SQRT[(GPZ*2 + ITS)^2]GPZ and ITS are positive numbers so I guess they could be declared as float and as a result so could be KEYI get confused trying to define and then declare those variables and then writing this formula and displaying it.if those variables were columns, how would that be coded?Thank You so very much for your help in advance!
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts
Posted - 2008-10-02 : 13:26:16
This example might help...
declare @t table (GPZ float, ITS float)insert @t select 10, 20union all select 20, 30select *, sqrt(power(GPZ*2 + ITS, 2)) as [KEY] from @t
Ryan Randall Solutions are easy. Understanding the problem, now, that's the hard part.
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts
Posted - 2008-10-02 : 13:28:18
By the way: I'm sure you realise the squaring and square-rooting cancel out...Ryan Randall Solutions are easy. Understanding the problem, now, that's the hard part.