Changing the datatype of a Column

Please support our MS SQL advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2005
Posts: 175
Reputation: Letscode is an unknown quantity at this point 
Solved Threads: 6
Letscode's Avatar
Letscode Letscode is offline Offline
Junior Poster

Changing the datatype of a Column

 
0
  #1
Jul 14th, 2005
Hello,
I want to change the datatype of a field from Varchar to integer in T-SQL.

I tried something like Modify like you use in Oracle.

ALTER TABLE tablename
MODIFY COLUMNNAME Datatype.

But its not working in SQL server..

Any thoughts.
Save White Tiger
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 27
Reputation: wchitamb is an unknown quantity at this point 
Solved Threads: 0
wchitamb wchitamb is offline Offline
Light Poster

Re: Changing the datatype of a Column

 
0
  #2
Jul 14th, 2005
i am not very sure is it different as in SQL where yu can go to the database that you want and then you go to the table and then you click the right side of yur mouse and go to design table and change it
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 175
Reputation: Letscode is an unknown quantity at this point 
Solved Threads: 6
Letscode's Avatar
Letscode Letscode is offline Offline
Junior Poster

Re: Changing the datatype of a Column

 
0
  #3
Jul 14th, 2005
I changed it. I went to enterprise Manager and went to design view of the table and changed the data type of the field.

Thanks anyway
Save White Tiger
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 175
Reputation: Letscode is an unknown quantity at this point 
Solved Threads: 6
Letscode's Avatar
Letscode Letscode is offline Offline
Junior Poster

Re: Changing the datatype of a Column

 
0
  #4
Jul 14th, 2005
Thanks Wchitamb.
Save White Tiger
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 13
Reputation: Estuardo is an unknown quantity at this point 
Solved Threads: 0
Estuardo Estuardo is offline Offline
Newbie Poster

Re: Changing the datatype of a Column

 
0
  #5
Jul 19th, 2005
G'd evening!
In case you still need to change the table's column type from T-SQL , the sintax for MS SQL is:
ALTER TABLE table ALTER COLUMN column_name new_data_type
Ex.
ALTER TABLE MyTable ALTER COLUMN MyColumn NVARCHAR(20)

For more about the Alter Table sintax, read the books on line (BOL), here is the last update for SQL 2k SQL Server Books Online January 2004 Update
Good luck
Estuardo
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: munna barik is an unknown quantity at this point 
Solved Threads: 0
munna barik munna barik is offline Offline
Newbie Poster
 
0
  #6
34 Days Ago
thank u ESTUARDO for sending t-satatment on changing data type
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC