0

I'm trying to execute a SQL query stored in a string. But the varchar(max) limit is only 8000. How can I store more than 8000 characters in SQL Server?

declare @query varchar(max)

set @query = 'select * from ....... (22,000+ characters)'

exec(@query)

Thanks!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • please try searching before posting: http://stackoverflow.com/questions/12639948/sql-nvarchar-and-varchar-limits – Mitch Wheat Apr 16 '14 at 03:51
  • a sql with more than 8000 characters? I don't think it's good idea for execution, use temporary table instead? – linpingta Apr 16 '14 at 03:51

0 Answers0