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'
;
精彩评论