I have created a table from a text file delimited by comma's. The date within the text file is YYYYMMDD and needs to be stored within a smalldatetime column. Unfortunatley whenever I import the data it errors out. If I import the data into a nvarchar column, it imports correctly and then allows me to change the datatype to smalldatetime(thus giving me the correct format). Is there a way I could run a command pre and post to the import?
ALTER TABLE PO MODIFY x_column nvarchar
IMPORT DATA
ALTER TABLE PO MODIFY x_column smalldatetime
hope this is clear enough, thanks for the helpalter table tblname alter column colname smalldatetime
You would be safer importing to a staging table then inserting from there.|||thanks for the quick response, worked like a charm
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment