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

Thread: Update product mapping via SQL update

  1. #1
    donttryathome is offline Senior Member
    Join Date
    Apr 2009
    Posts
    171

    Default Update product mapping via SQL update

    I need to update all of our products to be mapped to two customer levels. Since we have thousands of products I prefer not to do this manually, and I'm thinking a SQL update would be the easiest way to do it.

    Can anyone offer me an example of what kind of SQL update to run to map ALL of my products to a customer level (or even better, both customer levels at the same time)?

    Thanks!

  2. #2
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Cool

    Code:
    insert dbo.ProductCustomerLevel (ProductID, CustomerLevelID)
    	select p.ProductID, 1 from dbo.Product p
    	
    insert dbo.ProductCustomerLevel (ProductID, CustomerLevelID)
    	select p.ProductID, 2 from dbo.Product p
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  3. #3
    donttryathome is offline Senior Member
    Join Date
    Apr 2009
    Posts
    171

    Default

    To avoid damaging my database...

    Should I change the "1" and "2" in that statement to the corresponding customer levels that I need the items mapped to? Currently the customers levels we need all products mapped to would be 4 and 5.

    I may not be understanding exactly how the statement works.

  4. #4
    donttryathome is offline Senior Member
    Join Date
    Apr 2009
    Posts
    171

    Default

    Bump for clarification please

  5. #5
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    Yep 1 and 2 represent the CustomerLevelIDs of the customer levels you need to map the products to. So in your case it would be
    Code:
    insert dbo.ProductCustomerLevel (ProductID, CustomerLevelID)
    	select p.ProductID, 4 from dbo.Product p
    	
    insert dbo.ProductCustomerLevel (ProductID, CustomerLevelID)
    	select p.ProductID, 5 from dbo.Product p
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  6. #6
    addymark is offline Junior Member
    Join Date
    Feb 2010
    Posts
    4

    Default

    Since the release of LINQ to SQL and the Entity Framework, many questions have been raised about the future plans for the technologies and how they will relate to each other long term.

    During this week of PDC we are now at a point, with the announcement of Visual Studio 10
    and the .NET Framework 4.0, that we can provide more clarity on our direction.

  7. #7
    Vortx is offline Junior Member
    Join Date
    Feb 2010
    Posts
    22

    Default LINQ and AspDotNetStorefront

    Here's an article we wrote that will likely help you out:

    Using LINQ as an Alternative to AspDotNetStorefront Data Access Layer


    Let us know if you have any questions or if there's anything we can help with.

    Thanks.