all groups > sql server programming > may 2004 >
You're in the

sql server programming

group:

Nvarchar


Nvarchar Joe
5/31/2004 10:50:31 PM
sql server programming:
Dear all,

How can I update a nvarchar field with a varchar field of
the same table?

Re: Nvarchar Hari
6/1/2004 11:47:32 AM
Hi,

Use the update command directly.

create table table_name(var_col varchar(5),nvar_col nvarchar(5))

update table_name
set nvar_col = var_col

Note:

You will have problems when you update the varchar column having more than
4000 length, because NVARCHAR datatype require 2 times than
the storage of VARCHAR. It allows a maximum of 4000 charecters length.


Thanks
Hari
MCDBA


[quoted text, click to view]

Re: Nvarchar Roji. P. Thomas
6/1/2004 11:50:12 AM

CREATE TABLE #test(vname VARCHAR(30),nvName NVARCHAR(30))

INSERT INTO #test(vname) VALUES('Aron Bertrand')
INSERT INTO #test(vname) VALUES('Joe Celko ')
INSERT INTO #test(vname) VALUES('David Portas')
INSERT INTO #test(vname) VALUES('Anith Sen')
INSERT INTO #test(vname) VALUES('Steve Kass ')

SELECT * FROM #test

UPDATE #test
SET nvname = vname

SELECT * FROM #test

DROP TABLE #test

--
Roji. P. Thomas
SQL Server Programmer
[quoted text, click to view]

AddThis Social Bookmark Button