This issue is especially important for projects with a relatively large scale. If there are hundreds of stored procedures in the database,
I can't find them one by one. Even if I understand the business and system very well, it will take a long
CopyCodeThe Code is as follows: -- create a data table createtable testdata
(
Id int identity (1, 1) primary key,
Data int,
Cola varchar (20 ),
COLB varchar (20)
)
Go
-- Insert Test DataDeclare @ counts intDeclare @ I intSet @ counts = 1000
SQL Server 2000Log cleanup tutorial
SQL Server 2000 database logs are too large!How can I clean up SQL Server 2000 logs?How to compress SQL Server 2000 logs?How can I reduce the Log Size of SQL Server 2000?
As far as xiaobian knows, there are many
The code of the core export job is similar to that of the job backup
Copy codeThe Code is as follows: alter PROC DumpJob (@ job VARCHAR (100 ))
AS
DECLARE @ retrun NVARCHAR (max)
DECLARE @ jobname VARCHAR (30), @ category_calss_ I INT, @
I. What is an index?
One of the best ways to reduce disk I/O and logical reads is to use the index]The index allows SQL Server to search for data in a table without scanning the entire table.
1.1. Benefits of indexes:When the table does not have a
This article aims to classify information about each operation in the execution plan.
Data Access Operations
The first basic operation is to access data. This can be done either by directly accessing the table or by accessing the index. The data
On this topic, I also see other methods on the Internet to solve the problem.
However, from the perspective of performance and code volume, I have a better solution.
Here we will share with you.
The principle is actually very simple,
Knowledge 1.
As a little programmer, it is inevitable to deal with where in and like in daily development, in most cases, the parameters we pass are not much simple, single quotation marks, sensitive characters escape, and then directly spelled into the SQL,
It is understood that the vast majority of developers have a thorough understanding of indexing, limited to the fact that most daily work has no chance, and there is no need to care about or understand indexing, when a query is too slow, you can
It is best to use bcp to insert large batches of data. If you need to insert, delete, or update data at the same time, we recommend that you use SqlDataAdapter for high efficiency, generally, these two methods meet the requirements.
Bcp Method
Copy
Copy codeThe Code is as follows: create table [dbo]. [TbGuidTable] (
[TableName] [varchar] (50) not null,
[KeyName] [varchar] (20) not null,
[KeyValue] [varchar] (100) NOT NULL
) ON [PRIMARY]
GO
If exists (select * from dbo. sysobjects where id =
I. ErrorSometimes, when you restart the Database Service, you will find that some databases are being recovered, under suspicion, or suspicious. At this time, the DBA will be very nervous, the following are some methods that have been proved in
1, understanding of exists and in (refer to http://www.jb51.net/article/28922.htm)
Exists: TRUE if the subquery contains a row
In: If the operand is TRUE or equal to one in the expression list, it is TRUE.
Exists always cannot understand
Select...
Copy codeThe Code is as follows: -- create a test table
DECLARE @ Users TABLE
(
Id int identity (1, 1 ),
UserInfo XML
)
--- Insert Test Data
DECLARE @ xml XML
SET @ xml ='
1
test1
'
Insert into @ Users (UserInfo) VALUES (@ xml)
-- Insert a
Just take notes. Nothing !!
Copy codeThe Code is as follows: -- create a test table
Create table [dbo]. [Student] (
[ID] [int] IDENTITY (1, 1) not null primary key,
[Name] [nvarchar] (20) not null default (''),
[Age] [int] not null default (0
According to the general practice, some fields cannot be exported to generate the formatted XML file, so there is no way to format the imported data during the import.
I think of two points: 1. manually modify and format the XML file; 2. Create an
In fact, not only will the table be locked as described above, but there are also many scenarios that will cause a deadlock in the Table. Unlocking is actually very simple. The following example is used to explain:
1. First create a test
Copy codeThe Code is as follows: -- code 1 DECLARE @ cc INT
SELECT NewsId, ROW_NUMBER () OVER (order by SortNum DESC) AS RowIndex INTO # tb FROM news WITH (NOLOCK) WHERE NewsTypeId = @ NewsTypeId AND IsShow = 1
SET @ cc = @ ROWCOUNT
SELECT n. * FROM
To meet the above requirements, we can use the following methods, but the efficiency is quite different.
First, create an index in the Order table:
Create unique index idx_eid_odD_oidD ON Orders (EmployeeID, OrderDate DESC, OrderID DESC)Multiple
Error:
Figure 1
If the logon trigger cannot be properly executed, the logon will fail.
For example, if this trigger is created, you can design the following code to achieve the purpose of failure.
Copy codeThe Code is as follows: create trigger
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.