Does SQLite support SCOPE_IDENTITY?

I'm trying to perform a simple INSERT and return the identity (auto-incrementing primary key). I've tried

cmd.CommandText = "INSERT INTO Prototype ( ParentID ) VALUES ( NULL ); SELECT SCOPE_IDENTITY();";

and I receive the following error

EnvironmentError: SQLite error
no such function: SCOPE_IDENTITY

Does SQLite support SCOPE_IDENTITY? If so, how do I use it? If not, what are my (preferably "thread-safe") alternatives?


Check out the FAQ. The sqlite3_last_insert_rowid() function will do it. Careful of triggers though.

If you're not using the C interface for programming and want to do the process from an SQL Command try: SELECT last_insert_rowid()

Need Your Help

Google Chrome eating borders (works fine on firefox)

css layout cross-browser

Please consider this snippet:

Issue with $(this).next()

php javascript jquery html ajax

For some reason only the save button is showing up on the edit click...not sure why I am having problems with the cancel button...? Below is my code

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.