Tag Info

New answers tagged

1

You are saying: EXEC @SQLString; This is like saying: EXEC N'SELECT 1;'; Which is probably something that looks like it will work on first glance, but go ahead and try it, it fails. You want: DECLARE @SQL NVARCHAR(MAX); SET @SQL = N'SELECT ...;'; EXEC sys.sp_executesql @sql; I wrote a pretty detailed article on dynamic pivot here: ...



Top 50 recent answers are included