+ Reply to Thread
Results 1 to 5 of 5

check this sql syntax?

  1. #1
    Registered User
    Join Date
    08-10-2008
    Location
    China
    Posts
    24

    check this sql syntax?

    Hi everyone,

    Recently, I'm merge some excel table into one table by using ADO.NET, But was blocked by some sql sytax, Could you please help me table a look at following sql? Your help will be very appreciated!

    I want to join Two tables (A, and B), the condition should be the number of A. columnA1 equal B.ColumnB1.

    The data sample should be like below.

    A.ColumnA1: "3052835 a is apple,"
    B.ColumnB1: "3052835"

    My intial thought should use Instr(A.ColumnA1, B.ColumnB1) >0. But seems that the condition should pass when B.ColumnB1 is 5 which is a part number of the A.ColumnA1(please refer to the sample above), I hope I can split the column of A.ColumnA1 with the space, and then I can compare A.ColumnA1 and B.ColumnB1. Who can tell me how to do it? Thanks a lot^-^

    BTW, If the A.ColumnA1 include the string like "167/3052835 a is apple,", how to get the string of "3052835", I mean, How to get the string which between the "/" and space?

    Thanks
    Winnie
    Last edited by winniewang11; 08-16-2008 at 05:27 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,

    I don't understand the first part of your question, but one answer to the second one about the string is:

    Please Login or Register  to view this content.
    Rgds

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    If the A.ColumnA1 include the string like "167/3052835 a is apple,", how to get the string of "3052835", I mean, How to get the string which between the "/" and space?
    If the space always occurs after the number, then
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-10-2008
    Location
    China
    Posts
    24
    Thanks a lot.
    It works for me!

    Thanks
    Winnie

  5. #5
    Registered User
    Join Date
    08-10-2008
    Location
    China
    Posts
    24
    BTW, how to write sql for droping a sheet in Excel? (I want to do some operation on excel via ADO.Net, so i have to send some sql queries via ADO.Net)

    I can use following sql to drop a sheet:
    "drop table sheetname" it should works well

    But it throw exception code hr=0x80040e14 when I want to add the condition of "if exists "

    "drop table if exists sheetname" it throw exception

    I think there should be something wrong with my second sql. right?


    Thanks
    Winniw
    Last edited by winniewang11; 08-18-2008 at 05:48 AM.

+ 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