SQL Statement generating errors?

Results 1 to 2 of 2

Thread: SQL Statement generating errors?

  1. #1
    Join Date
    Dec 1969

    Default SQL Statement generating errors?

    can anyone point out why this is a bad command?<BR><BR>ALTER TABLE [tblConfiguration] ADD COLUMN Guest_post BIT NOT NULL<BR><BR>the error I get is:<BR><BR>[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword &#039;COLUMN&#039;.

  2. #2
    Join Date
    Dec 1969

    Default Read the docs:

    http://msdn.microsoft.com/library/en-us/tsqlref/ts_aa-az_3ied.asp<BR><BR>I don&#039;t see any place in that where it says that <BR>&nbsp; &nbsp; ADD COLUMN<BR>is a legal construction.<BR><BR>If we select out of all the "OR" conditions only the parts you care about for your particular case, we end up with:<BR><BR>ALTER TABLE table <BR> ADD &#060; column_definition&#062;<BR><BR>&#060; column_definition &#062; ::= <BR> column_name data_type &#060; column_constraint &#062;<BR><BR>&#060; column_constraint &#062; ::= <BR> [ NULL &#124 NOT NULL ] <BR><BR>Right?<BR><BR>Which devolves down to:<BR><BR>ALTER TABLE table <BR> ADD column_name data_type [ NULL &#124 NOT NULL ] <BR><BR>Which I read as meaning your SQL was okay except for the illegal use of the word COLUMN.<BR><BR>No?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts