1. cursor Mode
CopyCode The Code is as follows: declare @ data nvarchar (max)
Set @ DATA = '1, tanw, 2, keenboy '-- id, name
Declare @ dataitem nvarchar (100)
Declare data_cursor cursor for (select * From Split (@ data ,';'))
Open
Usage:
Temporary tables can be used to store related records for complex queries, which improves efficiency andProgramIs similarMy_cursor declare my_cursor cursor scrollFor select field from tablenameTemporary tables are divided into user
In the tutorial windows 11th Server Installation and setup tutorial-mssql security Article 1 (run ms SQL Server under a common user), the author said step 1 "after setting directory permissions, the ms SQL Server Running user needs to be set to
1. Calculate the total score and rank each person
Select name, sum (score) as allscore from stuscore group by name order by allscore
2. Calculate the total score and rank each person
Select distinct t1.name, t1.stuid, t2.allscore from
Or first
Code Let's take a look at the SQL statement to remove duplicate records and obtain duplicate records.
Copy code The Code is as follows: Alter procedure [DBO]. [proc_itemmaster_getunique] @ pageindex int, @ uid int, @ itemnumber varchar (50
First of all, I need to emphasize that this article aims to reveal the principle of recovering the deletion records of heap tables. What I have considered does not apply to every situation of everyone. I hope you will forgive me ~
Many friends
Misunderstanding #27: Using BACKUP... with checksum can replace DBCC CheckDB
Error
At first glance, because backup with checksum will detect the CHECKSUM values of all allocated pages, this misunderstanding seems to be the case, but in fact it is
Misunderstanding #25: Multiple misunderstandings about fill Factors
All are errors.
25a) Fill Factor always existsNo, it can be seen through Books Online (Translator: I did not find this sentence in the new version of the BOL ):Important:The fill
Misunderstanding #18: Several misunderstandings related to FileStream
All Errors
18 a) FileStream data can be stored remotely
No, because the FileStream data container (which refers to the NTFS folder that stores the FileStream file, the fabricated
Misunderstanding #8: Online indexing does not lock related indexes
Error!
Online indexing is not as good as you think.
The online index operation locks resources temporarily at the start and end of the operation. This may cause serious blocking
This also reduces the issue of CPU cache hit failure (click this link to view how the CPU cache works and the MESI protocol ). Let's expose three common mistakes related to NULL bitmap.
Misunderstanding # 6a: NULL bitmap is not always
Misunderstanding #4: DDL triggers (introduced after SQL Server 2005) are INSTEAD triggers
This is wrong
The implementation principle of DDL triggers is actually an AFTER trigger. This means that a DDL operation is performed first, and then the
Question: How can I import an XML file to SQL Server 2000?Answer:: There are several ways to import XML files to SQL Server. Here, three of them are provided:
Large-capacity load COM interface. To extract the object and attribute of a document to a
How to Use CONVERT:
Format:CONVERT (data_type, expression [, style])Note:This style is generally in the time type (datetime, smalldatetime) and string type (nchar, nvarchar, char, varchar)It is used only when they are converted to each
Why use transactions?
When updating multiple tables, an execution fails. Transaction rollback is required to maintain data integrity.
Display Set transactions
Copy codeThe Code is as follows: begin try
Begin transaction
Insert into shiwu (asd)
Lock a table in the database
SELECT * FROM table WITH (HOLDLOCK)
Note: What is the difference between locking a database table?
SELECT * FROM table WITH (HOLDLOCK)
Other transactions can read tables, but cannot update or Delete tables.
SELECT *
Start SQL server
Net Start MSSqlServer
Pause SQL server
Net Pause MSSqlServer
Restart the suspended SQL server
Net Continue MSSqlServer
Stop SQL server
Net stop MSSqlServer
Modify the SQL server sa password using the command line
I have always
Two organizational structure tables (Organise) and wage distribution History Table (WagePerMonthHis)
The two tables are associated through Organise. Item_id and WagePerMonthHis. OrgIdS.
In the Organise table (hereinafter referred to as the O table),
Table replication:
1. insert into select statement
Statement format: Insert into Table2 (field1, field2,...) select value1, value2,... from Table1
The target table Table2 must exist. Because the target table Table2 already exists, We can insert
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.