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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-08-16 : 07:59:46
|
| Govind writes "stored procedure parameter to assign the list of expressions to be used in a WHERE clause that contains an "in" logical operator. the following code works fine and gives me desired output (number of rows count)SELECT COUNT(*) FROM AA_UsersAllowedReports WHERE UserID ='GOVIND\Administrator' AND ReportID IN ('f613cf00-9f05-4a56-a6d9-65b6476284ae','00d461f0-8ce5-4a04-8f4d-61cffc46fd67' ) but for business logic I need to pass value in "IN" clause using variableDECLARE @dp VARCHAR(5000)SET @dp = char(39)+'f613cf00-9f05-4a56-a6d9-65b6476284ae'+ char(39)+ ' , ' + char(39)+ '00d461f0-8ce5-4a04-8f4d-61cffc46fd67' + char(39) SELECT COUNT(*) FROM AA_UsersAllowedReports WHERE UserID ='GOVIND\Administrator' AND ReportID IN (@dp) which gives me undesired output , above where condition always return me false values , so output comes out be 0 every time .It would be better if some can suggest me proper solution on it " |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|