Checks for the existence of the source text of the compiled object, and for the existence of computed column source text.
sp_checksource [objname [, tabname [, username]]]
is the compiled object to be checked for the existence of its source text.
is the name of the table or view to be checked for the existence of all check constraints, defaults, and triggers defined on it.
is the name of the user who owns the compiled objects to be checked for the existence of the source text.
Checks for the existence of the source text of all compiled objects in the current database:
sp_checksource
Checks for the existence of the source text of the view named titleview:
sp_checksource titleview
Checks for the existence of the source text of the view named titls_vu that is owned by Mary:
sp_checksource title_vu, @username = Mary
Checks for the existence of the source text of the custom stored procedure list_phone_proc:
sp_checksource list_phone_proc
Checks for the existence of the source text of all the check constraints, triggers, and declarative defaults defined on the table named my_tab:
sp_checksource @tabname = "my_tab"
Checks for the existence of the source text of the view my_vu and all check constraints, triggers, and defaults defined on the table my_tab:
sp_checksource @objname = "my_vu", @tabname = "my_tab"
Checks for the existence of the source text of all compiled objects owned by Tom:
sp_checksource @username = "Tom"
sp_checksource checks for the existence of the source text of the specified compiled object. If the source text exists for the specified object, sp_checksource returns 0. If the source text does not exist for the specified object, sp_checksource returns 1.
If you do not provide any parameters, sp_checksource checks the existence of the source text for all compiled objects in the current database.
To use sp_checksource with no parameters, you must be the Database Owner or System Administrator.
sp_checksource encrypts the text of user-defined functions.
Only a Database Owner or System Administrator can execute sp_checksource to check for the existence of the source text of compiled objects that are owned by another user. Any user can execute sp_checksource to check for the existence of the source text for his or her own compiled objects.
Values in event and extrainfo columns from the sysaudits table are:
Event |
Audit option |
Command or access audited |
Information in extrainfo |
---|---|---|---|
38 |
exec_procedure |
Execution of a procedure |
|
System procedures sp_hidetext