Create ,Alter,Drop In SQL server



Create Table In SQL server


CREATE TABLE STUDENT
(
  Name Varchar(20),
  Housename varchar(20),
  Age int,
 
)
SELECT * FROM STUDENT


Declare Temtable In SQL server
DECLARE @TEMTAB TABLE
(
  Name VARCHAR(20),
  Age INT
)
INSERT INTO @TEMTAB VALUES('MARK',30)
--TO INSERT YOUR SELECTED TABLE DATA TO TEMP TABLE FIRST YOU MUST DECLARE YOUR TABLE FIELED
--INSERT INTO @TEMTAB
--SELECT * FROM TABLENAME
SELECT * FROM @TEMTAB

Add and Drop Column From Table  



ALTER TABLE STUDENT ADD   POST VARCHAR(20)

SELECT * FROM STUDENT

ALTER TABLE STUDENT
DROP COLUMN POST

SELECT * FROM STUDENT

No comments:

Post a comment