SQL Server update statement

Posted on 2007-08-07
Last Modified: 2010-03-19
I need to update a part of a field with a value.

If a field has a value of ListID = xValue
and field.title = 'This is more stuff $4.125 Million U'

and  ListPrice gets updated from 4125000.00 to 3975000.00
I need the otehr field to be updated to

field.title = 'This is more stuff $3.975 Million U' where listid = xValue

Question by:lrbrister
    LVL 35

    Expert Comment

    by:David Todd

    Please post a create statement for your table.

    How are you updating things at present? Via a procedure or direct from code?


    Author Comment

    update tblListingInput
    set ListPrice=@price
    where ListID=@ListID

    I then need to replace that string in tblMarketing.adTitle where ListID = @ListID and mktID = @mktID

    Author Comment

    and Via a procedure
    LVL 42

    Accepted Solution

    Not sure what  you are asking.  Seems like you want to change the SQL, not update the table.

    Author Comment

    Let me try and clarify...

    One tabel stores a dollar figure that is used in many places.

    Another table stores an Advertising Title that is used specifically for a partivular issue(s)

    When the asking sale price is changed I'm going to updae this Advertisint Title for the listing.

    HOWEVER...everthin in that Ad Title can be edited after the first "build".  

    All I want to do is grab the string out of the middle that pertains to the dollar amopunt and update THAT with the new sales price.

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
    by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now