Click here to Skip to main content
14,266,036 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a daily table that I append to a master table...the last two column are the date the append is being done and the table name that is being appended. I have the date part but is there a way of pulling the name of the table that I am appending from? i.e. I'm appending TrackedData11232013a into TrackedDataMaster how do I add TrackedData11232013a into TrackedDataMaster without having to type it in each time?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

There is no option to import data without specifying the file name of csv file.

You can write query like this:
INSERT INTO DestinationTable (Field1, Field2, ..., FieldN, FileName)
SELECT Field1, Field2, ..., FieldN, [CSVFileName] AS FileName
FROM SourceTable IN [CSVFileName];

which will prompt you (or any other user) for entering the name of file to import.
Note: it should be the full path and name of csv file!

For futher information about importing data from text file, please see: IN Command[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100