sql2005: cannot insert value into varbinary field - do not have permission

Discussion in 'Databases' started by smh, Oct 3, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. smh

    smh

    Hello and Help.

    I get an error: "You do not have permission to use the bulk load statement"

    I have a stored procedure that I am running to insert a pdf or word document into a varbinary(MAX) field in sql 2005. I am attempting to insert this into the discountasp database locally having connected to it.


    I have NO problem using this stored procedure with my own developer database. So the problem is NOT the code. The pdf file is in a local folder also.

    How can I insert this pdf or doc file into the field? How do I get permission to do this?

    Here is the relevant part of the stored proc:

    SET @QUERY = "INSERT INTO tblDocTable( Document)



    SELECT * FROM OPENROWSET( BULK '" +@fPath+"' ,SINGLE_BLOB) AS Document"


    EXEC (@QUERY)


    So I might be passing the following argument for this file: 'd:\myfile.pdf'. The sp will insert the file itself into the field. I already have files in the fields but they were there when I created the discount asp database. Now i need to add some more records with other files to the table.


    Thanks for any insight.


    smh
     
  2. JorgeR

    JorgeR DiscountASP.NET Staff

    smhaig
    DASP does not allow OPENROWSET and OPENDATASOURCE, the ad hoc method of connecting and accessing remote data using OLEDB.


    junior

    DiscountASP.NET

    www.DiscountASP.NET
     
  3. smh

    smh

    So I understand that I need to use bcp.exe utility. But how can I use this in a stored procedure. I understand this is a dos command line utility.

    I did so far do this the following way.
    I used my bulk insert on my local machine into a table. Then I used the exportdata sql server utility to export the table to dis asp database. Then I inserted the rows in that table into the main table.

    However the one step by hand is the export step. Can I program this or can I program something like this with the bcp utility? if so then the user could do all this themselves

    Thanks
     
  4. JorgeR

    JorgeR DiscountASP.NET Staff

  5. smh

    smh

    Thank you. I will look at that possibility and then get back to the forum if I have a problem.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page