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
 General SQL Server Forums
 New to SQL Server Programming
 IF SELECT statement problem

Author  Topic 

Fran71
Starting Member

3 Posts

Posted - 2011-02-28 : 10:12:08
Hi all ( first post =) ,

For some reason this statement produces this run-time error:

statement:
 IF(id != MAX(id)) BEGIN SELECT * FROM cardItems WHERE id = ?" + " END ELSE BEGIN SELECT MIN(id) FROM cardItems END";


error: Error #3115: SQL Error.', details:'near 'IF': syntax error', operation:'execute', detailID:'2003'

What is wrong with my IF statement? Or is there something else wrong?

Any help is greatly appreciated!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-28 : 10:18:01
Are you using SQL Server ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Fran71
Starting Member

3 Posts

Posted - 2011-02-28 : 10:31:33
SQLite. I'm sorry if I posted in the wrong forum..
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-28 : 10:40:32
This site is mainly on Microsoft SQL Server. Tried http://sqliteforum.com/ ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Fran71
Starting Member

3 Posts

Posted - 2011-02-28 : 10:41:58
Ok, thanks.
Go to Top of Page
   

- Advertisement -