Thank this author by sharing:
By Chris Morton, 2011/09/16
Hi i forgot to include this from my last post: How to insert and update from remote linked server Created: 8/7/2007 1:10:01 AM This script is part of that post but is also useful by itself. This script test for connectivity to a linked server... This code depends on: USE [DIMSCONSOLIDATEDData] GO /****** Object: UserDefinedFunction [dbo].[General_FXN_Alias] Script Date: 08/07/2007 08:44:13 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: -- Create date: -- Description: -- ============================================= CREATE FUNCTION [dbo].[General_FXN_Alias] ( @DistrictID int, @Table varchar(50) = 'sysobjects' ) RETURNS varchar(90) AS BEGIN -- Declare the return variable here -- Add the T-SQL statements to compute the return value here RETURN (SELECT Alias from General_District where districtID = @districtID) + '.' + @Table END and USE [DIMSCONSOLIDATEDData] GO /****** Object: Table [dbo].[General_Error_Log] Script Date: 08/07/2007 09:21:06 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[General_Error_Log]( [ErrorID] [bigint] IDENTITY(1,1) NOT NULL, [ErrorMessage] [varchar](255) NULL, [DateTime] [datetime] NOT NULL, [Alias] [varchar](50) NOT NULL, [Sproc] [varchar](50) NOT NULL, [ErrorCode] [int] NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF
This Script generates drop and create scripts for views or stored procedures.
I would like to create a SQL job that automatically runs the Generate Scripts process.
Dynamic Stored Proc to generate Create Table Script ,taking table_name as parameter
Generate Script File Name
Script to generate create, read, update, and delete scripts for a table.
As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.
Join us!
Steve Jones Editor, SQLServerCentral.com