Sproc in SQL Server 2005 parses, compiles and runs successfully via SQL Management Studio. I've recently imported the schema into Visual Studio Database Edition 2008 and attempting to 'build' the project.
The collation on both the database I generated the script from , and the 'temporary' design time database are the same (SQL_Latin1_General_CP1_CI_AS)
Code currently looks like this:
DECLARE @SQL varchar(2000)
IF @Username <> ''
SET @SQL = @SQL + ' AND Username LIKE ' + "'" + @Username + "%'"
I receive these errors:
Error 261 TSD4001: Invalid column name '''. (SQL error = 207)
Error 262 TSD4001: Invalid column name '%''. (SQL error = 207)
Is there an approved way of using wildcards in dynamic sql generation that won't break the Visual Studio build process?
Thanks