将 SQL Server 查询转换为 Firebird 时遇到问题
我是 Firebird 的新手,并且在将此 T-SQL 转换为 Firebird SQL 时遇到特别困难。此代码存储在数据库外部,而不是存储过程中。
DECLARE @NumTotal int
DECLARE @NumUsed int
SELECT @NumTotal = COUNT(*)
FROM "some_Table"
WHERE "CreatedOn"=@CreatedOn
SELECT @NumUsed = COUNT(*)
FROM "some_Table"
WHERE "CreatedOn"=@CreatedOn AND "UserID" IS NOT NULL
SELECT @NumUsed AS "NumUsed", @NumTotal AS "NumTotal"
我从错误和我的实验中猜想,我基本上被迫以某种方式将其放入存储过程中。有没有办法可以做到这一点,同时仍将代码保留在数据库之外?
I'm new to Firebird, and I'm having particular difficulty translating this T-SQL to Firebird SQL. This code is stored outside of the database, not in a stored procedure.
DECLARE @NumTotal int
DECLARE @NumUsed int
SELECT @NumTotal = COUNT(*)
FROM "some_Table"
WHERE "CreatedOn"=@CreatedOn
SELECT @NumUsed = COUNT(*)
FROM "some_Table"
WHERE "CreatedOn"=@CreatedOn AND "UserID" IS NOT NULL
SELECT @NumUsed AS "NumUsed", @NumTotal AS "NumTotal"
I guess from the errors and my experimentation that I'm basically forced to put this into a stored procedure somehow. Is there a way I can do this while still keeping the code out of the database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的代码可以简化为单个查询:
使用双引号是 ANSI 转义异常字符的方法,我在示例中没有看到这些字符。
Your code can be simplified to a single query:
Using double quotes is ANSI for escaping unusual characters, none of which I see in the example.