Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 25th, 2006, 03:15 PM
Registered User
 
Join Date: Nov 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

 
Old November 25th, 2006, 03:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.
[email protected]





Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Data Type Behaviour mat41 SQL Server ASP 8 August 28th, 2006 07:17 PM
changing the point type anukagni Access 2 July 29th, 2006 12:04 AM
Changing data type error kuku SQL Server 2000 1 August 18th, 2005 10:20 AM
changing data type when importing Excel worksheet awwhite Access VBA 0 September 8th, 2004 09:37 AM
Changing data type JLN Pro VB 6 1 July 13th, 2004 12:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.