All Downloads are FREE. Search and download functionalities are using the official Maven repository.

e.etl-unit.etlunit-sql-server-database.1.5.3.source-code.export_sql_columns.vm Maven / Gradle / Ivy

There is a newer version: 1.6.9
Show newest version
USE ${databaseName}
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'${procedureName}') AND type in (N'P', N'PC'))
	DROP PROCEDURE ${procedureName}
GO

CREATE PROCEDURE ${procedureName} AS
BEGIN
	SET NOCOUNT ON

	IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'${tempTableName}') AND type = N'U')
		DROP TABLE ${tempTableName}
	GO

	SELECT * INTO ${tempTableName} FROM
	(
		$sql
	) A

	SELECT c.name FROM SYS.tables t JOIN SYS.COLUMNS c ON t.object_id = c.object_id WHERE t.name = '${tempTableName}'

	DROP TABLE ${tempTableName}
END

GO






© 2015 - 2025 Weber Informatics LLC | Privacy Policy