Author |
Topic |
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2010-02-09 : 21:41:04
|
Below is where condition and I passed comma seperated list (x) from front end to @test.But It returns null even the value is inside. dim x as string = "aa,bb,cc"(col1 IN(' + @test + ') OR @test IS NULL)Where is it wrong ?Thanks |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-02-09 : 22:14:23
|
pls post your full query KH[spoiler]Time is always against us[/spoiler] |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-02-09 : 23:04:04
|
Since you are passing a string value and not integer value, i feel that all individual value should be in single quotes.Just try by adding the below statement to your code before calling it dynamically.Set @test = '''' + Replace(@test, ',' , ''',''' ) + '''' |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-10 : 00:19:36
|
quote: Originally posted by kwikwisi Below is where condition and I passed comma seperated list (x) from front end to @test.But It returns null even the value is inside. dim x as string = "aa,bb,cc"(col1 IN(' + @test + ') OR @test IS NULL)Where is it wrong ?Thanks
are you asking about sql or vb? sql doesnt have dim.if sql it should be',' + @test + ',' LIKE '%,'+ col1 + ',%'------------------------------------------------------------------------------------------------------SQL Server MVP |
|
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2010-02-10 : 04:21:59
|
Yes, I know SQL doesnt have Dim .I just let you know how I passed the string value from VB.Net.Thanks.quote: Originally posted by visakh16
quote: Originally posted by kwikwisi Below is where condition and I passed comma seperated list (x) from front end to @test.But It returns null even the value is inside. dim x as string = "aa,bb,cc"(col1 IN(' + @test + ') OR @test IS NULL)Where is it wrong ?Thanks
are you asking about sql or vb? sql doesnt have dim.if sql it should be',' + @test + ',' LIKE '%,'+ col1 + ',%'------------------------------------------------------------------------------------------------------SQL Server MVP
|
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-10 : 04:25:11
|
ok and does my suggestion work in sql?------------------------------------------------------------------------------------------------------SQL Server MVP |
|
|
|