SQL Server additions and deletions to check some of the less common tips _mssql

Source: Internet
Author: User

An Insert statement

1. Insert only the default values in the data:

insert into [Dbtrain]. [dbo]. [Log_info]
Default values

2. In a nullable field, if you want to set NULL, you can press [ctrl+0], note that 0 is not o, and if you want to restore the value before you press [ESC]

Second Update statement

You can update data for the first few or a percentage

Update Top (3) [Log_info]
Set info1 = ' 1001 '

Update top (percent) [Log_info]
Set Info2 = ' 1002 '

The three Delete statements can also use the top keyword

Four Select statements

1. With Ties

Perform the following sql:select top 5 * from test
ORDER BY id DESC

The results are shown in the following figure:

Then execute the following SQL look different:

Select Top 5 with ties * from Test
ORDER BY id DESC

It can be seen that the current five records do not have the ID = 2 of the data to display the full time,

With ties, you can display the ID = 2 record.

Cond. $identity, $RowGuid, write clause

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.