Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
How to insert the values to the table columns in SQL
2600 Views
Syntax
If you want to insert values to all the columns in table. No need to specify the column name.
You should give the values to all the column.

insert into tableName values(columnValue1,columnValue2,columnValue..n);

If you want to insert the values to the particular column you need to specify the column name.

insert into tableName(columnName1,columnName2) values(columnValue1,columnValue2);
Example
1) insert into Orders values( 10, 'ord01', getdate(), getdate(), 100.0, 'Windstar', 'Ocean' ,1);
Hints 
Insert query used to add the values to table columns.In the following example insert the values in different conditions like with column names and without column names.

NOTE: If the value is Integer no need of single quotes(').If the value is String,char,varchar need of single quotes(').
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details