Create a stored procedure to upload data from 3 csv files one after other.
Name of the csv file(s) already saved in a table myFileList. myFileList Table contains values like crashData_MMYYYY_vN.csv, vehecleData_MMYYYY_vN.csv, casualtyData_MMYYYY_vN.csv etc with different versions and MMYYYY values. Example: For January month, MM should be 01. For October, it should be 10. For Base version value of ‘N’ should be 1 and can be incremental for the next versions, viz., v2, v3 etc. The first version of a crash file loading for Jan 2013 should be named ‘crashData_012013_v1’. Condition: 1. If crashData_012013_v2 is available no need to consider crashData_012013_v1 ( Same case for 'vehecleData_MMYYYY_vN.csv' and 'casualtyData_MMYYYY_vN.csv') 2. If any of the file(s) is missing no need to insert any data into the table. 3. i need to ensure that only the last 1 calendar month’s data is uploaded. Thanks in advance.
If you're just having problems with the [`IF`] clause... Try something like: IF Condition1 BEGIN EXEC Proc1 END ELSE BEGIN IF Condition2 BEGIN EXEC Proc2 END ELSE BEGIN EXEC Proc3 END END END Note that, because I've only put one statement in the THEN/ELSE parts, the BEGIN/END bits are unnecessary. I've left them in through force of habit - the number of times I've not written them and had something a bit odd happen... :