Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesHi, Am having trouble with an alter table command in SQL, it is the below command, and gives the error message shown below. alter table "Test" add "Test" numeric(10,0) with values NULL Server: Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'with'. I realise it has something to do with the 'with values NULL', but some more clarification would be good. Is it because you cannot specify 'NULL' for the numeric type? I find plenty of info on the net about the rest of the statement, but the 'with values' bit there seems to be nothing about it.
Post Follow-up to this messageOn 25 Apr 2005 22:18:19 -0700, Peter wrote: >Hi, > >Am having trouble with an alter table command in SQL, it is the below >command, and gives the error message shown below. > >alter table "Test" add "Test" numeric(10,0) with values NULL > >Server: Msg 156, Level 15, State 1, Line 1 >Incorrect syntax near the keyword 'with'. > >I realise it has something to do with the 'with values NULL', but some >more clarification would be good. Is it because you cannot specify >'NULL' for the numeric type? > >I find plenty of info on the net about the rest of the statement, but >the 'with values' bit there seems to be nothing about it. Hi Peter, The correct syntax is ALTER TABLE Test ADD Test numeric(10,0) DEFAULT NULL WITH VALUES Best, Hugo -- (Remove _NO_ and _SPAM_ to get my e-mail address)
Post Follow-up to this messageWITH VALUES is only valid if you are declaring a DEFAULT. Since you apparently want the default value to be NULL there is no need for a DEFAULT or the WITH VALUES clause. The values will be NULL anyway. -- David Portas SQL Server MVP --
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread