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.
| Author |
Topic |
|
mosheallen
Starting Member
1 Post |
Posted - 2005-11-28 : 06:54:49
|
| Hi,I get different values and a calculation from a query and need to bring them all together to make another calculation.@PRICE,@TIME,@CALC,@TOTAL@PRICE = 3@TIME = 5@CALC = '* .5'@TOTAL = (@PRICE @CALC) * @TIMEI tried to use the exec command, but couldn't get it to workHow can I do this using Transact SQL?Thank you,Moshe |
|
|
surendrakalekar
Posting Yak Master
120 Posts |
Posted - 2005-11-28 : 07:15:31
|
| Not understand exactlly but try this ....Declare @PRICE int ,@TIME int ,@CALC float, @TOTAL floatSelect @PRICE = 3Select @TIME = 5Select @CALC = 0.5Select @TOTAL = (@PRICE * @CALC) * @TIMESelect @Price, @Time, @calc , @totalHTHSurendra |
 |
|
|
sqlmember
Starting Member
7 Posts |
Posted - 2005-11-28 : 07:28:03
|
| do you want to do like thisdeclare @PRICE int,@TIME int,@CALC varchar(255),@TOTAL int, @str varchar(500)set @PRICE = 3set @TIME = 5set @CALC = '* .5'set @str = '('+cast(@PRICE as varchar) + @CALC +') * '+cast(@TIME as varchar)print @strexec('select '+@str)-Khurram Iqbal |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-28 : 08:20:45
|
| >>I tried to use the exec command, but couldn't get it to workWhy did you use Dynamic SQL?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|