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

Thread: SQL Query Request - Edit XMLPackage for Every Product of Specific Manufacturer

  1. #1
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default SQL Query Request - Edit XMLPackage for Every Product of Specific Manufacturer

    I recently posted a request for help with an SQL query and I appreciate the help I received. I also need help with another query that would save me lots of time in a process I have been doing manually (usually taking 30 minutes to an hour to complete). An SQL query would be very efficient if possible.

    I need to change the "Display Format XmlPackage:" of every product tied to a specific manufacturer only. If this is possible, what would the SQL query look like?

  2. #2
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    This should do the trick:

    Initial query check:
    Code:
    select m.[Name], p.XmlPackage, p.*
    -- update p set p.XmlPackage = 'someXmlPackage.xml.config'
    from Product p
    inner join ProductManufacturer pm on pm.ProductId = p.ProductId
    inner join Manufacturer m on m.ManufacturerId = pm.ManufacturerId
    where m.[Name] = '{whichever manufacturer}'
    You would then run the update statement to reflect the changes.
    Code:
    update p set p.XmlPackage = 'someXmlPackage.xml.config'
    from Product p
    inner join ProductManufacturer pm on pm.ProductId = p.ProductId
    inner join Manufacturer m on m.ManufacturerId = pm.ManufacturerId
    where m.[Name] = '{whichever manufacturer}'

  3. #3
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default

    Thank you for the help. I have a few questions still. Do I run those queries separately, but sequentially? Do I edit the 'someXmlPackage.xml.config' and the '{whichever manufacturer}' in both queries or just the second?

  4. #4
    guptaat is offline Member
    Join Date
    Feb 2007
    Posts
    51

    Default Qry

    First query is for you to see which records/products will get updated when you run the update statement.

    Usually its a good idea to run a select statement with exactly same conditions as in update statemnt to see what you gonna be updating.

    You can run second statement directly, if you wish.

  5. #5
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default

    Thank you for your help with this!

    I assume a query to change the products/variants of a specific manufacturer to be "free shipping" would be somewhat similar?

  6. #6
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default

    I cannot get this SQL query to work correctly. I have entered my XMLPackage and Manufacturer name in the areas noted, yet the changes do not go through at all.

  7. #7
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Exclamation

    Can someone please post the SQL Query required in order to set all products/variants of only a certain manufacturer to "FreeShipping"? Also, to remove "FreeShipping"?

  8. #8
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default

    Free Shipping Update per Manufacturer SQL Query

    C#/VB.NET Code:
    update pv set pv.FreeShipping '1'
    from ProductVariant pv
    inner join Product p on pv
    .ProductID p.ProductId
    inner join ProductManufacturer pm on pm
    .ProductId p.ProductId
    inner join Manufacturer m on m
    .ManufacturerId pm.ManufacturerId
    where m
    .[Name] = 'MANUFACTURERNAME' 
    Replace MANUFACTURERNAME with the actual manufacturer name.
    pv.FreeShipping = '1' will enable Free Shipping
    pv.FreeShipping = '0' will disable Free Shipping