Using SSIS, Inserting File Names Into Sql-Server After Writing C# ScriptTask to Get File Names -


i have directory of excel files includes date in file name; represent reports. have imported data sequel server excel files need attach date file name each of records imported sql-server.

example dir list.

a_201008.xls a_201009.xls a_201010.xls ... ... ... 

the following c# scripttask fill array of file names:

using system; using system.data; using microsoft.sqlserver.dts.runtime; using system.windows.forms; using system.io  public void main()         {             // todo: add code here             string[] files = directory.getfiles(@"\\s\apps\files\", "a*.xls*", searchoption.alldirectories);              int flag = 0;             string dir = @"\\s\apps\files\";             string[] files1;             int numfiles;             files1 = directory.getfiles(dir);             numfiles = files.length;               (int = 0; < numfiles; i++)             {                 string file = files[i].tostring();                  int file1 = file.indexof(dir, stringcomparison.currentcultureignorecase);                  if (file1 != -1)                 {                     messagebox.show(file);                      flag = 1;                 }             }              if (flag == 0)             {                 messagebox.show("no matches found");             }                dts.taskresult = (int)scriptresults.success;         } 

the msgboxes testing script , removed.

my question this. protocol in ssis grab file names array insert them in relevant rows of table in sql-server?

please note know trim file names date.

thanks


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -