I've created a stored proc with a dynamic where clause - I've declared sSQL as a variable of type nvarchar(max) so that I can then run sp_executesql at the end of the stored proc passing in the sSQL variable.
Everything was working fine last week, but now, the sp won't return any results and when I view the printed sSQL variable in the messages window, it is only showing 4000 characters of my sSQL variable. (I know this because I changed the variable type to nvarchar(4000) and it errored out and what printed was identical. Ironically, using (max) doesn't error out, it just doesn't return any records!)
Any ideas of what might be causing this? I'm using SQL Server 2005 Standard and I haven't changed anything in the db since last week.
Everything was working fine last week, but now, the sp won't return any results and when I view the printed sSQL variable in the messages window, it is only showing 4000 characters of my sSQL variable. (I know this because I changed the variable type to nvarchar(4000) and it errored out and what printed was identical. Ironically, using (max) doesn't error out, it just doesn't return any records!)
Any ideas of what might be causing this? I'm using SQL Server 2005 Standard and I haven't changed anything in the db since last week.