Insert an image in SQL Server 2000 without a frontend?
I want to insert a .jpg image into SQL server using simple INSERT query.
I tried the following query in which was posted as an answer to the following question Insert Picture into SQL Server 2005 Image Field using only SQL
In my case I modified the query as follows
INSERT INTO iffcar
(name, address, idno, barcode, Photo)
SELECT 'ishan', 'hohn', 100, 'barcodedmessage', BulkColumn
FROM OPENROWSET(BULK 'c:\use.jpg', Single_Blob) AS iffcarPicture
now I am getting the error as
My table structure i开发者_JAVA技巧s as follows
Please help me to resolve the error.
From this MSSQL tip:
The BULK option was added to T-SQL in SQL Server 2005 and it persists in SQL Server 2008. When using SQL Server 2000 it was possible to read and write to the file system using the sp_OA_Create and sp_OA_Method extended stored procedures.
When i run this on my local server defining the photo as Varbinary(max) it works, when i define it as Varbinary(500) it get an Error, did you define it in your Create statement as Varbinary(500)? try using the same definition form the question you linked, and add the Columns you need in addition.
精彩评论