Skip to content

Reading SQL Server’s IMAGE Data Type

June 16, 2009

For the “something I always forget and have to search for” bucket: if you have an IMAGE data type in a table, and you want a quick-n-nasty way to read the contents, AND if it’s not more than 8000 characters:

select cast(cast(fieldName as varbinary(8000)) as varchar(8000))
FROM tablename

Told you it was quick, and told you it was nasty ;-)

Advertisement

From → sql server

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.