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 |
|
drpkrupa
Yak Posting Veteran
74 Posts |
Posted - 2007-01-10 : 10:42:26
|
| I have a column datatype binary 20.I am converting accountno into binary format and same into table.I want a write query and need result based on that table binary column.select len(convert(varchar,col1)), convert(varcahr,col1) from table1The query return 20, and accountno with 20 character. I need the lenght of the account no it could be 10 or 12. But column is binary so it return 20 and same think with accountno. only no not 20character no. How can i achive that. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-10 : 10:46:55
|
| Not sure what you want. What is the purpose of converting accountno to binary format?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-10 : 11:33:36
|
| [code]declare @b binary(20)select @b = cast('1998' as binary)select @b [Original value], '_' + cast(@b as varchar) + '_' [ordinary datatype cast/convert], '_' + left(@b, charindex(0x0, @b) - 1) + '_' [special treatment][/code]Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|