SYS. all_ SQL _modules view, which stores definition statements for functions, tables, stored procedures, views, etc.

Source: Internet
Author: User

Today, we will introduce the SYS. all_ SQL _modules view in SQL Server, which stores definition statements such as functions, tables, stored procedures, and views.

SYS. all_objects view, which contains the names of all objects (function name, table name, stored procedure name, view name, (main/foreign) key name, and index name ).

In this view (SYS. all_objects), we are concerned with the following columns:

· Name: name of the stored function, table name, stored procedure name, view name, (Primary/foreign) key name, and index name

· Unique identifier of the object_id object, which is the connection condition between the object and SYS. all_ SQL _modules

· Type object type

Abbreviation description
FN SQL _scalar_function
If SQL _inline_table_valued_function
F foreign_key_constraint
U user_table
Sq service_queue
D default_constraint
S system_table
P SQL _stored_procedure
PK primary_key_constraint
V View
It internal_table
X extended_stored_procedure
Tr SQL _trigger
PC clr_stored_procedure
TF SQL _table_valued_function

Return to SYS. all_ SQL _modules. How can I write a function definition:

Select definition fromsys. all_ SQL _modules Sm

Inner join SYS. all_objects AO onsm. object_id = ao. object_id

Where name ='Functionname'And type ='FN'

If you want to describe the Definition Statement of the table, you do not need to write the Definition Statement of the view.

The preceding statements have been tested in SQL 2005 and 2008.

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.