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 2000 Forums
 Transact-SQL (2000)
 Unicode and Escape Chars

Author  Topic 

scotm1971
Starting Member

2 Posts

Posted - 2006-06-23 : 12:56:33
I've got a unicode string like "\\dasf33!c$\t\=". This is the encrypted value, so I can't change how the string is derived.

When I insert it into the database, I get a tab in the middle of the string. How do I prevent the tab from occuring? Two slashes?

Thanks!

nathans
Aged Yak Warrior

938 Posts

Posted - 2006-06-23 : 14:07:50
Can you post your insert statement? Where is the TAB coming from? The '\t' ? Are you using bcp to do the load?

Check this example:

declare @test table (TestID int, TestCol varchar(10))
insert into @test (TestID, TestCol)
select 1, '1 2' -- 1<space>2
union all
select 2, '1 2' -- 1<tab>2
union all
select 3, '1' + CHAR(9) + '2'

-- results to text to view differences
select TestCol
from @test

-- remove tab
select replace(TestCol, char(9), '**')
from @test


Nathan Skerl
Go to Top of Page

scotm1971
Starting Member

2 Posts

Posted - 2006-06-23 : 14:44:33
Yes, the tab is coming from the escape chars "\t" within the encrypted string.

Go to Top of Page

nathans
Aged Yak Warrior

938 Posts

Posted - 2006-06-23 : 15:32:47
But how are you inserting this into the table? Im not following where the "\t" is being resolved into a Tab character.

declare @test table (TestID int, TestCol varchar(20))
insert into @test (TestID, TestCol)
select 1, '1 2' -- 1<space>2
union all
select 2, '1 2' -- 1<tab>2
union all
select 3, '1' + CHAR(9) + '2'
union all
select 4, '\\dasf33!c$\t\='

-- results to text to view differences
select TestCol
from @test

-- remove tab
select replace(TestCol, char(9), '**')
from @test


Nathan Skerl
Go to Top of Page
   

- Advertisement -