Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Adding a user defined date

Author  Topic 

tarheel12325
Starting Member

2 Posts

Posted - 2009-09-30 : 15:04:09
Hi,

I am relatively new to SQL 2005 so I will try to make this as clear as possible.

I am using Visual Studio to creat an SSIS package that brings the data/tables from one database to another database, into staging tables. This I am able to do just fine, I am however stuck at trying to create an additional column in each of the tables that I am bringing over. This new column is populated with a specific date that is derived using a GETDATE expression.

I tried using an "Execute SQL task" using
ALTER TABLE Table_Name ADD Date datetime,
which works fine but of course does not fill in column and just gives you the header name.

I attempted using a variable but I am new to that as well and have not been to successful.

Any help would be appreciated.

Thanks!

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-09-30 : 15:20:14
Add a default of getdate()

ALTER TABLE Table_Name ADD [Date] datetime NOT NULL DEFAULT (getdate())
Go to Top of Page

tarheel12325
Starting Member

2 Posts

Posted - 2009-09-30 : 15:38:31
Still getting NULL values instead of the column populating data with the expression I am trying to use:

GETDATE() - DATEPART(dd, GETDATE())
Go to Top of Page
   

- Advertisement -