Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

SQL statement
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.

Report this thread to moderator Post Follow-up to this message
Old Post
Peter
04-26-05 08:23 AM


Re: SQL statement
On 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)

Report this thread to moderator Post Follow-up to this message
Old Post
Hugo Kornelis
04-26-05 08:23 AM


Re: SQL statement
WITH 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
--



Report this thread to moderator Post Follow-up to this message
Old Post
David Portas
04-26-05 08:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 10:12 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006