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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Pls How can i execute query

Author  Topic 

yaman
Posting Yak Master

213 Posts

Posted - 2008-07-11 : 04:30:34
Sir ,

declare @str varchar(1000)
Set @str='0,1'
select * from tbl_application where isbpl in ( @str )

How can i execute query

ERROR :- Conversion failed when converting the varchar value '0,1' to data type bit.

Yaman

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-11 : 04:37:19
select * from tbl_application where ','+@a+',' like '%,'+cast( isbpl as varchar(10))+',%'

More info here
www.sommarskog.se/dynamic_sql.html



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-11 : 05:35:45
quote:
Originally posted by yaman

Sir ,

declare @str varchar(1000)
Set @str='0,1'
select * from tbl_application where isbpl in ( @str )

How can i execute query

ERROR :- Conversion failed when converting the varchar value '0,1' to data type bit.

Yaman


What did you change in the question?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

yaman
Posting Yak Master

213 Posts

Posted - 2008-07-11 : 05:49:40
Sir ,
declare @str varchar(1000)
Set @str='0,1'
select * from tbl_application where isbpl in ( @str )

How can i execute query

ERROR :- Conversion failed when converting the varchar value '0,1' to data type bit.

Actually column ISBPL IS BIT TYPE whenever i am putting @str in place of value , Query giving me error
How can i execute query ... Putting @str At place of value



Yaman
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-11 : 06:48:36
quote:
Originally posted by yaman

Sir ,
declare @str varchar(1000)
Set @str='0,1'
select * from tbl_application where isbpl in ( @str )

How can i execute query

ERROR :- Conversion failed when converting the varchar value '0,1' to data type bit.

Actually column ISBPL IS BIT TYPE whenever i am putting @str in place of value , Query giving me error
How can i execute query ... Putting @str At place of value



Yaman


Did you try the method I suggested?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -