Re: How to pass variables to select statement Take @bc out of the quotes. Ex:
1> declare @bc varchar(5)
2> select @bc = "sys"
3> select count(*) from master..sysobjects where name like @bc+'%'
4> go
(1 row affected)
-----------
52
(1 row affected)
1>
"crasho2001" <crasho2001@yahoo.com> wrote in message
news:bemedi$bjs$1@newstree.wise.edt.ericsson.se...
> I have following statement in my stored procedure. From first two rows I
> can see the values for variables.
>
> "where ce = @ce" is also working. But " (id not like "{@bc,%" or id not
like
> "{%,@bc,%" or id not like "%,@bc}") " is not working.
>
>
>
> How can I pass @bc to " (id not like "{@bc,%" or id not like "{%,@bc,%" or
> id not like "%,@bc}") " .....
>
>
>
> select @ce
>
> select @bc
>
> select bs,ce,bc,id from int where ce = @ce
>
> having(id not like "{@bc,%" or id not like "{%,@bc,%" or id not like
> "%,@bc}")
>
> |