Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

Issue deleting image from database

I have a table that stores incoming data from a device as an image type (it is actually binary data that is converted to hex). Some times the field device has a brain cramp and will store a page of zeros, which is still a valid data input, however I need to scrub it from my database. The data is stored in the data_in column in the following format:

0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

How do I select this for delete from the records of the database? Or is this possible??

Thanks

Brad
0
bradbritton
Asked:
bradbritton
1 Solution
 
nito8300Commented:
Can't you do DELETE FROM yourtable where data_in = '0x0000000...(etc)'
0
 
bradbrittonAuthor Commented:
i gave that a try, but no dice. It is because the data is an image...

Tks

Brad
0
 
Atlanta_MikeCommented:
What about like '%x00%'

Or something similar...
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
bradbrittonAuthor Commented:
No Dice, gives this error:

Msg 8116, Level 16, State 1, Line 1
Argument data type varchar is invalid for argument 2 of like function.

tks
Brad
0
 
David ToddSenior DBACommented:
Hi,

Images and text blobs do use different commands to read and write. I'm guessing that deleting is the same.

What version of SQL as this has changed with SQL 2005.

Look up
Managing ntext, text, and image Data
in BOL and other BLOB (Binary Large OBject) entries.

Regards
  David
0
 
bradbrittonAuthor Commented:
i will try that, by the way it is SQL 2005
0
 
bradbrittonAuthor Commented:
Changed to VBinary and works A++++

Thanks

Brad
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now