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.
Author |
Topic |
oceanboy
Starting Member
44 Posts |
Posted - 2009-01-20 : 23:08:19
|
Hi all,I have a stored procedure with a dynamic SQL in it======================================dbo.checkline (@inputstring nvarchar(300))BEGIN...set @sqlstr = 'select * from tableA where ' + @inputstring...exec sp_execute sql @sqlstr, @inputstringEND=======================================I also have an Access VBA application where I store all the @inputstring and i have unicode among these inputstring, such as columnB = N'?'. Then i use ADOBO.COMMAND to call the store procedure after fill in this input string========================================With acmd .ActiveConnection = acn .CommandType = adCmdStoredProc .CommandText = "usp_ShopQC2" .CommandTimeout = 0 .Parameters.Append acmd.CreateParameter("inputstring", adLongVarWChar, adParamInput, 500)End With acmd.Parameters("Criteria").value = "columnB = N'?'"acmd.execute=========================================However, the result is 0! Which is not true. So I am thinking its either ADODB.COMMAND or Stored Procedure that do not take unicode string input/paramenterCan anyone help me out?Many thanks!OB |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2009-01-21 : 08:30:38
|
What is the data type for @sqlstr?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
oceanboy
Starting Member
44 Posts |
Posted - 2009-01-21 : 21:22:32
|
Hi Harsh,I use nvarchar for @sqlstr. It is my habit to declare my things in nvarchar because i always have to deal with unicode things. you know, this SP works if i execute it this way:exec dbo.checkline 'columnB = N''?''' Since double single quote means a single quote in nvarchar,so it works properly. But when I use adodb.command's parameter like in my first post, it didnt work. Cheers!OB |
|
|
|
|
|