Results 1 to 3 of 3

Thread: Require someone with hawk-like observational skills.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Manchester
    Posts
    266

    Require someone with hawk-like observational skills.

    This SQL query is throwing up an error. It is pretty obvious what I am trying to achieve. Any ideas? I'm quite new to conditional SQL queries.

    SQL Code:
    1. IF EXISTS (SELECT * FROM bank_data WHERE ContactID  = '95' AND BankID = 'Test_Bank') UPDATE bank_data SET Response = 'Green,Funny,Element,False,09/07/2011,13:00,Yellow,Fish-Monkey-Chimpers,Blue,' WHERE ContactID  = '95' AND BankID = 'Test_Bank' ELSE INSERT INTO bank_data (ContactID, BankID, Response) VALUES ('95','Test_Bank','Green,Funny,Element,False,09/07/2011,13:00,Yellow,Fish-Monkey-Chimpers,Blue,')

  2. #2
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    Re: Require someone with hawk-like observational skills.

    Syntactically it looks fine but you really haven't provided enough information for us to look at it further. Knowing what the error is, for example, might help a bit.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  3. #3
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Require someone with hawk-like observational skills.

    If you're using SQL Server 2008, there's a new Merge statement that you could take advantage of.
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

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