November 14, 2003 at 7:47 am
I try drop column in one table is not dropping. Syntax is ALTER TABLE PADatawell DROP COLUMN [# OF MO TO PAY CLS] and i anm getting following error
Server: Msg 8166, Level 16, State 1, Line 1
Constraint name '# OF MO TO PAY CLS' not permitted. Constraint names cannot begin with a number sign (#).
Anybody can tell me how to delete this column.
November 14, 2003 at 8:04 am
Nice one, tried it but not even in EM I am able to drop this column.
Curious on the solution, though!
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
November 14, 2003 at 8:07 am
Have you try to re-name the column first and then drop it?
November 14, 2003 at 8:09 am
I try rename the column using EM but i got following error message.
'PADatawell' table
- Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 2: Incorrect syntax near 'S'.
[Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string ')
'.
November 14, 2003 at 8:11 am
What about exporting all other data into a new table, drop the existing table and rename the new to old?
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
November 14, 2003 at 8:14 am
Good idea but table is very big (95 million records)and table has 49 columns.
November 14, 2003 at 8:15 am
Well, if noone knows another solution....
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
November 14, 2003 at 8:26 am
Use sp_rename to first rename it to something not starting with "#".
sp_rename 'table.[# OF MO TO PAY CLS]', 'newname', 'column'
--Jonathan
--Jonathan
November 14, 2003 at 8:38 am
it works Great. Thanks a lot jonathan
November 14, 2003 at 11:44 am
Didn't you say above you've tried to rename and it didn't work ?
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply