Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 5 of 5

Thread: SQL query to auto fill 'actual cost' info in Admin section for product variants

  1. #1
    Classic_Exotic is offline Member
    Join Date
    Dec 2009
    Location
    Troy, MI USA
    Posts
    82

    Default SQL query to auto fill 'actual cost' info in Admin section for product variants

    If this is possible, maybe someone knows how to accomplish this and/or write the SQL query:

    We have approx. 700 items on our website. In the variant section for all products (no variant for any product is the same), we would like to fill in the "actual cost" line with the same number that is in the "price" line.

    Is there a way to accomplish this with some type of SQL query? Maybe by another way?

    To type the information by hand for 700 + products will be very time consuming and we are looking for a shortcut.

    Any help is appreciated.

    Thank you.
    Classic & Exotic Service, Inc.
    Specialty Parts For Prewar Cars
    www.classicandexotic.com

  2. #2
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    The query looks like this :-

    C#/VB.NET Code:
    UPDATE ProductVariant SET Cost 12.34 WHERE VariantID 333;
    UPDATE ProductVariant SET Cost 25.29 WHERE VariantID 334
    You can create these easily in excel, then it's just a quick copy & paste job (you can do them all at one go).


    TTFN

    BFG

  3. #3
    Classic_Exotic is offline Member
    Join Date
    Dec 2009
    Location
    Troy, MI USA
    Posts
    82

    Default Can this be done with one command?

    Thank you. I was hoping to be able to accomplish this with one command that would automatically fill in the "actual cost" field of each variant with whatever info was in the "price" field.

    Is that something that can be done? One command?
    Classic & Exotic Service, Inc.
    Specialty Parts For Prewar Cars
    www.classicandexotic.com

  4. #4
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    Sorry - I misread...

    This will do it :-


    C#/VB.NET Code:
    UPDATE ProductVariant SET Cost Price

    TTFN

    BFG

  5. #5
    Classic_Exotic is offline Member
    Join Date
    Dec 2009
    Location
    Troy, MI USA
    Posts
    82

    Default

    Thank you! Worked perfectly! You just saved me hours of work...
    Classic & Exotic Service, Inc.
    Specialty Parts For Prewar Cars
    www.classicandexotic.com