Pass Japanese Characters to a SQL Server stored procedure -
i'm trying pass japanese characters stored procedure in sql server. characters converted ???? during execution , hence incoreect results.
how pass them such characters? tried using nvarchar
accepts unicode, no luck. if not use stored procedure , construct sql query string dynamically in app, things work fine. kindly help
update
declare @string nvarchar(1000) set @string = @keyword select * table title @string
called using
exec @return_value = storedprocname @keyword = n'japanese word'
update 2
i add following if helps. constructing query dynamically works. if in app write sql = "select * table title '"+[japaneseword]+"'"; works. unable determine unicode failing stored proc
solution
nvarchar key problem. in case interested knowing how use form freetext search string, here go
declare @string nvarchar(100) set @string = 'formsof(inlflectional,"'+@string+'"))'
use in query. like
select * table temp innerjoin containstable(#,#,@string) ......
refer msdn or relevant docs
you need use nvarchar
data type, , if run in sql server mgmt studio or "inline" sql query, need make sure prefix string literals n'.....'
prefix.
so, stored proc should like:
create procedure dbo.yourproc @param1 nvarchar(100) select n'test - [' + @param1 + n'] - end of test'
and call using:
exec dbo.yourproc n'foo-bar-value'
should yield:
test - [foo-bar-value] - end of test
and of course nicer if knew how japanese characters in here.... :-)
update: ok, i've picked random cyrillic , thai characters, i'm positive require nvarchar
, - , appear me works:
exec dbo.yourproc n'Є Ї Љ Њ Ќ Ѝ Ў А Й Ж М Р Б' test - [Є Ї Љ Њ Ќ Ѝ Ў А Й Ж М Р Б] - end of test exec dbo.yourproc n'฿ ᴂ ᴆ ᴌ ᴔ ᴓ ᴙ ᴚ ᴝ ᴭ ᴦ ᴣ ᴟ' test - [฿ ᴂ ᴆ ᴌ ᴔ ᴓ ᴙ ᴚ ᴝ ᴭ ᴦ ᴣ ᴟ] - end of test
not sure why unicode-based test work, , why shouldn't work japanese characters....
update #2: wikipedia - said mean "tokyo", in hiragana - seems work me:
exec dbo.yourproc n'とうきょう' test - [とうきょう] - end of test
Comments
Post a Comment