Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting nvarchar to varchar

Status
Not open for further replies.

Sethington

Technical User
May 16, 2006
34
US
I am converting about a dozen Access databases to SQL Server 2005 and when they import their default datatype is nvarchar. My employer wants me to convert them all to varchar.

What is the fastest way to do this besides going into each table and manually converthing the databtypes. Is there a way to find a replace datatypes?
 
Nope. Manually changing all of the data types will be the option. SQL Server has to change the way it stores the data when changing from NVARCHAR to VARCHAR.

I'm curius why your employer want's to use VARCHAR instead of NVARCHAR. With SQL 2005 NVARCHAR is the recommended method for storing text these days.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Why use nvarchar if you don't need it? It takes up twice as much space as varchar and is only needed for unicode text.

Just curious...

Jim
 
I've been working on the same application for 8 years (we are currently working on version 8). The application doesn't look anything like it used to.

My point?

Applications change, and so do their scope. Some day you may mish that you had used nvarchar instead of varchar. Imagine going back through all your database code to make sure it supports nvarchar. Not fun.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
If the tables have not been uploaded, have you tried to import into a table you have already created?
Or: Create a file with the structures of the tables you want to change then create new tables by editing the file changing NVarChar to VarChar. Use "Generate SQL Script..." or the system file.
After running the sql file, then insert data from original table to the created table.
 
Good point George, for apps that may become something that it was not initially intended to be.
 
Thanks for the feedback, I think I'm going to talk to my Manager and double check to make sure that thats what she wants. I'm thinking that she just isn't up with the times yet. Thanks.

But you didn't here that from me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top