decalre select

  • 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.

  • declare @kat nvarchar(50)

    set @kat='M?nzild? qurum'

    select * from kateqor where Name=(@kat)

    use this query

  • 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'

  • 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’! **
  • 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’! **

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply