简体   繁体   English

Python:T-SQL等价于Sqlite3吗?

[英]Python: T-SQL EQuivalent for Sqlite3?

I have the following MS-SQL based query which I need to convert into Sqlite3 based database 我有以下基于MS-SQL的查询,我需要将其转换为基于Sqlite3的数据库

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

I then have to use that variable in an INSERT query. 然后,我必须在INSERT查询中使用该变量。

One way I think is to execute query and bind variables but I am willing to execute all queries in a Go. 我认为一种方法是执行查询和绑定变量,但我愿意在Go中执行所有查询。 Is it possible? 可能吗?

I am using Python 2.6 我正在使用Python 2.6

Thanks 谢谢

sqlite does not support stored procedures, as such. 这样,sqlite不支持存储过程。

You can either SELECT directly into the INSERT statement ( example ), or just break it up into two separate prepared statements. 您可以直接将SELECT插入INSERT语句( 示例 ),也可以将其分解为两个单独的准备好的语句。

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. sqlite的查询及其响应的开销并不完全相同,因此通常没什么大不了的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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