How to load an Object(Image, Document,... Etc.,) into SQL Server Table?

 Posted by Pandians on 6/4/2012 | Category: Sql Server Interview questions | Views: 1929 | Points: 40
Answer:

We can use OPENROWSET statement to load an Object into a Table.

VARBINARY data type is the recommended one to hold an Object
Create Table LoadImage

(
ImageContent VARBINARY(MAX)
)
Go
Loading Image into a Table
INSERT LoadImage

SELECT * FROM OPENROWSET(BULK N'D:\Pandian.s\Photo.JPG', SINGLE_BLOB) AS [Image]
Go


Asked In: Architect Interview | Alert Moderator 

Comments or Responses

Login to post response