How to ALTER or ADD two columns in Sql Server Table using T-Sql

Posted By  RRaveen On 25 Mar 2011 02:03:13
emailbookmarkadd commentsprint
No of Views:938
Bookmarked:0 times
Votes:0 times

Introduction

In this tips, I will explain how to ALTER or ADD two or more columns in to table by t-sql script..Sometimes we may need to modify existing table structure in database, but we may be not access design view of the table. Hence this time we can use the T-Sql to ADD or ALTER more columns into table using T-Sql.

Example

In example, going to add two to existing Employee table,

ALTER TABLE T_Employee ADD
[Salary] [decimal] (18, 3) NULL,
[Bouns] [decimal] (18, 3) NULL

That's all. now you can alter that existing table usign T-Sql with one or more columns.thank you for reading.

Sign Up to vote for this article
Other popular Tips/Tricks
    A very important feature of SQL Server 2008 is that we can enable CDC(Change Data capture) on database or table.We can track the database had CDC enabled by querying IS_CDC_ENABLED column
    Published Date : 17/Jan/2011
    A very important feature of SQL Server 2008 is that we can enable CDC(Change Data capture) on database or table.We can track the database had CDC enabled by querying IS_CDC_ENABLED column
    Published Date : 17/Jan/2011
    This is the third tips date related function in sql server. In this I going to show you how to use DATEDIFF() function in sql server. The DATEDIFF () is useful to get the specified date part between two dates
    Published Date : 16/Dec/2010
    The DATEADD function is a powerful built-in function sql server to add dates in different way and types. So I would like to explore in this tip how we can use the DATEADD function for different purpose.
    Published Date : 12/Dec/2010
    In this tips, i will explain how to select records based on Row number using ROW_NUMBER() function in sql server.
    Published Date : 02/Dec/2010
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top