Click here to Skip to main content
15,920,031 members
Please Sign up or sign in to vote.
1.00/5 (1 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?
Posted

1 solution

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

You can write query like this:
SQL
PARAMETERS [CSVFileName] CHAR;
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[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900