Delete SQL table Contents with a batch file
Posted on 2007-10-19
I am a novice at SQL and I was wondering is it possible to delete the entire contents of an SQL table using a batch file? Basically I have some software with exports an excel spread sheet automatically into our SQL database at set times. However it uses VARCHAR for all of the formats within the table. This creates a problem if i then import this information into excel. If I change the formats to what i want e.g. datetime, numeric etc, the next time i update the table they are all changed back to VARCHAR. This is beacuse the table is being over written each time. There is an option to merge the data into the table and this option preserves the correct formatting. However, it also adds the same data again and again. My idea is to run the software at a scheduled time say 8am and copy new information into the database, then at 9am run a batch file or something which would delete the existing data. At 10am I would you the merge option and put the data into the database.
Hope this make sense!