Click here to Skip to main content
13,144,309 members (35,747 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I created a history table to take a back of my table and Know I want to load this history table with table data.

Problem is for every new table I will dynamically create a History.Table. I can't use history table as my destination in SSIS. So I have to use stored procedure passing my @Filename= History.table name as variable.

But I am not able to do pass @Filename= History.table as variable
How to load data in Dynamically generated History.Table?
Posted 29-Sep-12 14:39pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I'm not sure what you want, but you can pass table name in this way:
    @dbname NVARCHAR(30)
    @tablename NVARCHAR(30)
SET @sql = 'SELECT * FROM [' @dbname + '].[dbo].[' + @tablename + ']'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 30 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100