Reply
SQL database Query help
Old 08-01-2006, 02:55 PM SQL database Query help
Novice Talker

Posts: 8
I have a table called airliners_prices inside that i have several fields (column titles) Year, Model, Configuration, avg_new_price, avg_used_price,avg_wholesale_price.

In the past i have been using the code below to lets say change a string located in the avg_new_price of "CAPS" to "Military" site wide and it's work flawlessly.
----------------------------------------------------------------------------------------

DECLARE @find varchar(255),
@replace varchar(255),
@patfind varchar(255)
SELECT @find = 'CAPS',
@replace = 'Military'

SELECT @patfind = '%' + @find + '%'
UPDATE [airliners_prices]
SET [avg_new_prices] = STUFF( [avg_new_prices],
PATINDEX( @patfind, [avg_new_prices] ),
DATALENGTH( @find ),
@replace )
WHERE [avg_new_prices] LIKE @patfind
-------------------------------------------------------------------------------------------
However i now have a new problem. What needs to happen is now i need to first determine if the column avg_new_price has a string equal to "Military" and if so then change its corresponding avg_used_price and avg_wholesale_price values to be "---" or "N/A".
Vertigo is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Reply     « Reply to SQL database Query help
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10497 seconds with 12 queries