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 2 of 2

Thread: SQL Query to import weights to variant ids?

  1. #1
    joecalardo is offline Member
    Join Date
    May 2011
    Posts
    61

    Default SQL Query to import weights to variant ids?

    Hello, I have made up a list of products that were missing weights, I have my spreadsheet as productid, variant id, and weight. Is there a query I can use to insert the weights into the products by obviously their variants ? And if so, what safety measures should I take into doing this ? I'm still new at using SQL so I don't want to ruin anything with my website ... Thanks

  2. #2
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    Assuming column A is productid, column B is variantid and column c is weight, then you need to use formulae to create a sql statement in column d of each row. Also, assuming the first row is headers then your data starts on the second row. So in column d your formula would be

    Code:
    ="UPDATE ProductVariant SET Weight=" & C2 & " WHERE VariantID=" & B2
    Weight must always be numeric allowing decimal places. Copy/drag it all down. Then copy and paste your SQL statements into SSMS and run.

    Run it in a dev environment first to see that you get what you expect.
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!