0

I have an Image column in a table. The column contains a big image, about 300KB in size. I'm trying to find a way in a SQL command to make a small copy of this image. I would like to make a 15KB copy of it into field2.

I looked all over, and the only option I see is with some .Net code in SSIS.

Is there a way to do it directly in the DB without SSIS? Maybe just a SQL command?

Thanks.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Itay.B
  • 3,991
  • 14
  • 61
  • 96
  • Do you want to shrink the image? Or just take the first 15KB of those bytes? I highly doubt you will find a way to do the first option in a DB engine; you would have to do it outside, in your application. – Andrew Jan 05 '15 at 12:41
  • @Andrew, I would like to shrink all the image. – Itay.B Jan 05 '15 at 12:44
  • 4
    There is no native T-SQL command to transform an image to a smaller size. If it is important to do the task in T-SQL, you might be able to encapsulate the .NET code in a SQLCLR object instead of executing via SSIS. – Dan Guzman Jan 05 '15 at 12:47
  • 1
    `image` data type will be removed in a future version of SQL Server. Avoid using this data type in new development work, and plan to modify applications that currently use it. Use `varbinary(max)` instead. [See details here](http://msdn.microsoft.com/en-us/library/ms187993.aspx) – marc_s Jan 05 '15 at 14:01

0 Answers0