High Order ASCII chars in MS SQL 6.5 INSERT using

2019-08-29 04:27发布

I've searched all about and can't find an answer to this.

I have an SQL statement similar to

insert myTable VALUES ( 'Value1', 'Value2', 'Value 3²More', 'Value 4√Even More' )

where the square char (between the 3 and the More) is 0xFD and the square root sign (between the 4 and the Even) is 0xFB.

This is going from ADO into an MSSQL 6.5 database. I've tried escaping the chars such using \xFE, \0xFE, even using octal (\o375) but I have no idea how to do this.

Basically, these chars are delimiters @VM and @TM used by Pick based systems. If I pass the characters in directly, they get converted to ?.

We have AutoTranslate=0 in the ado connection string.

Any help would be appreciated. I'm not an SQL guy so please be gentle.

Aaron

1条回答
迷人小祖宗
2楼-- · 2019-08-29 05:17

I worked it out, with a little help from my wife. Turns out I need to concatenate the values using CHAR

so..

insert myTable VALUES ( 'Value1', 'Value2', 'Value 3' + CHAR(253) + 'More', 'Value 4' + CHAR(251) + 'Even More' )

which you all knew and I should have known.

查看更多
登录 后发表回答