Query Analysis | scripts
--With the following script, you can get the script of the creation of any object, the Internet seems to be circulated, but the things that belong to their own use or feel comfortable.
--When you add a shortcut key, you can then display the object's script by pressing the shortcut key in the Query Analyzer.
SET QUOTED_IDENTIFIER ON
Go
SET ANSI_NULLS on
Go
ALTER procedure Sp_script
@objectname varchar (50)
As
DECLARE @databasename varchar (50)
Set @databasename = Db_name (db_id ())
DECLARE @str varchar (4000)
DECLARE @object int
DECLARE @objectdatabase int
DECLARE @hr int
DECLARE @src varchar (255), @desc varchar (255)
DECLARE @DataBaseCount int, @Current int, @DataBase int
declare @table int, @tables int
EXEC @hr = sp_OACreate ' SQLDMO. SQL Server ', @object out
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src out, @desc out
SELECT Hr=convert (varbinary (4), @hr), source= @src, description= @desc
Return
End
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.