Insert Into statement in sql server:
We can use insert into statement in Sql Server in two ways:
1.Insert in all column of the a table
Syntax: Insert into values(value1, value2, value3,…..)
Example:
CREATE TABLE MST_EMPLOYEE_MASTER
(
EMP_ID NUMERIC(18,0)IDENTITY(1,1),
EMP_NAME VARCHAR(50),
DEPARTMENT_NAME VARCHAR(25),
SALARY NUMERIC(18,2)
);
INSERT INTO MST_EMPLOYEE_MASTER VALUES('Shashi','Software Development',50000.00);
(1 row(s) affected)
SELECT * FROM
MST_EMPLOYEE_MASTER;
2.Insert in only specified column in a database
Syntax: Insert into (column1, column2, column3) values (value1,
value2, value3);
Example:
INSERT INTO MST_EMPLOYEE_MASTER (EMP_NAME, DEPARTMENT_NAME, SALARY) VALUES('Vikas','Software Development',100000.00);
SELECT * FROM
MST_EMPLOYEE_MASTER WHERE EMP_NAME='Vikas';
No comments:
Post a Comment