January 15th, 2013, 08:27 PM
Is this possible? SQL + Dynamic query?
uhm, due to my limitations on sql server 2000, which are the nvarchar and varchar sizes (i need something that can hold a large character string for my query, which is possible in SQL server 2005 and up due to nvarchar(max)). could i do something like:
select * from table1 @whereclause?
where @whereclause = 'where id = 'A' or ID = 'b' or ID = 'C''
sorry for the questions and thanks for the fine replies btw
January 16th, 2013, 01:00 PM
declare @whereclause varchar(400)
set @whereclause = 'where id = 'A' or ID = 'b' or ID = 'C'
declare @sql varchar(8000)
set @sql='select * from table1 ' + @whereclause