-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: laks_win
Message 2 in Discussion
Hi Manoj,
The solution is here.
1. First of all, u need to set the size to "@auditid varchar", argument.
Without setting the size, it takes 1 as default and execute the first number.
Try ur input with 2 digits like '10,12'. It will give an error!!.
2. Passing the @auditid as a comma separated list, u cannot directly substitute
in the query like : Audit_id in ( @auditId).
3. U need to convert in to dynamic query. Yes, otherwise it wont work.
declare @Qry VARCHAR(200)
SET @Qry = 'select @OptionMarks = sum(case when Option_Marks is null
then 0 end) from AS_RiskTemplate_QueryDetails
Where [EMAIL PROTECTED] And Option_id in (select Option_id from
AS_RiskTemplate_Response Where
Audit_id in (' + @auditId + ') and Node_id = @nodeId ) '
EXEC (@Qry)
4. Form this Qry, u r returning a value (@OptionMarks ), isnt it?
5. From the dynamic query, to get out the value, u need to use extended stored
procedure "sp_executesql". Bcz the scope the variable inside the dynamic query
is limited
6. For "sp_executesql" Get the help from the net/ search SQL Books OnLine help
Hope this helps
Regards
Lakshmi Narayanan.R
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]