开发者

SQLiteException: near "If": syntax error

I am converting a 'SQL Server 2008' stored procedure to 'SQLite'. But facing problem with the following query:

If (Select Count(UserId) From 开发者_如何学GoUsers Where RememberMe = 'True') > 1
Update Users Set RememberMe = 'False'
Select UserName From Users Where RememberMe = 'True'

While executing the above query in the 'SQLite Administrator' or 'SQLite Expert', I am getting the following error message:

Error occured: near "If": syntax error

I am a beginner in SQLite. Please guide me.

Thanks & Regards,


Sqlite does not support if. You can use CASE instead of it.


SQLite doesn't support stored procedures.

But it looks like your code only updates the Users table to set RememberMe = 'False' for users that had it set to 'True'. If this is the case, then you don't need to do the If part at all. This should suffice:

UPDATE Users SET RememberMe = 'False' WHERE RememberMe = 'True';

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜