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.
| Author |
Topic |
|
psk1
Starting Member
1 Post |
Posted - 2008-10-15 : 19:18:48
|
Consider the following:quote: SELECT len(CONVERT(varbinary, '1234567890'));
Yields '10'. The following statement:quote: SELECT len(CONVERT(varbinary, '1234567890'));
Yields '20'. Now this statement:quote: SELECT len(CONVERT(varbinary, '1234567890123456789012345678901234567890'));
Yields '30'. Why isn't it 40 (the length of the string passed)? |
|
|
PeterNeo
Constraint Violating Yak Guru
357 Posts |
Posted - 2008-10-16 : 00:19:08
|
| varchar, varbinary data types takes 30 as their default length unless we specify,check this alsoSELECT len(CONVERT(varchar, '1234567890123456789012345678901234567890')); try this to get the correct lengthSELECT len(CONVERT(VARBINARY(MAX), '1234567890123456789012345678901234567890')); |
 |
|
|
|
|
|