Headder AdSence

How to add new Column to existing table in SQL Server


     I know it's simple statement and most of the people known this query, but some times we forgot the syntax so that I got a thought why should not post this? ... :) :) 

Syntax: 

ALTER TABLE <Table Name> ADD <Column Name> <Data Type>

Example

ALTER TABLE Emp2 ADD E_Addres INT

 Please See below Screenshot 


User Defined Table Type


SQL Server  providing the User Defined Table Type, as of my knowledge this is useful when we need to pass parameter to the Stored Proc or Functions as a table values.

Here we can create different data types of columns like INT, VARCHAR etc.

we can create User Type Table  in two ways, here I am giving only one type simply

/* Create a user-defined table type */
CREATE TYPE LocationTableType AS TABLE
    ( LocationName VARCHAR(50)
    , CostRate INT )
GO



















It would create User Defined Table Type