Results 1 to 3 of 3

Thread: [RESOLVED] Adding A Field To A Table

  1. #1

    Thread Starter
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Resolved [RESOLVED] Adding A Field To A Table

    I'm trying to add a new field to an existing table using this:
    Code:
    alter table users add column Staff_LVL int
    and Query Analyser is saying: Server: Msg 156, Level 15, State 1, Line 1
    Incorrect syntax near the keyword 'column'.

    Where is the syntax incorrect (and please don't say "near the keyword column" )
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Adding A Field To A Table

    Isn't it just:

    ALTER TABLE XYZ ADD NEWCOLNAME INT

    I think the COLUMN is assumed...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Re: Adding A Field To A Table

    Quote Originally Posted by szlamany
    Isn't it just:

    ALTER TABLE XYZ ADD NEWCOLNAME INT

    I think the COLUMN is assumed...
    I was making things to hard on myself szlamany. You are correct...column is assumed.

    Thank you sir!
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

Posting Permissions

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



Click Here to Expand Forum to Full Width