Friday, March 23, 2012

Problems deleting a column

Hello,
I'm trying to delete an existing varchar(10) column called "abc1" o in a
table on a SQL 2000 database and I'm getting the following error message in
Enterprise Manager.:
'myTable' table
- Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line
2: Incorrect
syntax near 'abc1'.
I tried to delete it from SQL Analyzer directly from the server's console,
but I'm getting a similar error: "Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'abc1'."
I tried to rename, change data type and size of the data type of the column,
but still could not delete it.
Any thoughts?
ThanksOn Tue, 10 Aug 2004 15:25:01 -0700, Vi wrote:

>Hello,
>I'm trying to delete an existing varchar(10) column called "abc1" o in a
>table on a SQL 2000 database and I'm getting the following error message in
>Enterprise Manager.:
>'myTable' table
>- Unable to modify table.
>ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line
2: Incorrect
>syntax near 'abc1'.
>
>I tried to delete it from SQL Analyzer directly from the server's console,
>but I'm getting a similar error: "Server: Msg 170, Level 15, State 1, Line
1
>Line 1: Incorrect syntax near 'abc1'."
>I tried to rename, change data type and size of the data type of the column
,
>but still could not delete it.
>Any thoughts?
>Thanks
Hi Vi,
You forgot to include the code you executed in query analyzer when you got
this error message.
Dropping the column abc1 from table myTable should be possible with the
following statement:
ALTER TABLE myTable
DROP COLUMN abc1
(untested)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||The code is:
--
USE myDatabase
go
ALTER TABLE dbo.myTable DROP COLUMN abc1
go
--
"Hugo Kornelis" wrote:

> On Tue, 10 Aug 2004 15:25:01 -0700, Vi wrote:
>
> Hi Vi,
> You forgot to include the code you executed in query analyzer when you got
> this error message.
> Dropping the column abc1 from table myTable should be possible with the
> following statement:
> ALTER TABLE myTable
> DROP COLUMN abc1
> (untested)
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>|||Perhaps your database is set to a pre 70 compatibility level. You can check
this with:
EXEC sp_dbcmptlevel 'myDatabase'
And set it with:
EXEC sp_dbcmptlevel 'myDatabase', 80
Hope this helps.
Dan Guzman
SQL Server MVP
"Vi" <Vi@.discussions.microsoft.com> wrote in message
news:EA353C88-D7EC-46BB-A31A-F748F87B40FE@.microsoft.com...[vbcol=seagreen]
> The code is:
> --
> USE myDatabase
> go
> ALTER TABLE dbo.myTable DROP COLUMN abc1
> go
> --
> "Hugo Kornelis" wrote:
>
a[vbcol=seagreen]
message in[vbcol=seagreen]
Incorrect[vbcol=seagreen]
console,[vbcol=seagreen]
Line 1[vbcol=seagreen]
column,[vbcol=seagreen]
got[vbcol=seagreen]|||What do you mean that you tried to change the data type and size of the
column? Were you able to do that? Or did you get error messages for those
operations also.
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Vi" <Vi@.discussions.microsoft.com> wrote in message
news:9F0BD776-CA70-42C4-92D6-0338228817EA@.microsoft.com...
> Hello,
> I'm trying to delete an existing varchar(10) column called "abc1" o in a
> table on a SQL 2000 database and I'm getting the following error message
in
> Enterprise Manager.:
> 'myTable' table
> - Unable to modify table.
> ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 2:[/vb
col]
Incorrect[vbcol=seagreen]
> syntax near 'abc1'.
>
> I tried to delete it from SQL Analyzer directly from the server's console,
> but I'm getting a similar error: "Server: Msg 170, Level 15, State 1, Line
1
> Line 1: Incorrect syntax near 'abc1'."
> I tried to rename, change data type and size of the data type of the
column,
> but still could not delete it.
> Any thoughts?
> Thanks

No comments:

Post a Comment