Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Insert and Update Unicode

Author  Topic 

pcperera
Starting Member

12 Posts

Posted - 2007-06-15 : 03:25:45
nsert and Update Unicode
Below I write some line of my SP
But I does not write Unicode data to table, it writes like ????????
How can avoid this problem


SP header:

CREATE PROCEDURE ltrsp_AddEditUnit
@UnitID char(4),
@UnitName nvarchar(20),
@UtrID int

Insert:

INSERT INTO ltrtb_Unit (UnitID,UnitName,UtrID) VALUES (@UnitID,@UnitName,@UtrID)

Update:
---
UPDATE
ltrtb_Unit
SET
UnitName=@UnitName, UtrID=@UtrID

WHERE
UnitID=@UnitID

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-06-15 : 04:25:23
the datatype must be nvarchar(20) not varchar

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

pcperera
Starting Member

12 Posts

Posted - 2007-06-15 : 05:01:11
thanks spirit1, it is nvarchar but don't work (Now I change it to nvarchar, thanks for mentioning it)

*************
I found a method to insert unicode data to table (Using N' prefix), but I want to add using declared variable


INSERT INTO ltrtb_UserLevel (UserLevel,Description) VALUES (1,N'#3461;#3504;#3538;#3482;#3535;#3515;#3539;')

http://databases.aspfaq.com/general/why-do-some-sql-strings-have-an-n-prefix.html
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-06-15 : 05:08:06
i don't think i quite understand your problem.

bot your column and the variabe must have the same datatype (nvarchar) with the same length.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

pcperera
Starting Member

12 Posts

Posted - 2007-06-15 : 05:11:15
I have stored procedure, I send unicode data using VB.NET command, but these data don't record in the table, it displays Like ?????, my problem is how to send unicode data to table (refer above question),
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-06-15 : 05:26:09
displays like ??? where?


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

pcperera
Starting Member

12 Posts

Posted - 2007-06-15 : 05:28:48
after execute the query, I open the table, its columns(Fields) filled with data which I sent,
but, Unicode data displays like ??????? in the tables column(Field)

http://databases.aspfaq.com/general/why-do-some-sql-strings-have-an-n-prefix.html

Go to Top of Page
   

- Advertisement -