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

Thread: Need Help with simple SQL script to Add MPN's to my Database for Feed

  1. #1
    sidener is offline Junior Member
    Join Date
    Nov 2011
    Posts
    4

    Question Need Help with simple SQL script to Add MPN's to my Database for Feed

    Hi, I am hoping someone can help me. I don't know much about SQL, but I need to get a whole bunch of MPN's imported into my database to make Google Feed Happy. I have about 4500 products and variants that all need a MPN. I created all of my products over the years and never used teh MPN (Manufacturers part number) field. Now I need that field for the feed mapping.

    Here is my problem. I have a xls spreadsheet with 3 columns: ProductID, VariantID, and MPN. I need a simple way to upload these MPN's into my database without screwing up anything else.

    I think this should be a very simple SQL script and I am hoping someone else has had to do something similar.

    Thanks!

    Scott

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

    Default

    OK, assuming that you don't have multivariant products & that you have something that looks like this :-




    Enter the following code (exactly) into cell D2 :-

    C#/VB.NET Code:
    ="UPDATE Product SET ManufacturerPartNumber = '"&C2&"' WHERE ProductID = "&A2&";" 
    & the following into E2 :-

    C#/VB.NET Code:
    ="UPDATE ProductVariant SET ManufacturerPartNumber = '"&C2&"' WHERE VariantID = "&B2&";" 
    Then drag the formulas down & Bob's your Uncle.



    TTFN

    BFG

  3. #3
    sidener is offline Junior Member
    Join Date
    Nov 2011
    Posts
    4

    Thumbs up Thanks so much! one more quick question

    Hi, Thanks so much, I think this is exactly what I need.

    My next question is this: After I have created columns D & E. What do I do with the resulting excel file to actually perform the import?

    I have used the Product import from excel before, but that uses a big template excel file with lots of other data in it.

    Thanks again!

    Scott

  4. #4
    sidener is offline Junior Member
    Join Date
    Nov 2011
    Posts
    4

    Default Ah, maybe this is how I should use the resultant file.

    Is this the way to do it? I take Column D and copy it as text into a file and then run that as a SQL script on the database? Then copy Column E into a text file and do the same thing?

    Scott

  5. #5
    sidener is offline Junior Member
    Join Date
    Nov 2011
    Posts
    4

    Thumbs up That worked like a charm!! Thanks!!

    That worked like a charm!! Thanks!! Or, more like: That was the bee's knees.

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

    Default

    No Worries - glad you got it done.



    TTFN

    BFG