|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Stored Procedure can not work perfectly for Big5 characters issueHi, 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 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 > > 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 >> >> > > 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 >>> >>> >> >> > > |
|||||||||||||||||||||||