Hi,
I am executing a query using "Exec (@Query)" syntax, where @Query is having length greater than 8000 bytes in size. So when I am trying to execute this query, it is not going to execute whole query and giving error.
I have a Eg for that,
Declare
@a Varchar(8000),
@b Varchar(8000);
Select
@a = ' ', -- @a contains insert query
@b = ' '; -- @b contains where clause
Execute (@a + @b)
Thanks for your help in advance!!!


Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted May 6, 2016, 10:28 AM EDT
ali tuncerRank #1,499 · 1.1K reputationPosted May 6, 2016, 8:15 AM EDT
SET @sql = CONVERT(varchar(max),@a)
Bhuvanesh MohankumarRank #310 · 8.1K reputationPosted May 7, 2016, 7:58 AM EDT