August 18, 2011 at 8:08 am
I am trying to insert Chinese characters into database.
by using below code
have declared name as nvarchar in database and added 'N' infront. But this doesnt solve my problem of inserting chinese. Also this adds letter N infront of column Name for all records even in english.
Can any one please advice me on this....
CREATE PROCEDURE [dbo].[USP_WriteModifiedData]
@Idvarchar(5000) ,
@Namevarchar(5000),
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
INSERT INTO dbo.tblVideoData(Id,Name, modified)
VALUES ( @Id, 'N'+@Name,@date,@modified)
August 18, 2011 at 8:10 am
@Name varchar(5000),
all your variables must be nvarchar, including the procs definition and the final resulting column;
otherwise you get an implicit converison, which changes it to quesiton marks or other characters.
CREATE PROCEDURE [dbo].[USP_WriteModifiedData]
@Id Nvarchar(5000) ,
@Name Nvarchar(5000),
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
INSERT INTO dbo.tblVideoData(Id,Name, modified)
VALUES ( @Id,@Name,@date,@modified)
Lowell
August 18, 2011 at 8:10 am
Hi
You don't need the leading 'N' if you already get the data as variables. But you need to define your variables in your procudedure as NVARCHAR, like in your table.
Greets
Flo
August 18, 2011 at 8:18 am
Great!! Thanks to both of you!! It is working!!!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply