+ Reply to Thread
Results 1 to 3 of 3

How to create insert statements?

  1. #1
    Registered User
    Join Date
    08-31-2005
    Posts
    2

    How to create insert statements?

    Hi,

    I'm a bit of a newbie to excel and was wondering if anyone can help me create an insert script for my database?

    At the moment on my worksheet I have the following:

    Please Login or Register  to view this content.
    I am looking to create this:

    insert into category_lookup (productid, category) values (1, 'remote control');
    insert into category_lookup (productid, category) values (2, 'remote control');
    insert into category_lookup (productid, category) values (2, 'spy');
    insert into category_lookup (productid, category) values (3, 'fitness');

    and so on......

    Basically a 1 in any of my categories means an insert statement is needed.

    Does anyone know the simple vba to do this or a formula??

    Hope you can help

    Thanks

    Chris

  2. #2
    FSt1
    Guest

    RE: How to create insert statements?

    hi,
    you left out something. where are you getting the data to insert?

    Regards
    FSt1

    "mooreeasyvibe" wrote:

    >
    > Hi,
    >
    > I'm a bit of a newbie to excel and was wondering if anyone can help me
    > create an insert script for my database?
    >
    > At the moment on my worksheet I have the following:
    >
    >
    > Code:
    > --------------------
    >
    >
    > productname productid remote control spy fitness other
    > testa 1 1
    > testb 2 1 1
    > testc 3 1
    >
    >
    >
    > --------------------
    >
    >
    > I am looking to create this:
    >
    > insert into category_lookup (productid, category) values (1, 'remote
    > control');
    > insert into category_lookup (productid, category) values (2, 'remote
    > control');
    > insert into category_lookup (productid, category) values (2, 'spy');
    > insert into category_lookup (productid, category) values (3,
    > 'fitness');
    >
    > and so on......
    >
    > Basically a 1 in any of my categories means an insert statement is
    > needed.
    >
    > Does anyone know the simple vba to do this or a formula??
    >
    > Hope you can help
    >
    > Thanks
    >
    > Chris
    >
    >
    > --
    > mooreeasyvibe
    > ------------------------------------------------------------------------
    > mooreeasyvibe's Profile: http://www.excelforum.com/member.php...o&userid=26818
    > View this thread: http://www.excelforum.com/showthread...hreadid=400728
    >
    >


  3. #3
    Registered User
    Join Date
    08-31-2005
    Posts
    2

    on a worksheet

    All of the data will just be on an excel worksheet.

    All I want to do is loop over each row in the sheet and write the insert statements to an external file.

    Thanks for your help

    Chris

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1