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:
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,')
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.
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.