Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 varchar(max) and base64encoded string, truncated ?

Author  Topic 

BitShift
Yak Posting Veteran

98 Posts

Posted - 2007-06-18 : 17:48:05
Im passing a base64 encoded string as a stored procedure parameter. The parameter value will be used to update a field of type varchar(max). When I call the procedure from my C# application, i get an error such as:
"ex = {"String or binary data would be truncated.\r\nThe statement has been terminated."}"

ideas ?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-06-18 : 17:51:51
When calling from C#, are you using dynamic SQL or parameter based call?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

BitShift
Yak Posting Veteran

98 Posts

Posted - 2007-06-18 : 18:00:52
quote:
Originally posted by Peso

When calling from C#, are you using dynamic SQL or parameter based call?


Peter Larsson
Helsingborg, Sweden



parameter, and setting the type to varchar, but im not specifying a size.

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-06-18 : 19:08:35
What is the default size, when NOT setting a size? 50 chars?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

BitShift
Yak Posting Veteran

98 Posts

Posted - 2007-06-19 : 11:26:51
quote:
Originally posted by Peso

What is the default size, when NOT setting a size? 50 chars?


Peter Larsson
Helsingborg, Sweden



Ah Ha ! thank you, that reminds me. My data is just a tad over 8K bytes and the limit for varchar is 8000bytes, unless using varchar(max), which I am. So now I just need to figure out how to make my C# app specify that its setting up a varchar(max) parameter.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-06-19 : 17:31:46
2147483647.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -