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

Thread: Assign distributor to all products

  1. #1
    medsupply is offline Senior Member
    Join Date
    Jul 2011
    Posts
    99

    Default Assign distributor to all products

    We uploaded all products to the website but forgot to create and assign a distributor. We now created the distributor but how do we assign this distributor to all products?

    Can somebody help with a SQL query?

    Thanks!

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

    Default

    C#/VB.NET Code:
    INSERT INTO ProductDistributor (ProductIDDistributorID)
    SELECT ProductID, [INSERT DistributorID HERE WITHOUT SQUARE BRACKETSfrom dbo.Product

    (Insert obligatory comment about how you should test this before using on a live server - make half a dozen backups, test the backups & pay someone a fortune to verify the query & guarantee it will work)


    TTFN

    BFG

  3. #3
    medsupply is offline Senior Member
    Join Date
    Jul 2011
    Posts
    99

    Default

    So, if the Distirbutor ID number is 1, this should be the query:

    INSERT INTO ProductDistributor (ProductID, DistributorID)
    SELECT ProductID, 1 from dbo.Product;

    Is this correct?

    Thanks a lot!