Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Manipulate data tables using T-SQL statements-insert data

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Insert data (insert) syntax:

Insert [into] [column name] values

Explanation:

Insert: it's a grammatical name, meaning to insert.

Into: it is optional and can be omitted.

The table name is required and which table needs to be added. If the table name is in Chinese, it should be expanded with English square brackets

Column names can be omitted, but the order in the subsequent values list is the same as the fields in the data table

Multiple column names and multiple value lists are separated by commas (English commas,)

Example:

Insert into [Information Table] (name, × × × number, home address, ~) values ('Zhang San', '123213213213' home address', ~)

Meaning:

Add a row of Zhang San information to the information table, and the order of the front columns is the same as the order of the data values behind.

Note:

1. Insert a whole row of data, not just half a row or several columns.

two。 The number of data values must be the same as the number of columns, and each data value type, precision, and decimal places must match the corresponding column.

The 3.insert statement cannot specify a value for an identifier column because its value grows automatically.

4. For character type columns, single quotation marks are required when inserting data.

5. If you specify that a column is not allowed to be empty when you design the table, the column must insert data or an error message will be reported.

6. Inserting data items is required to meet the requirements of the check constraint.

7. Although you can not specify a column name, you should get into the habit of explicitly specifying the inserted column and the corresponding value.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report