简体   繁体   中英

Python: T-SQL EQuivalent for Sqlite3?

I have the following MS-SQL based query which I need to convert into Sqlite3 based database

DECLARE @status int, @nextPriority int
SELECT @status = status FROM status WHERE nameStatus = '234'

I then have to use that variable in an INSERT query.

One way I think is to execute query and bind variables but I am willing to execute all queries in a Go. Is it possible?

I am using Python 2.6

Thanks

sqlite does not support stored procedures, as such.

You can either SELECT directly into the INSERT statement ( example ), or just break it up into two separate prepared statements.

sqlite doesn't have quite the same amount of overhead for queries and their responses, so it generally isn't that big of a deal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM