Re: ALTER COLUMN

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 01/26/05


Date: Wed, 26 Jan 2005 16:27:26 +0100

On Wed, 26 Jan 2005 10:20:15 -0500, Vik wrote:

>What is correct syntax to alter a few columns in one query like this:
>
>ALTER TABLE dbo.Inventory
>ALTER COLUMN
> Fld1 varchar(50) NULL,
> Fld2 int NULL
>
>I get "Incorrect syntax near ',' " error message on this query.

Hi Vik,

You can alter only one caolumn at a time.

ALTER TABLE dbo.Inventory
ALTER COLUMN
 Fld1 varchar(50) NULL
ALTER TABLE dbo.Inventory
ALTER COLUMN
 Fld2 int NULL

Best, Hugo

-- 
(Remove _NO_ and _SPAM_ to get my e-mail address)


Relevant Pages

  • Re: Restoring database with different COLLATION
    ... > How I can modify the COLLATION of the database after restoring it? ... as SQL Server 2000 supports different collations and sort orders for each ... ALTER DATABASE db_name ... ALTER COLUMN VARCHAR ...
    (microsoft.public.sqlserver.msde)
  • Re: Syntax error using example from Books Online (SQL 2005)
    ... I've disabled the Compact Edition help. ... never want to search the Compact Edition help, here is how to get rid of it. ... > ALTER TABLE MyCustomers ALTER COLUMN CompanyName SET DEFAULT 'A. ... > ALTER TABLE SalesUserDefReport ALTER COLUMN DateCreated SET DEFAULT ...
    (microsoft.public.sqlserver.clients)
  • Re: Change Data Type with VB code
    ... However, it's unlikely you'd need to alter the SYSTEM.MDW, unless you've ... Doug Steele, Microsoft Access MVP ... using ALTER COLUMN did not change the data type. ...
    (microsoft.public.access.tablesdbdesign)
  • Alter Column - strange behaviour msg 5074
    ... ALTER TABLE X ALTER COLUMN V VarChar ... create table testdata ( ... create index ix_testdata_aName on testdata on ...
    (microsoft.public.sqlserver.server)
  • Why do they make it so difficult?
    ... I finally figured out the syntax to drop the constraint but it still won't ... let me add a default value as part of an ALTER COLUMN? ... Incorrect syntax near the keyword 'CONSTRAINT'. ...
    (microsoft.public.sqlserver.programming)