p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   SQL Server 2000 (http://p2p.wrox.com/forumdisplay.php?f=20)
-   -   Changing Data type (http://p2p.wrox.com/showthread.php?t=50754)

samnachilomo November 25th, 2006 03:15 PM

Changing Data type
 
Hi

I have created a table with SQL server 2000 and I had a field named filedID with tinyint as the datatype. Now I want to change the datatype to SMALLINT.
I am doing it by using ALTER TABLE as follows

ALTER TABLE Table1
ALTER FIELD filedID SMALLINT

I am getting an error message


Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near 'FIELD'.


My question is how can I change a field data type if I already created a field with a different datatype before?

Thanks


Sam


Jeff Mason November 25th, 2006 03:25 PM

A relational database (e.g SQL Server) doesn't have Fields in a table, it has Columns.

The distinction is more than just a different name...

Try ALTER COLUMN instead.

Jeff Mason
Custom Apps, Inc.
je.mason@comcast.net


All times are GMT -4. The time now is 07:57 PM.

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