SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


decalre select


decalre select

Author
Message
gurbanov.1984
gurbanov.1984
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 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.
ramanathan.raman88
ramanathan.raman88
SSC-Enthusiastic
SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)SSC-Enthusiastic (106 reputation)

Group: General Forum Members
Points: 106 Visits: 42
declare @kat nvarchar(50)
set @kat='Mənzildə qurum'
select * from kateqor where Name=(@kat)

use this query
gurbanov.1984
gurbanov.1984
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 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'
HanShi
HanShi
SSCrazy Eights
SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)

Group: General Forum Members
Points: 8454 Visits: 3718
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’! **
HanShi
HanShi
SSCrazy Eights
SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)

Group: General Forum Members
Points: 8454 Visits: 3718
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’! **
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search