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 2008 Forums
 Transact-SQL (2008)
 drop column

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-01-26 : 07:31:00
I would like to drop a field by indicating the index order and NOT the name of the field.
How is this done please?
something like: ?

alter table tblMain
drop column(9)

Thanks

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-01-26 : 07:43:57
If you want to do that you'll need to query sys.columns for the name of the column with a column_id or 9, get the name into a variable and use dynamic SQL to run the ALTER.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-01-26 : 07:48:53
I see.
Thanks
Go to Top of Page
   

- Advertisement -