|
Posted by Roni on 11/17/06 13:22
Declare @i int
Select @i=D_Places from MachineTests Where Test_Name='WBC_Count'
--Where D_Places is a user defined Number which defines the scale for
this Test
--While Converting it to Decimal
-- What does the following query do
-- I need to check the flag FORCE_HOLD_NDR if its 1 then
-- conversion is done on Result field of MachineResults Table
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'."
/*
So the problem i m facing is in supplying a variable (@i in this case)
in Decimal constructor..
Is there any solution to remove this error however the bussiness
requiremt cant be
changed as the scale for the decimal is defined by the user in setup
file and it
can be anything ..
*/
Hope u guys Understand my question
Regards
Mohammad Rehan
Nortec Softwares Pvt LTD
Navigation:
[Reply to this message]
|