Home All Groups Group Topic Archive Search About

Manually inserting to image column in Management Studio

Author
5 Sep 2006 12:20 PM
sthrudel
Is it possible to manually insert some data into image column in MSSQL
Management Studio?

I have defined a table that contains image column for inserting some
binary data. I don't have the logic for inserting that data into
database but I would already like to get some data from the database.

Author
5 Sep 2006 1:03 PM
Jens
No, you can´t do that in SQLMS. But inserting data is straight
forward:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=622943&SiteID=1

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---
Author
5 Sep 2006 9:42 PM
Erland Sommarskog
(sthru***@gmail.com) writes:
> Is it possible to manually insert some data into image column in MSSQL
> Management Studio?

First of all, the combination of "image" and Management Studio, triggers
my "don't do that!" knee-jerk reaction.

That is, on SQL 2005 there is a new data type, varbinary(MAX), which just
like image permits storage up to 2 GB. But in difference to image,
varbinary(MAX) works just like the regular varbinary data type, and you
don't have to deal with the many quirks of image.

Of course, you may using SSMS to connect to SQL 2000, or you have a
requirement to support SQL 2000. But if you target SQL 2005 only, there
is little reason to use image.

As for your question, the answer is "in theory, yes". You can simply
say:

    INSERT tbl (keycol, imagecol)
        VALUES (1, 0x1212ABCC...)

To insert meaningful data this way, you would first have to get a hex-string
representation of your data.



--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button