Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

decalre select Expand / Collapse
Author
Message
Posted Monday, July 15, 2013 12:02 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 1:02 AM
Points: 46, Visits: 113

create table kateqor
(id int not null identity(1,1),
Name nvarchar(50))

insert into kateqor
(Name)
values
(N'Mənzildə qurum')

select*from kateqor



but when I do a query

declare @kat nvarchar(50)
set @kat='Mənzildə qurum'
select * from kateqor where Name=N(@kat)


I receive an error

Post 195, Level 15, state 10, line 4
'N' is not a recognized function name.
Post #1473458
Posted Monday, July 15, 2013 12:30 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, March 31, 2014 3:07 AM
Points: 99, Visits: 40
declare @kat nvarchar(50)
set @kat='Mənzildə qurum'
select * from kateqor where Name=(@kat)

use this query
Post #1473468
Posted Monday, July 15, 2013 12:33 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 1:02 AM
Points: 46, Visits: 113
create procedure insert11
@kat nvarchar(50)
as
select * from kateqor where Name=@kat

exec insert11 N'M?nzild? qurum'

but the problem is that I need to send only @kat
without N '


how mak i create proc

execute only @kat

for example

exec insert111 'M?nzild? qurum'


without N'



Post #1473470
Posted Monday, July 15, 2013 1:04 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 2:13 PM
Points: 2,242, Visits: 2,700
You need to apply the "N" when you set the value of the variable and not when you use the variable to fileter your results. This will work:
declare @kat nvarchar(50)
set @kat=N'Mənzildə qurum'
select * from kateqor where Name=@kat



** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
Post #1473484
Posted Monday, July 15, 2013 1:10 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 2:13 PM
Points: 2,242, Visits: 2,700
If you want to pass an unicode value to a stored procedure, you first need to set the value to a variable. Then pass the variable to the stored procedure:
declare @kat nvarchar(50)
set @kat=N'Mənzildə qurum'
exec insert11 @kat



** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
Post #1473488
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse