Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

how to insert image into a column Expand / Collapse
Author
Message
Posted Monday, July 2, 2007 9:47 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 12:55 PM
Points: 56, Visits: 183

Hi,

How can I insert an image into a table directly? I see this is usually done through application. but I just want to know if it is possible to directly do something like this-

insert into table1 (imgcol) values (somethingbuthow)

Your reply will be highly appreciated.

 

 

Post #378279
Posted Monday, July 2, 2007 9:54 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, July 14, 2014 3:32 PM
Points: 917, Visits: 412
SSMS does not ahve any way to do it. You could use SSIS or as you said, an app.

There was a little tool shipped with SQL 2000 which did it but I cannot for the life of me remember what it is called. Will look tonight on home machine.





Cheers,
Crispin


I can't die, there are too many people who still have to meet me!

It's not a bug, SQL just misunderstood me!
Post #378282
Posted Monday, July 2, 2007 10:00 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 12:55 PM
Points: 56, Visits: 183
Thank you, I will try SSIS...
Post #378287
Posted Monday, July 2, 2007 6:06 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, October 18, 2013 4:06 PM
Points: 471, Visits: 589
I prefer to store files on the filesystem, and just the location of the file in sql server.

---------------------------------------
elsasoft.org
Post #378453
Posted Tuesday, July 3, 2007 4:48 PM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Tuesday, February 5, 2013 4:24 AM
Points: 685, Visits: 104
CREATE TABLE myTable(Document varbinary(max))
GO
INSERT INTO myTable(Document)    
SELECT * FROM
OPENROWSET(BULK N'C:\Image1.jpg', SINGLE_BLOB)
AS Document
GO



Everything you can imagine is real.

Post #378802
Posted Wednesday, July 4, 2007 8:26 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 28, 2014 11:02 AM
Points: 2,397, Visits: 3,419
Nice!


N 56°04'39.16"
E 12°55'05.25"
Post #378981
Posted Thursday, July 5, 2007 11:25 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 12:55 PM
Points: 56, Visits: 183
thank you so much Bledu!
Post #379320
Posted Thursday, July 5, 2007 12:10 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, July 14, 2014 3:32 PM
Points: 917, Visits: 412
and there you go... Have to love the simple alternatives.




Cheers,
Crispin


I can't die, there are too many people who still have to meet me!

It's not a bug, SQL just misunderstood me!
Post #379331
Posted Friday, July 27, 2007 3:09 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, September 16, 2009 12:03 PM
Points: 43, Visits: 71

Simalar issue:

Having unloaded a table (containing column "Contents long binary") from a Sybase SQLAny db, I am now trying to bulk insert the data into a SS2K5 db table with the same schema ("Contents" data type is now "varbinary(max)").

Here's the SQL:

BULK INSERT DocumentBinaries from 'C:\TW\KMCA\Scripts\SQL Server\Data\DocumentBinaries_Export.DAT' WITH ( KEEPIDENTITY , FIELDTERMINATOR = '\t' , ROWTERMINATOR ='', MAXERRORS = 100 ) ;

DocumentBinaries is the only table with an Image/varbinary column in a group of over 300 being migrated, and the only tbale I can get the above statement to work for.

The following errors result:

Msg 4864, Level 16, State 3, Line 1

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 2 (contents).

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7330, Level 16, State 2, Line 1

Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".



Takauma
Post #386026
Posted Tuesday, July 15, 2008 1:09 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, January 29, 2014 7:30 AM
Points: 19, Visits: 135
Just in case....the SQL 2000 utility was TextCopy.exe

I am trying to insert a wav file as an image which I could do with TextCopy.exe and a stored proc in 2000 but I haven't found a way in 2005 yet.
Post #534699
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse