Jacqui1811
Programmer
I have an issue with the sql for a report and wondered if anbody could help.
I want to pass an entire where clause to a stored procedure to make filtering easy for the report.
So I will have @filter = " where name = 'myname' ",
exec sp_get name @filter
the stored proc reads.
sql = 'select * from table ' + filter + ' order by name'
sp_executesql @sql
the stored proc doesn't seem to like the fact that I have quote marks around 'myname' in @filter,I have tried with two single quotes as well by the way.
any hints ?
Thanks.
Jacqui.
I want to pass an entire where clause to a stored procedure to make filtering easy for the report.
So I will have @filter = " where name = 'myname' ",
exec sp_get name @filter
the stored proc reads.
sql = 'select * from table ' + filter + ' order by name'
sp_executesql @sql
the stored proc doesn't seem to like the fact that I have quote marks around 'myname' in @filter,I have tried with two single quotes as well by the way.
any hints ?
Thanks.
Jacqui.