sql question

Ok i have a really big file like 2 Gb.. and i want to insert it into database.. but i want to send chunks of data.. like 10 Mb and my Database has a column Data type image is there a possible way to add to that column

i mean i put 10 Mb then add to those 10 Mb another 10 MB



Answer this question

sql question

  • Sergio Olveira

    So what exactly does prevent you from loading the 2GB files in chunks from your local storage and use the offset of the SqlParameter mentioned above to insert it into the table chunk by chunk

    Maybe a full example helps a little bit more...
    http://support.microsoft.com/default.aspx scid=kb;EN-US;317043


  • Jorge Lopez

    the thing he posted there is to extract from sql server in chunks but i dont know if its possible to insert in it

    How about you scroll down to: "Write chunks to a BLOB column"

    There is the sample of how to insert, too ....


  • FxCop

    i dont know even myself!!!

    the thing he posted there is to extract from sql server in chunks but i dont know if its possible to insert in it


  • gumblicious

    If you just would read the example especially the "Write chunks to a BLOB column"-part and modify it to your needs, your problems would be solved. Even in the example I linked to above the origin file is not loaded in full size, but in chunks of 32KB and putting a SQL code similar to the one used in the example in a sql procedure and executing that instead of executing the SQL statement directly is easy, too, ... so what prevents you from using a similar approach


  • joneal

    ok you are near.. but yet far..


    i want to upload like 2 Gb a file.. so i cant load it into memory and the make the sqlparameter and set the offset..

    is there a possible way to append data to the column


  • DC11

    3 things:


    1) i Dont have suffiecent RAM memory to load fille into memory
    2) i use a procedure
    3) if i try to insert like 600 MB it will hang up no exception and stay like that 20 min .. also blocks windows .. intensivly HDD work.. and after 20 min i finally get an exception


  • Jibu

    hi,

    Is your problem solved

    Thank you,
    Bhanu.



  • The Unknown P

    Try using the Offset property of the SqlParameter class:

    "The Offset property is used for client-side chunking of binary and string data. For example, in order to insert 10MB of text into a column on a server, a user might execute 10 parameterized inserts of 1MB chunks, shifting the value of Offset on each iteration by 1MB."

    http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlparameter.offset.aspx

    It sounds like what you are after.


  • sql question