|
Posted by Helmut Woess on 11/18/06 13:04
Am 17 Nov 2006 05:22:51 -0800 schrieb Roni:
....
> Select Case(FORCE_HOLD_NDR)
> WHEN 1 THEN convert(DECIMAL(18,@i), Result)
> ELSE Result
> END
>>From MachineResults
>
> --Sounds really easy :) but its prompting me an Error
> --"Server: Msg 170, Level 15, State 1, Line 5
> --"Line 5: Incorrect syntax near '@i'."
>
This is not possible, you have to build a string and then execute this
string using EXECUTE or sp_executesql.
Here is an excellent article about it:
http://www.sommarskog.se/dynamic_sql.html
bye,
Helmut
[Back to original message]
|