question

Branko avatar image
Branko asked

What is wrong in this code!

CREATE TABLE BLOBTest ( BLOBID int IDENTITY NOT NULL, BLOBData varbinary(max) NOT NULL ) GO INSERT INTO BLOBTest(BLOBData) SELECT * FROM OPENROWSET(BULK N'D:\DSN0022.jpg', SINGLE_BLOB);

sql-server-2008
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
malpashaa avatar image
malpashaa answered

The problem is that you did not specify an alias for the OPENROWSET. Use this insert instead of yours (just added alias):

            
INSERT INTO BLOBTest(BLOBData)            
   SELECT *            
     FROM OPENROWSET(BULK N'D:\Files\Entertainment\Pictures\1.JPG', SINGLE_BLOB) AS P;            
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.