DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    raja Guest

    adding colum to table


    how i can add a new colum to table without using constant name



  2. #2
    Krishna Guest

    Re: adding colum to table


    I am not very sure what you mean by "constant name". To add a new column to
    an existing table (assuming SQL Server 7.0)

    Go to SQL Server Enterprise Manager
    Expand the Server and Database
    Click Tables
    Rignt Click the table you want to add a column
    Click Design Table
    Enter Column Name, Data Type and other reqd. parameters
    Click Save

    You must have to have db_ddladmin database role to perform the above.

    Cheers.


    Krishna Pada Das, MCDBA
    Consultant
    The Power Of Ten
    Sydney, australia


    "raja" <raja@classnet.co.il> wrote:
    >
    >how i can add a new colum to table without using constant name
    >
    >



  3. #3
    D. Patrick Hoerter Guest

    Re: adding colum to table

    raja,

    If you want to add a dynamically-named column, such as via a
    parameterized stored proc, you need something like this:

    DECLARE @ColumnName varchar(30)
    SET @ColumnName = 'NewColumn'

    DECLARE @SQL varchar(255)
    SET @SQL = 'ALTER TABLE doc_exa ADD ' + @ColumnName + ' VARCHAR(20)
    NULL'

    EXECUTE (@SQL)

    ...this code would add a new column named 'NewColumn', of type varchar,
    with length 20, and nullable = True.

    Regards,
    D. Patrick Hoerter




    raja wrote in message <38f9b062$1@news.devx.com>...
    >
    >how i can add a new colum to table without using constant name
    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links