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 

lane0618
Posting Yak Master

134 Posts

Posted - 2002-05-31 : 13:53:26
What is the correct sytax to remove column h32-045 from my features table? The follwing gives me "Incorrect syntax near 'h32-045'"

ALTER TABLE features remove 'h32-045'

Thanks!
Lane

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-31 : 14:10:15
You might want to try looking up ALTER TABLE in books on line.....

<O>
Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-05-31 : 14:13:16
If I had a column in a table named 'h32-045' I'd go on a shooting spree

quote:

What is the correct sytax to remove column h32-045 from my features table? The follwing gives me "Incorrect syntax near 'h32-045'"

ALTER TABLE features remove 'h32-045'

Thanks!
Lane





setBasedIsTheTruepath
<O>
Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-05-31 : 14:15:03
and then i would sharpen one end of the server case and fall on it

quote:

If I had a column in a table named 'h32-045' I'd go on a shooting spree

quote:

What is the correct sytax to remove column h32-045 from my features table? The follwing gives me "Incorrect syntax near 'h32-045'"

ALTER TABLE features remove 'h32-045'

Thanks!
Lane





setBasedIsTheTruepath
<O>



setBasedIsTheTruepath
<O>
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-31 : 14:27:15
To a with only a hammer, everything looks like a nail....
quote:

and then i would sharpen one end of the server case and fall on it

quote:

If I had a column in a table named 'h32-045' I'd go on a shooting spree

quote:

What is the correct sytax to remove column h32-045 from my features table? The follwing gives me "Incorrect syntax near 'h32-045'"

ALTER TABLE features remove 'h32-045'

Thanks!
Lane





setBasedIsTheTruepath
<O>



setBasedIsTheTruepath
<O>



<O>
Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2002-05-31 : 15:03:21
try putting the name in brackets [h32-045]



Mike
"oh, that monkey is going to pay"
Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-05-31 : 15:06:36
I think the professor misses the point ... how could anyone possibly support such absurd column names??? We need to stop the bleeding here!

setBasedIsTheTruepath
<O>
Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2002-05-31 : 15:09:49
Actually, I think getting him to delete the column is stopping the bleeding. Retraining and fixing the f'd up column names is more like severing the body parts and reattaching them.

Mike
"oh, that monkey is going to pay"
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-31 : 15:12:15
well if we really want to help him drop the column, shouldn't we suggest he remove the illegal syntax?

<O>
Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-05-31 : 15:12:22
True, true. But a few points should be awarded for attempting DDL instead of just going through EM.

So let's poll: what could h32-045 possibly represent?

setBasedIsTheTruepath
<O>
Go to Top of Page

lane0618
Posting Yak Master

134 Posts

Posted - 2002-05-31 : 15:32:35
Looks like the syntax is:

ALTER TABLE features DROP COLUMN [TEST-99]

But now I get this error:

ALTER TABLE DROP COLUMN TEST-99 failed because DEFAULT CONSTRAINT DF__features__test-9__12C8C788 accesses this column.


By the way, I realize the column headings are ridiculous, but I'm working on an existing corporate database so I am not at ease to make whatever changes I want.

Thanks,
Lane

Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-05-31 : 15:36:40
Perhaps you shouldn't drop the column after all ... someone likely put that constraint there for a reason.

So why did you want to drop this bad boy in the first place? Didn't like the name?

setBasedIsTheTruepath
<O>
Go to Top of Page

lane0618
Posting Yak Master

134 Posts

Posted - 2002-05-31 : 15:43:58
Nevermind, looks like a default value was to blame....

Go to Top of Page
   

- Advertisement -