|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, November 27, 2012 12:00 AM
Points: 23,
Visits: 210
|
|
I have a database with different tables. one of these tables has an image column more than 50, 000 records. I have also 40,000 image files in a separate folder C:\ImageFolder with file names the same as primary Key values of the record in the table. Question: How can I insert these multiple image file from C:\ImageFolder to the corresponding record in the image column. E.g. Table Name SampleTable (Col_PK, Name,Picture) with sample data (four records)
Col_PK Name Picture 1001 XXX NULL 1002 YYY NULL 1003 ZZZ NULL 1004 ddd NULL C:\ImageFolder -- has the following three image files 1001.png, 1002.png , 1004.png Remark: Size of each file is less than or equal to 50KB and will be stored in the database as binary file How to import image file: 1001.png -> To Record with Col_pk=1001 1002.png -> To Record with Col_pk=1002 1004.png -> To Record with Col_pk=1004
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Yesterday @ 4:22 AM
Points: 141,
Visits: 558
|
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, November 27, 2012 12:00 AM
Points: 23,
Visits: 210
|
|
Thank you very much for your reply. Could you explain more about the SSIS solution possibilities?
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Yesterday @ 4:22 AM
Points: 141,
Visits: 558
|
|
You could possibly create a SSIS package to load the data/images into your table using foreach elements.
But this is really only worthwhile if this is going to be a recurring task (and possibly if the people who will be using the process prefer to use a graphical UI to apply changes to the script). It may also be useful for the point of view of metadata, logging etc as it is (for the most part) built into SSIS - i.e. it's relatively straightforward to add logging into a SSIS package, whilst the pure T-SQL approach would require you to built your logging mechanisms - the same applies to some extent to the error handling. Additionally, SSIS uses memory quite efficiently so that may be a benefit.
But if your ETL is mostly E and L (or just Load in your case), with very little T, and if you can write your SPs so they don't rely on cursors, then going the SP-only route will probably be fine.
HTH,
B
|
|
|
|