add a column in a table

Posted on 2009-12-28
Last Modified: 2012-05-08
how to add a column in a table

is there a way without putting all the column names...
table is very big
Question by:rgb192
    LVL 26

    Accepted Solution

    simply you can add it with the command...

    ALTER TABLE tableName ADD columnName columnDataType

    but Im not sure this is what you are looking for
    LVL 81

    Assisted Solution

    Yes :

    Add the column yourNewColumn to the table yourTable
    A VARCHAR(20) can be NULL
    ALTER TABLE yourTable ADD yourNewColumn VARCHAR(20) NULL

    Open in new window

    LVL 5

    Assisted Solution

    Here are the list of Alter command which will help you to use play with columns of the table

    To add a column in a table, use the following syntax:
    ALTER TABLE table_name ADD column_name datatype

    To delete a column in a table, use the following syntax (notice that some database systems don't allow deleting a column):
    ALTER TABLE table_name DROP COLUMN column_name

    To change the data type of a column in a table, use the following syntax:
    ALTER TABLE table_name ALTER COLUMN column_name datatype

    Author Closing Comment

    LVL 81

    Expert Comment

    You're welcome!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now