| Author |
Topic  |
|
|
kwikwisi
Constraint Violating Yak Guru
278 Posts |
Posted - 02/09/2010 : 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)
Singapore
16746 Posts |
|
|
kwikwisi
Constraint Violating Yak Guru
278 Posts |
|
|
khtan
In (Som, Ni, Yak)
Singapore
16746 Posts |
Posted - 02/09/2010 : 22:14:23
|
pls post your full query
KH Time is always against us
|
 |
|
|
pk_bohra
Flowing Fount of Yak Knowledge
India
1182 Posts |
Posted - 02/09/2010 : 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
India
47069 Posts |
Posted - 02/10/2010 : 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
278 Posts |
Posted - 02/10/2010 : 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
India
47069 Posts |
Posted - 02/10/2010 : 04:25:11
|
ok and does my suggestion work in sql?
------------------------------------------------------------------------------------------------------ SQL Server MVP |
 |
|
| |
Topic  |
|