Replace/Update

OptimisticYid

Registered User.
Local time
Today, 15:12
Joined
Apr 8, 2008
Messages
17
Just a quick problem .... I hope. I'm using SQL Server Management Express to administer my SQL database. Basically I have about 1100 products, 400 of which have a postage price of £6.00 which I need to change to £4.95, but the SQL statement I have written below doesn't seem to work. Can anyone point out 'the error of my ways'.

Update LS2Products
Set ProductPostagePrice = replace(ProductPostagePrice, '6.0000', '4.9500')

Many thanks in advance.
 
Hi there

Replace is a string function and is used for replacing part of a text based column, so for example say we have a column called 'text1' which contains

"I like beer"

If you wanted to change to wine then you would use replace

Code:
Replace(text1,'beer','wine')

What you need is the following:

Code:
Update LS2Products
Set ProductPostagePrice = '4.9500'
Where ProductPostagePrice = '6.0000'
 
Why would I ever want to replace wine with beer :D If you know Al Murray you will know that it is wine and fruit based drinks 'for the ladies'.

Many thanks for your quick answer though, worked a treat ;)
 
lol, please accept my apologees I didn't mean to suggest that you will be undergoing a sex change ;) :D

But seriously no probs for the code, glad I was able to help :)
 

Users who are viewing this thread

Back
Top Bottom