February 20, 2014 at 9:59 pm
Hi all experts,
This is quite simple but i dont know why am i not able to figure it out.
i am facing the problem inserting Japanese text in a table.
CREATE TABLE #TBL1 (Property nvarchar(255))
CREATE PROCEDURE DBO.InsertProperties(@Prop NVARCHAR(200))
AS
BEGIN
INSERT INTO #TBL1 VALUES ('N'+char(39)+@Prop+char(39))
END
DBO.InsertProperties N'ンプライ' --Run the SP
February 20, 2014 at 10:19 pm
This works for me
USE TestB; --replace with your appropriate database
GO
CREATE TABLE TBL1 (Property nvarchar(255))
GO
CREATE PROCEDURE DBO.InsertProperties(@Prop NVARCHAR(200))
AS
BEGIN
INSERT INTO TBL1 VALUES ('N'+char(39)+@Prop+char(39))
END
GO
EXECUTE DBO.InsertProperties N'????' --Run the SP
GO
SELECT *
FROM TBL1;
GO
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
February 20, 2014 at 10:28 pm
Yeah , i too figure out what was going wrong . If we follow SQLRNNR solution, N also gets insert. Which should not happen.
I had by mistake used N as both places, in the call as well as in the SP, which should have not happen
🙂
CREATE TABLE #TBL1 (Property nvarchar(255))
ALTER PROCEDURE DBO.InsertProperties(@Prop NVARCHAR(200))
AS
BEGIN
INSERT INTO #TBL1 VALUES (char(39)+@Prop+char(39))
END
DBO.InsertProperties N'????' --Run the SP
This work for me. 🙂
Thanks for u r time SQLRNNR.
I guess time to have some sleep :doze:
February 20, 2014 at 10:45 pm
Hello Experts ,
I notice one more thing, That if i used N in the SP and not while calling , ???? gets inserted.
CREATE TABLE #TBL1 (Property nvarchar(255))
ALTER PROCEDURE DBO.InsertProperties(@Prop NVARCHAR(200))
AS
BEGIN
INSERT INTO #TBL1 VALUES ('N'+char(39)+@Prop+char(39))
END
DBO.InsertProperties '????' --Run the SP
For the above execution ???? gets inserted, even though i had use N in the SP.
Is there a way to handel N inside the SP. I mean when i execute the SP as
DBO.InsertProperties '????' --Run the SP
Japanese text gets inserted.
February 21, 2014 at 2:32 am
I tried various permutation and combinations to insert the data using the below call, where N would be used in SP itself
DBO.InsertProperties '????' --Run the SP
It this actually possible at SQL side 🙂
February 21, 2014 at 8:09 am
Shadab Shah (2/20/2014)
Hello Experts ,I notice one more thing, That if i used N in the SP and not while calling , ???? gets inserted.
CREATE TABLE #TBL1 (Property nvarchar(255))
ALTER PROCEDURE DBO.InsertProperties(@Prop NVARCHAR(200))
AS
BEGIN
INSERT INTO #TBL1 VALUES ('N'+char(39)+@Prop+char(39))
END
DBO.InsertProperties '????' --Run the SP
For the above execution ???? gets inserted, even though i had use N in the SP.
Is there a way to handel N inside the SP. I mean when i execute the SP as
DBO.InsertProperties '????' --Run the SP
Japanese text gets inserted.
Remove the 'N' from inside the proc as follows:
USE TestB; --replace with your appropriate database
GO
DROP TABLE TBL1;
CREATE TABLE TBL1 (Property nvarchar(255))
GO
DROP PROCEDURE DBO.InsertProperties;
GO
CREATE PROCEDURE DBO.InsertProperties(@Prop NVARCHAR(200))
AS
BEGIN
INSERT INTO TBL1 VALUES (char(39)+@Prop+char(39))
END
GO
EXECUTE DBO.InsertProperties N'????' --Run the SP
GO
SELECT *
FROM TBL1;
GO
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply