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
 General SQL Server Forums
 New to SQL Server Programming
 How to Import from flat file and update DateTime c

Author  Topic 

ctoledo
Starting Member

4 Posts

Posted - 2007-07-30 : 14:37:36
I have a a flat file that consists of 2 Columns of data that need to overwrite an existing Table that has 3 Columns of data. The Import fails because the 3rd column on the table is a Date stamp column with the Data Type of "smalldatetime" and does not allow Null data. If I were to delete this 3rd column from the table the import works great but I lose the DateTime column. How can I use the Import Wizard to import the first 2 columns from a text file and update the 3rd column with the date and time? The wizard does not seem to let me update a column unless the data for this column comes from the flat file. Please assist, thanx.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-30 : 14:41:04
add a default getdate() constraint to your 3rd column.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

ctoledo
Starting Member

4 Posts

Posted - 2007-07-30 : 15:31:38
Suuuu-eeet! That worked! Thanx a bunch man.
Go to Top of Page
   

- Advertisement -