Friday, 25 July 2008

Dynamic Bulkinsert directory using server name

This command can be used to dynamically create the path for a file based on the current instance. It assumes each instance server has a directory called BulkInsert which we use to store the csv files we want to import.

   1:  select '\\' + substring(@@servername, 1, charindex('\', @@servername)) + 'BulkInsert\filename.csv'

No comments: