Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic SQL in Sybase

Status
Not open for further replies.

KiwiGuy

Technical User
Mar 13, 2001
15
GB
Hi All,

Im trying to create a bit of Dynamic SQL in a Sybase stored procedure, im used to MS SQL Server so im not sure what im doing wrong in Sybase.
Heres my bit of code

declare @sql varchar(100)
declare @sql2 varchar(100)

Select @sql = """0001/100212"",""0001/100218"",""0001/100240"",""0001/100243"""

select @sql2 = 'select * from bndtra where bnd_tra_code in (' + @sql + ')'

Exec @sql2


now i would have thought this would have executed @sql2 and returned a result set, but no :(. Any ideas?, idealy i will be passing in @SQL as a paramenter.

Cheers

Ben

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top