Problem with Execute query by EXEC(@string)
-
Hi I have written a stored procedure where i am taking the select query into a variable @string and executing the query. i am generating the query dynamically based on the SP inputs. If the query is below 4000 chars , there is no prob with it. If it exceeds then query is not executing. Kindly help.... Thanks in advance Naina
Naina
-
Hi I have written a stored procedure where i am taking the select query into a variable @string and executing the query. i am generating the query dynamically based on the SP inputs. If the query is below 4000 chars , there is no prob with it. If it exceeds then query is not executing. Kindly help.... Thanks in advance Naina
Naina
-
If I'm right you will not be able to query/search for data/text that is larger than 4000 chars. All column types above text(4000), like NVarChar(max) can't be a query parameter. I hope somebody can confirm that. Greetings Covean
Hi thanks for the reply..... just did a small change by declaring as varchar(MAX) and its accepting more than 4000. Thank you Regards Naina
Naina
-
Hi thanks for the reply..... just did a small change by declaring as varchar(MAX) and its accepting more than 4000. Thank you Regards Naina
Naina
-
Hi thanks for the reply..... just did a small change by declaring as varchar(MAX) and its accepting more than 4000. Thank you Regards Naina
Naina
You may be limited to 8000 character, the max of varchar, not sure if varchar(max) overcomes this limitation.
Never underestimate the power of human stupidity RAH
-
You may be limited to 8000 character, the max of varchar, not sure if varchar(max) overcomes this limitation.
Never underestimate the power of human stupidity RAH
if i give nvarchar(8000) it says that i have crosses the linit of 4000 characters. i am using sqlserver 2005. and now i noticed that varchar(MAX) is taking only 4000 characters. Regards Naina
Naina
-
if i give nvarchar(8000) it says that i have crosses the linit of 4000 characters. i am using sqlserver 2005. and now i noticed that varchar(MAX) is taking only 4000 characters. Regards Naina
Naina
use varchar(8000)
Never underestimate the power of human stupidity RAH
-
use varchar(8000)
Never underestimate the power of human stupidity RAH
i declared as varchar(8000) and assigned a query to it. but when i tried to print the length and string, it shows only till 4000 chars and the length also its showing only 4000. :( Regards Naina
Naina
-
Hi I have written a stored procedure where i am taking the select query into a variable @string and executing the query. i am generating the query dynamically based on the SP inputs. If the query is below 4000 chars , there is no prob with it. If it exceeds then query is not executing. Kindly help.... Thanks in advance Naina
Naina
-
The size (8000) given to the parameter '@sql' exceeds the maximum allowed (4000). is the error if i use nvarchar(8000) :( Regards Naina
Naina
-
The size (8000) given to the parameter '@sql' exceeds the maximum allowed (4000). is the error if i use nvarchar(8000) :( Regards Naina
Naina
Yes... Hightest value of NVARCHAR is 4000 and VARCHAR is 8000 BUT NVARCHAR takes large CHARSET.. So use NVARCHAR only when you need. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords/xml> -
Yes... Hightest value of NVARCHAR is 4000 and VARCHAR is 8000 BUT NVARCHAR takes large CHARSET.. So use NVARCHAR only when you need. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords/xml>I finally got the answere..... :) I declared @string as varchar(8000). But there are nvarchars declared which i am assigning to @string which finally lead to the problem . because of this @string is taking only 4000 charecters, I replaced all nvarchars with varchars and finally its taking morethan 4000 charecters. Regards Naina
Naina
-
Hi I have written a stored procedure where i am taking the select query into a variable @string and executing the query. i am generating the query dynamically based on the SP inputs. If the query is below 4000 chars , there is no prob with it. If it exceeds then query is not executing. Kindly help.... Thanks in advance Naina
Naina
Take @string as varchar(max) and then try executing it Hope it helps!