Discover stored procedure performance tuning in sql server, include the articles, news, trends, analysis and practical advice about stored procedure performance tuning in sql server on alibabacloud.com
Stored Procedure application for SQL Server database development (reproduced)
Author: cultivator
CollationSome may have been using SQL Server for development for some time, but they have not or seldom used
Many friends may have been using SQL Server for development for some time, but have not or rarely used the stored procedures in the project, perhaps some friends think that there is no need to use stored procedures and so on. In fact, when you finish the maintenance phase of a project, you will find that the
Label:Not finished, feeling a bit of a problem.================================== Declaration ==================================This article is original, reproduced in the text of the influential annotated author and source, and to ensure the integrity of the article.Do not modify (including this statement) without the consent of the author, and reserve the right of legal investigation.Do not use for publication, printing or academic reference without the consent of the author.In order to ensure
Some may have been using SQL Server for development for some time, but they have not or seldom used stored procedures in projects. Some may think that there is no need to use stored procedures. In fact, when you have completed the maintenance phase of a project, you will find that the
1. Create Database Liezui_Test
ID int primary key auto-Increment
Title varchar (100)
ReadNum int
2. Insert 1 million data records into the databaseDeclare @ I int
Set @ I = 1
While I Begin
Insert into Liezui_Test (Title, ReadNum) values ('total execution statistics', @ I)
Set @ I = @ I + 1
End
GO
Declare @ I int
Set @ I = 1
While I Begin
Insert into Liezui_Test (Title, ReadNum) values ('towels are prone to harmful bacteria because they are often wet. ', @ I)
Set @ I = @ I + 1
End
GO
3. added
Microsoft's SQL Server Stored Procedure mechanism can greatly simplify the database development process by combining Transact-SQL statements.
Microsoft SQL Server's stored
stored is as follows:
EXECUTE ' stored procedure name ' parameter '---omit the argument if there are no arguments
Common system stored procedures
EXEC sp_databases lists the databases in the current systemEXEC sp_renamedb ' Northwind ', ' Northwind1 ' modify the name of the database (single user access)Use the stud
Some may have been using SQL SERVER for development for some time, but they have not or seldom used stored procedures in projects. Some may think that there is no need to use stored procedures. In fact, when a project is completed in the maintenance phase, you will find that the st
The problem I met yesterday was to execute a paragraph. Changes to the field state of a different table according to the variable tablename. Because of the server, I could not write SQL directly in the data access layer, so I had to pull out and put it in the stored procedure.
There is a problem here, I spent a long t
A stored procedure is one or more SQL commands that are stored as executable objects in the database.Definitions are always abstract. A stored procedure is actually a set of SQL stateme
server| Stored Procedures | There are many articles accessing ASP and stored procedures (Stored procedures), but I doubt whether the authors have actually practiced them. I have consulted a lot of relevant data at the beginning of the class, and found that many of the methods provided are not the case. For simple appli
Label:With SQL Server's own Message Queuing service Borker, the call to the stored procedure, a cross-library operation was performed, first with a user, the permissions are sufficient, but always prompted the server principal "user" Cannot access the database "dbname" under the current security context. Thinking is a
) select gid from TGongwenWhere fariqi> dateadd (day,-365, getdate () order by fariqi descSelect O. gid, O. mid, O. title, O. fadanwei, O. fariqi from TGongwen O, @ indextable tWhere O. gid = t. nid and t. id> @ PageLowerBoundAnd t. id End
The stored procedure above set nocount off uses the latest SQL SERVER Technology
Advantages of Stored Procedure
Why use stored procedures? The following are the main advantages of Stored Procedure technology:
Pre-compiled execution program. SQL Server only needs t
Advantages of Stored Procedure
Why use stored procedures? The following are the main advantages of Stored Procedure technology:
Pre-compilation and executionProgram. SQL Server
The stored procedure is used in many places when the data center is reconstructed. Here is a brief summary.
Stored Procedure is a set of SQL statements for specific functions. It is compiled and Stored in the database. You can run
fariqi descselect O. GID, O. mid, O. title, O. fadanwei, O. fariqi from tgongwen o, @ indextable twhere O. gid = T. NID and T. id> @ pagelowerboundand T. ID
The above stored procedures use the latest SQL server technology-Table variables. It should be said that this stored proced
stored procedure, and the content can be changed ). Only applicable to cursor parameters.
Default
The default value of the parameter. If the default value is defined, the process can be executed without specifying the value of this parameter. The default value must be a constant or null. If the like keyword is used for this parameter, the default value can contain wildcards (%, _, [], and [^]).
Output
Indi
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.