Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 29th, 2005, 10:24 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data type change from int to Varchar

Hi,

I use sql server 2003 data base. I want to change one of the field in a table from int to varchar without losing any data. Is it possible? If so, please let me know how to do it.

Thanks in advance.

GG

Reply With Quote
  #2 (permalink)  
Old April 29th, 2005, 10:59 AM
Friend of Wrox
 
Join Date: Jan 2004
Location: , , USA.
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

create a new column of varchar and update it with exisitng column
UPDATE myTable
SET NewvarcharCol = CONVERT(varchar(20),intcolumn)

Check your data and drop the original column..

why are you converting your column data type..?

there is no SQL Server 2003.. (SQL server 2000 only)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cast varchar as int SQL Server 2005 mr_pc1963 SQL Language 2 April 23rd, 2008 07:09 AM
Error converting data type varchar to int. - SQL baysaa SQL Server ASP 1 March 17th, 2008 12:56 AM
Is maxium size of varchar data type is 8000? kawrat SQL Server 2000 7 February 5th, 2007 04:08 AM
Error converting data type varchar to float. Trojan_uk SQL Server ASP 5 April 27th, 2004 03:56 AM
change data type to date kherboon Access 2 July 29th, 2003 11:33 PM



All times are GMT -4. The time now is 03:41 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.