Q
Problem solve Get help with specific problems with your technologies, process and projects.

Storing an image file in SQL Server

Development expert explains the simplest way to store an image in SQL Server.

How do I store an image file in SQL? I'm trying to write a stored procedure that will automatically get a text file from a directory, and insert into a SQL table at a specific time of day. Can this be done?
Yes, you can store image files in SQL Server. In fact, SQL Server has a datatype called image for exactly this purpose. It will store any binary data up to 2 GB in size.

There are many ways to get image files into your image column. Among the easiest is the Textcopy utility located in the Program FilesMicrosoft SQL ServerMSSQLBinn directory. Use the command "textcopy /?" to get the command line syntax for this utility.

Another way to get image files in and out of SQL Server is to write your own program using ADO or ADO.Net, or create an ActiveX dll that can be called by SQL Server's sp_OA* extended stored procedures.

 


Do you have comments on this Ask the Expert Q&A? Let us know.

Dig Deeper on Microsoft SQL Server Installation

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close