Procedure Stored Procedure)

Source: Internet
Author: User
Procedure is undoubtedly a major topic ..
I have no experience in operating SQL-server for Custom procedure, but I am familiar with writing procedure. Thank you ..
Below is a previous Program Used prodecure, which includes input and output parameter settings.
/**/ /** *** Object: Stored Procedure DBO. pro_checkadminlogin script Date: 16:37:25 ******/
Create   Procedure Pro_checkadminlogin
@ Username   Nvarchar ( 20 ),
@ Password   Char ( 32 ),
@ Lastloginip   Char ( 15 ),
@ Output   Int Output

If   Exists ( Select ID From Admin Where Username = @ Username   And Password = @ Password )

Update Admin Set Lastloginip = @ Lastloginip , Lastlogintime = Getdate () Where Username = @ Username
Set   @ Output = 0 -- Verification passed
Set   @ Output =- 1 -- Incorrect account password

-- ---------
// Alter

Alter   Procedure Pro_procedurename
[ SQL statements ]

// Drop
Drop   Procedure Pro_procedurename

After reading this article, I learned that the procedure of MS-sqlserver can be encrypted.
ExampleCreate ProcedureP_xxx
[SQL statements]

Benefits of procedure:
The system has pre-compiled once, which greatly improves the efficiency.
Some business rules can be completed in procedure for convenient modification (you do not need to change the source Background Program)
Of course, I still know about encryption-improved securityEncryption

SQL-server also provides system procedure (SP _) and extended procedure (XP _)

Example of Adding users using the system stored procedure:

Exec sp_addlogin 'lala _ connectname', 'pwd', 'db _ name'


You can also understand that you can use extended procedure to operate the Windows Command Line interpreter after you have the SA permission,

Use master [<-- master database is the SQL-Server database for storing procedure in the system]
Exec xp_cmdshell 'dir c: \ *. EXE'

This xp_cmdshell is the method for Executing command lines in the sqlserver system.

It is estimated that most of the SQL injected statements with the most hack in the previous period will be used to discuss the next permission after successful injection ..

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: 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.