Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2008
    Posts
    6

    Inserting/Retrieving Cyrillic Characters

    Hi,
    I am using Microsoft SQL Server 2000. I am inserting cyrillic characters in my table by using query analyzer. See sample below:

    Column "LangText" is nvarchar data type.

    INSERT INTO Sentences (LangText) VALUES ('Поиск')

    Problem occurs when I retrieve via query analyzer by using select statement I got "?????" question marks.

  2. #2
    Join Date
    Apr 2008
    Location
    Warrington, UK
    Posts
    15
    I think you need:

    Code:
    INSERT INTO Sentences (LangText) VALUES (N'Поиск')
    (Note the "N" qualifier on the constant)

  3. #3
    Join Date
    Apr 2008
    Posts
    6
    Hi twebster,
    Its working fine with "N" qualifier but only for inline queries. How can I use this with stored procedure?

  4. #4
    Join Date
    Apr 2008
    Location
    Warrington, UK
    Posts
    15
    You might need to be a little more specific - basically it just works:
    Code:
    CREATE PROC spInsIntoSentences(@str nvarchar(20)) as
    INSERT INTO Sentences (LangText) VALUES (@str)
    
    GO
    
    EXEC spInsIntoSentences N'Поиск'
    or if you need to construct the argument:
    Code:
    DECLARE @text nvarchar(20)
    SET @text = N'Поиск' + N'Поиск'
    EXEC spInsIntoSentences @text

  5. #5
    Join Date
    Apr 2008
    Posts
    6
    I am calling stored procedure from ASP.NET web application and filling the values of parameters from TextBoxes, so which place I should write "N" qualifier? See my stored procedure below:

    Code:
    CREATE PROCEDURE AddSentence
    (
    @LangText nvarchar(50),
    @MoreText nText
    )
    AS
    IF EXISTS(SELECT TextID FROM Sentences WHERE LangText = @LangText)
    	RETURN(-1)
    ELSE
    	INSERT INTO Sentences (LangText, MoreText) VALUES (@LangText, @MoreText)
    	RETURN(@@IDENTITY)
    GO

  6. #6
    Join Date
    Apr 2008
    Location
    Warrington, UK
    Posts
    15
    Depends on what the call to the stored procedure looks like - should be something like:
    Code:
    AddSentence N'Поиск', N'...'
    Presumably you're constructing this in the ASP code. It does depend on the controls you're using being Unicode-capable, which I would presume the ASP.NET textbox is (although I'm not familiar with it).

  7. #7
    Join Date
    Apr 2008
    Posts
    6
    Hi twebster,
    Thanks for your help. I done it with ASP.NET with stored procedure.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •