How To Generate CREATE PROCEDURE Script on an Existing Stored Procedure?
Submitted by: AdministratorIf you want to know how an existing stored procedure was created, you can use SQL Server Management Studio to automatically generate a "CREATE PROCEDURE" script The following tutorial shows you how to do this:
1. Run SQL Server Management Studio and connect to SQL server.
2. On the Object Explorer window, follow the object tree: Databases > GlobalGuideLineDatabase > Programmability > Stored Procedures > dbo.ShowFaq.
3. Click right mouse button on dbo.ShowFaq. The context menu shows up.
4. Select "Script Stored Procedure as" > "CREATE to" > "New Query Editor Window". The following script will be displayed:
USE [GlobalGuideLineDatabase]
GO
/****** Object: StoredProcedure [dbo].[ShowFaq]
Script Date: 05/19/2007 21:31:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ShowFaq] AS BEGIN
PRINT 'Number of questions:';
SELECT COUNT(*) FROM Faq;
PRINT 'First 5 questions:'
SELECT TOP 5 * FROM Faq;
END;
CREATE TABLE Faq (Question VARCHAR(80));
Submitted by: Administrator
1. Run SQL Server Management Studio and connect to SQL server.
2. On the Object Explorer window, follow the object tree: Databases > GlobalGuideLineDatabase > Programmability > Stored Procedures > dbo.ShowFaq.
3. Click right mouse button on dbo.ShowFaq. The context menu shows up.
4. Select "Script Stored Procedure as" > "CREATE to" > "New Query Editor Window". The following script will be displayed:
USE [GlobalGuideLineDatabase]
GO
/****** Object: StoredProcedure [dbo].[ShowFaq]
Script Date: 05/19/2007 21:31:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ShowFaq] AS BEGIN
PRINT 'Number of questions:';
SELECT COUNT(*) FROM Faq;
PRINT 'First 5 questions:'
SELECT TOP 5 * FROM Faq;
END;
CREATE TABLE Faq (Question VARCHAR(80));
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
☺ | How To Configure ODBC DSN with Different Port Numbers? |
☺ | How To Use Subqueries with the EXISTS Operators in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Get the Definition of a View Out of the SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |