Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 IF EXISTS

Author  Topic 

glenharvy
Starting Member

5 Posts

Posted - 2007-05-28 : 09:03:40
Hi,

The following works in SQL 2005 but NOT SQL 2005 Compact Edition:

IF EXISTS (SELECT ID FROM Court2 WHERE BookingDate = '2007-05-28')
UPDATE Court2 SET T1100 = 52 WHERE (BookingDate = '2007-05-28')
ELSE
INSERT INTO Court2 (BookingDate,T1100) VALUES ('2007-05-28',52)

In CE I get the following error:

There was an error parsing the query. [ Token line number = 1,Token line offset = 1,Token in error = IF ]

I can't find where the problem is - can someone help.

Thanks,

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-28 : 09:10:57
Is this the first statement in the SP/Script or there are some statements before IF EXISTS() as well? If yes, then post them too.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-28 : 09:17:14
Is IF ... ELSE supported in SQL 2005 CE ?


KH

Go to Top of Page

glenharvy
Starting Member

5 Posts

Posted - 2007-05-28 : 09:20:08
There is nothing else - I'm actually running the statement in SQL Management Studio.
Go to Top of Page

glenharvy
Starting Member

5 Posts

Posted - 2007-05-28 : 09:49:02
quote:
Originally posted by khtan

Is IF ... ELSE supported in SQL 2005 CE ?


KH





Is IF ... ELSE called scripting?

If so then I don't think its supported
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-28 : 09:51:23
As far as i know it is not supported in SQL Server CE 2.0 so don't think it will be supported in 2005 Compact Edition also.


KH

Go to Top of Page
   

- Advertisement -