Monday, March 12, 2012

help needed to bring in text files..

background: sql2k on nt5.
can someone give me some advice on how to bring in text files located on a
file server directory into a sql server database?
the text files will always have the same structure, but the file names are
not static (but following a naming standard, such as
location+date.txt, such as
or_05102004
wa_05122004
and so on.
so each file will be broung in as a table such as or_05102004, and
wa_05122004 table.
thank you.
Will you be loading all of the text files into one table, or does each =
type (or, wa, ...) have a different table that it should be loaded into? =
=20
Perhaps you could use BCP or BULK INSERT to import the text files. You =
can define a format file if you choose to use BCP. This format file =
will define the layout of the file and it will determine how it gets =
loaded into the destination table. You could create a stored procedure =
that would take a filename as a param and use a bit of dynamic sql to =
generate the appropriate BCP statement that uses the appropriate format =
file.
Another method would be DTS. You could create a DTS package to insert =
the data into SQL Server. This solution might be difficult to maintain =
if the file names change often. Then again, you could create a routine =
that imports from a standard file name. When you get a new file (on the =
network share) you could copy it to the specific location and file name =
that your DTS package knows about.
--=20
Keith
"=3D=3D Steve Pdx=3D=3D" <lins@.nospam.portptld.com> wrote in message =
news:uCHOz%23sNEHA.1196@.TK2MSFTNGP11.phx.gbl...
> background: sql2k on nt5.
>=20
> can someone give me some advice on how to bring in text files located =
on a
> file server directory into a sql server database?
> the text files will always have the same structure, but the file names =
are
> not static (but following a naming standard, such as
> location+date.txt, such as
> or_05102004
> wa_05122004
> and so on.
>=20
> so each file will be broung in as a table such as or_05102004, and
> wa_05122004 table.
>=20
> thank you.
>=20
>

No comments:

Post a Comment