SQL stored procedure naming rules

Source: Internet
Author: User
SQL stored procedure naming rules

Standardized naming can improve the efficiency of development and maintenance. If you are creating a new stored procedure, refer to the following naming rules.

Syntax:

The stored procedure name includes the following syntax:
[Proc] [maintablename] by [fieldname (optional)] [action]
[1] [2] [3] [4]

[1] All stored procedures must have the prefix "proc _" and all system stored procedures must have the prefix "SP _".

Note: If the stored procedure is named with the prefix SP _, it runs slowly because SQL Server first searches for the system stored procedure.

[2] The table name is the primary object accessed by the stored procedure.

[3] optional field names are condition clauses. For example: proc_userinfobyuseridselect

[4] The final behavior verb is the task to be executed in the stored procedure.

If the stored procedure returns a record, the suffix is: select
If the Stored Procedure inserts data, the suffix is insert.
If the stored procedure updates data, the suffix is: update.
If the stored procedure is inserted or updated, the suffix is: Save
If the Stored Procedure deletes data, the suffix is: Delete.
If the stored procedure updates the data in the table (ie. Drop and create), the suffix is: Create
If the stored procedure returns an output parameter or 0, the suffix is output.

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.