question

HRugbeer avatar image
HRugbeer asked

How to bring a filename back when importing a file into SQL 2008 r2

I am Importing an excel file into SQL using the importfile Wizard. I would like to bring back the filename into the table as a field named [FileName] how do I do this
tsql
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Pavel Pawlowski avatar image
Pavel Pawlowski answered
The Import Wizzard creates a SSIS package which you can save. You can open this package in BIDS and add whatever column you want and provide a value for it using eg. Derived Column Transformation. If this is a one time operation, you can also update the rows after the load.
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.