UNICODE Problem

  • Thread starter Thread starter Wongalogic
  • Start date Start date
W

Wongalogic

Hi, All:

This SQL with UNICODE characters works OK to me and give me 2 results:

SQL = "Select * from people where name=N'xxx'"

But when I use stored procedure, it doesn't work, give me no results:

SQL = "exec GetName N'xxx'"

Create Procedure GetName
@name as nvarchar(50)
as
select * from people where name=@name

Do you know why? and how to make it work?

Thanks,

Dennis
 
Have you tried it directly in Query Analyzer and see what you get?

--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on? http://vyaskn.tripod.com/poll.htm




Hi, All:

This SQL with UNICODE characters works OK to me and give me 2 results:

SQL = "Select * from people where name=N'xxx'"

But when I use stored procedure, it doesn't work, give me no results:

SQL = "exec GetName N'xxx'"

Create Procedure GetName
@name as nvarchar(50)
as
select * from people where name=@name

Do you know why? and how to make it work?

Thanks,

Dennis
 
I have tried it on my program, not in SQL (7) Query Analyzer because it doesn't support UNICODE.

Any idea?

Dennis
Have you tried it directly in Query Analyzer and see what you get?

--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on? http://vyaskn.tripod.com/poll.htm




Hi, All:

This SQL with UNICODE characters works OK to me and give me 2 results:

SQL = "Select * from people where name=N'xxx'"

But when I use stored procedure, it doesn't work, give me no results:

SQL = "exec GetName N'xxx'"

Create Procedure GetName
@name as nvarchar(50)
as
select * from people where name=@name

Do you know why? and how to make it work?

Thanks,

Dennis
 
Try this

Create Procedure GetName
@name as nvarchar(50)
as

Declare @SQL nvarchar(200)
Set @SQL = N'select * from people where name = @name'
sp_ExecuteSQL @SQL, N ' @name nvarchar(50)', @name = @name

Venkatesh
I have tried it on my program, not in SQL (7) Query Analyzer because it doesn't support UNICODE.

Any idea?

Dennis
Have you tried it directly in Query Analyzer and see what you get?

--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on? http://vyaskn.tripod.com/poll.htm




Hi, All:

This SQL with UNICODE characters works OK to me and give me 2 results:

SQL = "Select * from people where name=N'xxx'"

But when I use stored procedure, it doesn't work, give me no results:

SQL = "exec GetName N'xxx'"

Create Procedure GetName
@name as nvarchar(50)
as
select * from people where name=@name

Do you know why? and how to make it work?

Thanks,

Dennis
 
Back
Top