Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Wildcard in Query?

Author  Topic 

bobshishka
Yak Posting Veteran

72 Posts

Posted - 2007-12-06 : 18:37:04
I screwed up my database and double added data to a text field.

For example I need made this:

'http://192.168.200.1/images/' +PATH+ '.jpg'

Look like this:

'http://192.168.200.1/images/http://192.168.200.1/images/12345.jpg'

How can I query to reset this?

update perimage
set PERIMAGE_PATH = 'http://192.168.200.1/images/' +PATH+ '.jpg'
WHERE PERIMAGE_PATH <> 'http://192.168.200.1/images/' +PATH+ '.jpg'

That just makes the problem worse

bobshishka
Yak Posting Veteran

72 Posts

Posted - 2007-12-06 : 18:44:39
Or how can I just delete all the data from the 'IMAGE_PATH' column in the IMAGE table?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-12-06 : 18:58:27
Does PATH contain http://192.168.200.1/images/? If so, you can use this SET statement:

SET PERIMAGE_PATH = PATH + '.jpg'
WHERE ...

quote:

Or how can I just delete all the data from the 'IMAGE_PATH' column in the IMAGE table?



UPATE IMAGE
SET IMAGE_PATH = ''

or

UPDATE IMAGE
SET IMAGE_PATH = NULL

just depends on what you mean by delete.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

bobshishka
Yak Posting Veteran

72 Posts

Posted - 2007-12-06 : 19:05:20
I figured out my problem. Thanks
Go to Top of Page
   

- Advertisement -