SQL Server tips

Source: Internet
Author: User

1. Execute the command line to import a large file SQL script:
Osql-s 192.168.0.97-U sa-P 123-d job-I j: \ persontb1_edit. SQL

2. Views are commonly used for a large number of queries, which will significantly increase the speed and reduce the number of queries. Remember, the number of database queries is often the biggest factor affecting the speed.

3. If you want to add a unique judgment to the column but do not want to take effect for null, it means that null can exist repeatedly, so you cannot use the unique constraint of unique, which must be implemented using a trigger.
Example:
Create trigger t_check_sz_id_number on jf_quodao_record_tbl
For insert, update
Begin
If (select max (CNT) from
(
Select count (I. sz_id_number) as CNT
From jf_quodao_record_tbl T1, inserted I
Where t1.sz _ id_number = I. sz_id_number
Group by I. sz_id_number
) X
)> 1
Rollback tran
End

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.