Results 1 to 5 of 5

Thread: Error in Sql Statement

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Error in Sql Statement

    Hi

    sql = "insert into [#m_temp] (cust_id,invoice_no,invoice_date,padi_no,wo_no,po_no,itype,uom,amount,icode,idesc,make,model,capacit y) select t0.cust_id,t0.invoice_no,t0.invoice_dt,t0.padi_no,'','','',t1.uom,t1.amount,t1.icode,t2.idesc,t2.mak e,t2.model,t2.capacity from salesinvoice t0 inner join padi_det t1 on t0.padi_no = t1.padi_no inner join itemmaster t2 on t1.icode = t2.icode"

    cnn1.Execute sql

    Thanks

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Error in Sql Statement

    1. 'capacit y' is syntatically incorrect
    2. ,","," is also syntactically incorrect

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Re: Error in Sql Statement

    Hi

    Actually it's giving me error when i write second inner join statement i.e inner join itemmaster t2 on t1.icode = t2.icode

    Thanks

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: Error in Sql Statement

    1) this is a database issue, should be in the database area - I've asked the mods to move it.
    2)As far as I can tell, the space in "capacit y" could be an issue.... the '','','', is actually syntatically correct, provided they are single quote marks in succession indicating an empty string.
    3)Perhaps it would be beneficial to the rest of us trying to help you if you were to post the error message you're getting. Otherwise we're left to guess at the problem, and can only assume that either your fingers fell off, or the wheels on your car fell off. In any event, all I can offer is for you to remove the eels from your hovercraft.

    -tg


    edit - one more thing... you may want to pull that select portion and run it by itself in SSMS/QueryAnalyzer/QueryBuilder (since you didn't indicate WHAT database you're using, again, we're left ot guess) and make sure it runs... I see other spaces in the middle of words besides "capacit y" ....
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Error in Sql Statement

    Thread moved to the 'Database Development' forum - which is where you should always post SQL related questions (while SQL can be used in VB, it is certainly not specific to VB)

    Thanks for letting us know folks

Posting Permissions

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



Click Here to Expand Forum to Full Width