Friday, February 24, 2012

How to use a vriable in DTS Package

Hello,

I have set up a simple DTS Package to copy a table (backup) in my database. I have specified the name of the table, however I want the naming of the new table to be dynamic and use the current timestamp, but I am not sure if and how I can define a variable and use it in the package.

Any thoughts? Do you need any more info?

Thanks.

RodneyHere is my SQL for the new table creation. I want the following name to be dynamic "CON_D_EmployeeInfo_backup20040526" Maybe use "CON_D_EmployeeInfo_{CurrentDateTime}".

CREATE TABLE [ancosalesdm].[dbo].[CON_D_EmployeeInfo_backup20040526] (
[EmployeeID] varchar (15) NULL,
[EmployeeTitle] varchar (46) NULL,
[EmployeePosition] varchar (46) NULL,
[EmployeeCostCenter] varchar (4) NULL,
[EmployeeDivision] varchar (256) NOT NULL,
[EmployeeStatusFlag] varchar (3) NULL,
[curr_ind] varchar (1) NOT NULL,
[last_up_date] datetime NOT NULL,
[eff_start_date] datetime NOT NULL,
[eff_end_date] datetime NULL,
[key] int NOT NULL
)

No comments:

Post a Comment