If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Inserting/Retrieving Cyrillic Characters

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
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)
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
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?
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
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).
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
Join Date: Apr 2008
Posts: 6
Hi twebster,
Thanks for your help. I done it with ASP.NET with stored procedure.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On