﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / how to insert image in sql server 2005 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 06:46:31 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>And don't forget as previously mentioned that the image datatype is deprecated. Instead use varbinary(max). It will behave the same way but is the newer preferred datatype for this.</description><pubDate>Mon, 12 Nov 2012 07:01:13 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>Sanjay openrowset does not allow variables...it must be a static string inside single quotes. Replace @image with 'c:/filename'You could build an openrowset as a string and use dynamic sql instead</description><pubDate>Sun, 11 Nov 2012 04:45:27 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>hi if i am using this query in a storeprocedure i am getting error. here is the sp and the errorUSE [TEMP]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[psp_TEMP] -- Add the parameters for the stored procedure here@MimeType varchar(50),@image image,@Hid int,@ImageName varchar(100),@ImageDesc varchar(100)ASBEGIN-- SET NOCOUNT ON added to prevent extra result sets from-- interfering with SELECT statements.SET NOCOUNT ON;-- Insert statements for procedure hereinsert into image(MimeType,image)select @MimeType,BulkColumn from Openrowset(Bulk @image , Single_Blob) as EmployeePicture--values--(--@MimeType,--@image--)declare @imageId intset @imageId = @@identityinsert into tables(HistoryID,ImageID,ImageName,ImageDescription)values(@Hid,@imageId,@ImageName,@ImageDesc)ENDi am getting the below given error : Msg 102, Level 15, State 1, Procedure csp_Images_History_Insert, Line 20Incorrect syntax near '@image'.</description><pubDate>Sat, 10 Nov 2012 05:35:45 GMT</pubDate><dc:creator>sanjay.dakolia</dc:creator></item><item><title>RE: how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>Lowell's solution is a good one. The Image datatype is deprecated thus the need for varbinary(max).</description><pubDate>Tue, 06 Nov 2012 12:02:26 GMT</pubDate><dc:creator>mmartin1</dc:creator></item><item><title>RE: how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>[quote][b]DiverKas (11/5/2012)[/b][hr][quote][b]sanjay.dakolia (11/5/2012)[/b][hr]hi,   i want to insert image into sql server using sql query. please help.thanks in advance sanjay[/quote]It is generally considered bad practice to store images in the SQL Server DB.  Its pretty inefficient.  You are better off storing the image in the file system and storing the path in the database.[/quote]You might also look into FILESTREAM.</description><pubDate>Mon, 05 Nov 2012 08:54:32 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>[quote][b]sanjay.dakolia (11/5/2012)[/b][hr]hi,   i want to insert image into sql server using sql query. please help.thanks in advance sanjay[/quote]It is generally considered bad practice to store images in the SQL Server DB.  Its pretty inefficient.  You are better off storing the image in the file system and storing the path in the database.</description><pubDate>Mon, 05 Nov 2012 08:30:49 GMT</pubDate><dc:creator>DiverKas</dc:creator></item><item><title>RE: how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>you would want to save the filename as well, don't forget....[quote][b]deepkt (11/5/2012)[/b][hr]Try this,CREATE TABLE Img(Id INT, Filename varchar(255), Obj VARBINARY(MAX))INSERT INTO Img (Id ,FileName,Obj)VALUES (1,'Blue Lace 16.bmp',(SELECT * FROM OPENROWSET(BULK 'c:\windows\Blue Lace 16.bmp', SINGLE_BLOB) Obj))DROP TABLE Img[/quote]</description><pubDate>Mon, 05 Nov 2012 06:52:07 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>Try this,CREATE TABLE Img(Id INT, Obj VARBINARY(MAX))INSERT INTO Img (Id ,Obj)VALUES (1,(SELECT * FROM OPENROWSET(BULK 'c:\windows\Blue Lace 16.bmp', SINGLE_BLOB) Obj))DROP TABLE Img</description><pubDate>Mon, 05 Nov 2012 06:46:25 GMT</pubDate><dc:creator>deepkt</dc:creator></item><item><title>RE: how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>Hi,you need to place your question in the SQL Server 2005 forum ([url]http://www.sqlservercentral.com/Forums/Forum338-1.aspx[/url] instead of the 2008 forum.B</description><pubDate>Mon, 05 Nov 2012 05:19:04 GMT</pubDate><dc:creator>bleroy</dc:creator></item><item><title>how to insert image in sql server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic1381001-391-1.aspx</link><description>hi,   i want to insert image into sql server using sql query. please help.thanks in advance sanjay</description><pubDate>Mon, 05 Nov 2012 05:08:48 GMT</pubDate><dc:creator>sanjay.dakolia</dc:creator></item></channel></rss>