I have been using a function that replaces some characters from my editor in asp.net with '+CHAR(x)+' to chain together a string with characters such as single quote that would otherwise break the query, i know how to escape the character using double single
quote but i was wondering why i get this problem.
The problem is that when the string gets too long about 7kb to 8kb its gets cut off for no reason, no error message gets displayed, the query is successful only the string cuts off at a point. When i escape the character without using '+CHAR(x)+' to add
the character i can add a very long string that does not cut off, i am using Varchar(max) for my field, (have also tried text).
I am using sql 2008 express edition, and encounter this problem when i paste the generated query into sql management studio, and when i execute the query from asp.net code.
Does anybody know why this occurs?
I Have solved the problem by using character escaping but would like to know why the string cuts out (only inserts partial contents when the string is chained together with the CHAR function.
x5Ben5x
Member
3 Points
7 Posts
Sql Server 2008 Field problem
Aug 04, 2010 02:58 PM|LINK
I have been using a function that replaces some characters from my editor in asp.net with '+CHAR(x)+' to chain together a string with characters such as single quote that would otherwise break the query, i know how to escape the character using double single quote but i was wondering why i get this problem.
The problem is that when the string gets too long about 7kb to 8kb its gets cut off for no reason, no error message gets displayed, the query is successful only the string cuts off at a point. When i escape the character without using '+CHAR(x)+' to add the character i can add a very long string that does not cut off, i am using Varchar(max) for my field, (have also tried text).
I am using sql 2008 express edition, and encounter this problem when i paste the generated query into sql management studio, and when i execute the query from asp.net code.
Does anybody know why this occurs?
I Have solved the problem by using character escaping but would like to know why the string cuts out (only inserts partial contents when the string is chained together with the CHAR function.
Any help would be appreciated.
SQL 2008 Field size limit problem
Hong-Gang Ch...
All-Star
74696 Points
6768 Posts
Re: Sql Server 2008 Field problem
Aug 10, 2010 01:13 PM|LINK
" ' " is a special character and we can use double single quote instead one single quote to solve this issue.
If you have any feedback about my replies,please contactmsdnmg@microsoft.com.
Microsoft One Code Framework