SQL Server INSERT Statement
SQL INSERT Statement is used to add new row/record to the database table.
--example
INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)
VALUES (value1, value2, value3,...valueN);
Column Name | Data Type |
---|---|
ID | INT |
NAME | VARCHAR(100) |
AGE | INT |
ADDRESS | VARCHAR(249) |
SALARY | DECIMAL(8,2) |
The following is the INSERT statement used to create a new record in Person table with specifying column names in the INSERT Query.
INSERT INTO
Person ( ID, NAME, AGE, ADDRESS, SALARY)
VALUES
( 1, 'Keerthana', 24, 'Hyderabad', 10,000.00);
The following is the INSERT statement used to create a new record in Person table with out specifying column names in the INSERT Query.
INSERT INTO
Person
VALUES
( 2, 'Bharath', 25, 'Hyderabad', 10,000.00 );
All the above statements would produce the following records in the persons data table as shown below.
+----+----------+-----+-----------+----------+
| ID | NAME | AGE | ADDRESS | SALARY |
+----+----------+-----+-----------+----------+
| 1 | Keerthana| 24 | Hyderabad | 10,000.00|
| 2 | Bharath | 25 | Hyderabad | 10,000.00|
+----+----------+-----+-----------+----------+
SQL Server Connection String Formats
posted on 2019-08-27 05:53:53 - SQL Server Tutorials