Home All Groups Group Topic Archive Search About

Stored Procedure can not work perfectly for Big5 characters issue

Author
21 Jul 2006 3:50 AM
Joseph
Hi, all

I have a question :
        I created a stored procedure with 1 string type parameter [input],
it can work perfectly when I use an input string with  Big5 characters if I
execute the stored procedure from SQL Query Analyzer tool, but when I call
this stored procedure in VC++ ,it can not work as I wish , I find the root
cause is the input string data includes Big5 characters , while I pass
string data without Big5 characters , it still can work perfectly in
VC++.Could anybody tell me why?

Thanks in advance!

Joseph

Author
21 Jul 2006 4:19 AM
Steve Kass
Joseph,

My guess is that when you call the stored procedure in VC++, the input
string is interpreted according to the wrong code page.  Can you make the
input parameter Unicode (in SQL Server, nvarchar() instead of varchar(), and
in VC++ probably something like wchar)? I don't think
exec myProc '?' will always send hao3 for the parameter, but I think exec
myProc N'?' will, if the procedure parameter is declared as Unicode.  (In
SQL, the N prefix specifies a Unicode string). If this is not possible, or
this doesn't work, I suggest you post your question in a newsgroup for VC++
or ASP, since the fix will probably not be on the SQL server side.


Steve Kass
Drew University
www.stevekass.com


Show quote
"Joseph" <josnd***@yahoo.com> wrote in message
news:e%23YBejHrGHA.3564@TK2MSFTNGP03.phx.gbl...
> Hi, all
>
> I have a question :
>        I created a stored procedure with 1 string type parameter [input],
> it can work perfectly when I use an input string with  Big5 characters if
> I execute the stored procedure from SQL Query Analyzer tool, but when I
> call this stored procedure in VC++ ,it can not work as I wish , I find the
> root cause is the input string data includes Big5 characters , while I
> pass string data without Big5 characters , it still can work perfectly in
> VC++.Could anybody tell me why?
>
> Thanks in advance!
>
> Joseph
>
>
Author
21 Jul 2006 5:10 AM
Joseph
Thanks Steve!

Could you tell me how can I make the T-SQL string function regard the length
of Big5 character as 2  ,not 1, I mean:

You see:

        LEN('A')=1   --it is correct
        LEN('̨') = 1 -- I need the value to be 2 , not 1

How to do?

Joseph


Show quote
"Steve Kass" <sk***@drew.edu> дÈëÏûÏ¢
news:OroZVzHrGHA.4424@TK2MSFTNGP05.phx.gbl...
> Joseph,
>
> My guess is that when you call the stored procedure in VC++, the input
> string is interpreted according to the wrong code page.  Can you make the
> input parameter Unicode (in SQL Server, nvarchar() instead of varchar(),
> and in VC++ probably something like wchar)? I don't think
> exec myProc '?' will always send hao3 for the parameter, but I think exec
> myProc N'?' will, if the procedure parameter is declared as Unicode.  (In
> SQL, the N prefix specifies a Unicode string). If this is not possible, or
> this doesn't work, I suggest you post your question in a newsgroup for
> VC++ or ASP, since the fix will probably not be on the SQL server side.
>
>
> Steve Kass
> Drew University
> www.stevekass.com
>
>
> "Joseph" <josnd***@yahoo.com> wrote in message
> news:e%23YBejHrGHA.3564@TK2MSFTNGP03.phx.gbl...
>> Hi, all
>>
>> I have a question :
>>        I created a stored procedure with 1 string type parameter [input],
>> it can work perfectly when I use an input string with  Big5 characters if
>> I execute the stored procedure from SQL Query Analyzer tool, but when I
>> call this stored procedure in VC++ ,it can not work as I wish , I find
>> the root cause is the input string data includes Big5 characters , while
>> I pass string data without Big5 characters , it still can work perfectly
>> in VC++.Could anybody tell me why?
>>
>> Thanks in advance!
>>
>> Joseph
>>
>>
>
>
Author
22 Jul 2006 11:46 PM
Steve Kass
Joseph,
  I don't have a Big5-localized version to check on, but I would try

SELECT DATALENGTH('?')

SK

Show quote
"Joseph" <josnd***@yahoo.com> wrote in message
news:%23LXHEQIrGHA.4192@TK2MSFTNGP04.phx.gbl...
> Thanks Steve!
>
> Could you tell me how can I make the T-SQL string function regard the
> length of Big5 character as 2  ,not 1, I mean:
>
> You see:
>
>        LEN('A')=1   --it is correct
>        LEN('̨') = 1 -- I need the value to be 2 , not 1
>
> How to do?
>
> Joseph
>
>
> "Steve Kass" <sk***@drew.edu> дÈëÏûÏ¢
> news:OroZVzHrGHA.4424@TK2MSFTNGP05.phx.gbl...
>> Joseph,
>>
>> My guess is that when you call the stored procedure in VC++, the input
>> string is interpreted according to the wrong code page.  Can you make the
>> input parameter Unicode (in SQL Server, nvarchar() instead of varchar(),
>> and in VC++ probably something like wchar)? I don't think
>> exec myProc '?' will always send hao3 for the parameter, but I think exec
>> myProc N'?' will, if the procedure parameter is declared as Unicode.  (In
>> SQL, the N prefix specifies a Unicode string). If this is not possible,
>> or this doesn't work, I suggest you post your question in a newsgroup for
>> VC++ or ASP, since the fix will probably not be on the SQL server side.
>>
>>
>> Steve Kass
>> Drew University
>> www.stevekass.com
>>
>>
>> "Joseph" <josnd***@yahoo.com> wrote in message
>> news:e%23YBejHrGHA.3564@TK2MSFTNGP03.phx.gbl...
>>> Hi, all
>>>
>>> I have a question :
>>>        I created a stored procedure with 1 string type parameter
>>> [input], it can work perfectly when I use an input string with  Big5
>>> characters if I execute the stored procedure from SQL Query Analyzer
>>> tool, but when I call this stored procedure in VC++ ,it can not work as
>>> I wish , I find the root cause is the input string data includes Big5
>>> characters , while I pass string data without Big5 characters , it still
>>> can work perfectly in VC++.Could anybody tell me why?
>>>
>>> Thanks in advance!
>>>
>>> Joseph
>>>
>>>
>>
>>
>
>

AddThis Social Bookmark Button