Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 alter table

Author  Topic 

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-03-19 : 20:00:10
what am i doing wrong!

SQL Server 6.5
alter table versiondata drop column id

returns
incorrect syntax near 'id'.

ps I tried with [id]

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-19 : 20:21:45
If I remember correctly DROP COLUMN is not supported in 6.5. You need to create another table with the proper structure and then INSERT the rows from the old table into the new one.

Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-03-19 : 20:24:02
I suspect you remember correctly.

Thanks

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-03-19 : 20:51:47
what about modifying the column so it is no longer an identity?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-19 : 21:29:43
Well, see, I don't like to use Identity so I don't know. The same thing would apply; create a new table with the structure you want and insert the data into it.

I think that with 6.5, in general, the most you can do with ALTER TABLE is to add or drop constraints (check, foreign keys, or primary/unique keys) and I think add a column. They added a lot of extra functionality with 7.0 that really should've been there earlier, but wasn't. Probably had to do with the fact that pages were 2K in 6.5; they were too small to justify major structural changes to the table like dropping a column.

You should have Books Online for 6.5, it'll detail exactly what the statement allows. I think it even lists workarounds for the stuff that's missing. It may allow you to un-identity a column but I don't have that version to say for sure.

Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-03-19 : 21:31:09
Thanks again rob. I must have been looking at the ver 7 BOL.

Cheers

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-03-20 : 00:49:49
with 6.5 i think you cant modify a column using Alter table.



--------------------------------------------------------------
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-03-20 : 01:03:14
Nup - now I'm looking at the right BOL...to coin a common phrase "you can't do nuttin'"

According to BOL you can only add or drop constraints and not columns.

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -