Home > Archive > Microsoft SQL Server forum > April 2005 > importing a .txt file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author importing a .txt file
chudson007@hotmail.com

2005-04-28, 7:23 am

I have a .txt file that I need to add to an existing table, which is
made up of Varchar, Char, numeric and int fields.

What is the best way to do it.
The first thing I tried was importing the .txt file, and then going
into the design and changing the field type, but I hit problems on the
Numeric fields.

Then I tried changing the field types from varchar to different types
at the transfom stage of importing, but that failed too.

Regards,
Ciar=E1n

Simon Hayes

2005-04-28, 7:23 am

I assume you're using DTS, but without knowing what "I hit problems"
means, it's hard to give a specific answer. One general approach is to
load the data into a staging table, which may have a different
structure or data types than the target table, then use TSQL to clean
up and transform the data before an INSERT into the target.

If this isn't helpful, you'll probably have to give some more details -
your MSSQL version, exactly how you're importing the data, what the
source data looks like, the DDL for the target table, the
problems/errors you got etc.

Simon

Simon Hayes

2005-04-28, 7:23 am

I assume you're using DTS, but without knowing what "I hit problems"
means, it's hard to give a specific answer. One general approach is to
load the data into a staging table, which may have a different
structure or data types than the target table, then use TSQL to clean
up and transform the data before an INSERT into the target.

If this isn't helpful, you'll probably have to give some more details -
your MSSQL version, exactly how you're importing the data, what the
source data looks like, the DDL for the target table, the
problems/errors you got etc.

Simon

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com