![]() Similar to built-in database functions, a user-defined function accepts only input parameters and contains a set of SQL statements that perform actions and return the result, which can be either a single value or a table. Here are a few examples of well-named stored procedures to formulate your own: Instead, consider a prefix like "usp_" instead. Even if you don't host your database(s) on SQL Server, you should probably avoid using this as a naming convention, just in case you ever switch. If you do not specify the database where the object is, SQL Server will first search the master database to see if the object exists there and then it will search the user database. That being said, there's at least one good reason to avoid it as it's already used by SQL Server as a standard naming convention in the master database. The most obvious prefix to use on a stored procedure is "sp_". Most DBAs like to give their stored procedures a prefix that identifies it as such, followed by the action that the stored procedure takes and then the name representing the object or objects it will affect:Īctions that you may take with a stored procedure include: Stored procedures are similar to functions in programming in that they can accept parameters, and perform operations when we call them. ![]() Typically, they contain statements that are used frequently. Stored proceduresĪ stored procedure is a set of statement(s) that perform some defined actions. This installment will offer some guidelines for naming other database objects such as Stored Procedures, Functions, and Views. In Part 1, we covered the rules for naming tables, while Part 2 explored conventions for column names. Welcome to the 3rd and final installment on SQL naming conventions. A Quick Guide to Naming Conventions in SQL - Part 3 by Robert Gravelle Stored Procedures, Functions, and Views
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |