Need to script a table into a Select statement with datatype

Documents SQL Server 2005 and 2008 databases.

Moderators: JonathanWatts, David Atkinson, Michelle Taylor

Need to script a table into a Select statement with datatype

Postby paputzback » Fri Aug 02, 2013 4:06 pm

I was given a stored procedure to turn into an SSIS package and the proc has temp tables. From what I have found on the web I need to script out a an empty select statement from the final query in the proc and put it in the top of the procedure in able to get SSIS to pull in column information in the OLE DB Source editor. Here is the example that I am going off of:
IF 1 = 2
BEGIN
SELECT CAST(NULL AS INT) AS ContactID,CAST(NULL AS NVARCHAR(50)) AS FirstName,
CAST(NULL AS NVARCHAR(50)) AS MiddleName, CAST(NULL AS NVARCHAR(50)) AS LastName,
CAST(NULL AS NVARCHAR(10)) AS Suffix, CAST(NULL AS NVARCHAR(50)) AS EmailAddress
END
I believe I have the SQL Developer bundle. Perhaps there is a tool in it for this.
paputzback
 
Posts: 5
Joined: Wed Jul 18, 2012 3:30 pm

Postby james.billings » Mon Aug 05, 2013 2:41 pm

Thanks for your post- I don't think any of our tools are likely to help you here unfortunately.

The only tool that helps you write SQL is SQL Prompt, but it doesn't auto-generate code in the fashion you describe. Sorry.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Doc 2

Who is online

Users browsing this forum: No registered users and 0 guests