VFP spt查询SqlServer 2008 R2
我必须支持 SqlServer2008 R2 后端。 在早期版本(包括 2008)中的以下 SQL 语句中,
lcSql = "SELECT field1, field2, 00000.00 as CalcField FROM myTable"
SqlExec(lnHandle,lcSql,"csrMyTable")
CalcField 将返回为 N(8,2),但对于 R2,它将返回为 N(4,2)。
我使用该字段进行进一步计算,然后将计算值填充到 CalcField 中。当 CalcField 太小而无法容纳该值时,这就是一个问题。
我考虑过发布
lcSql = "SELECT field1, field2, 99999.99 as CalcField FROM myTable"
SqlExec(lnHandle,lcSql,"csrMyTable")
SELECT csrMyTable
REPLACE ALL CalcField WITH 0
我想知道是否有人有不同的解决方案。我在整个系统中使用它来进行报告、显示等,因此需要进行相当大的更改。
谢谢!
I have to support a SqlServer2008 R2 backend. In the following SQL statement
lcSql = "SELECT field1, field2, 00000.00 as CalcField FROM myTable"
SqlExec(lnHandle,lcSql,"csrMyTable")
in previous versions (include 2008) the CalcField would be returned as N(8,2), but with R2 it is returned as N(4,2).
I use this field to do further calculations and then stuff the calc value into the CalcField. This is now a problem when the CalcField is too small to hold the value.
i have considered issuing
lcSql = "SELECT field1, field2, 99999.99 as CalcField FROM myTable"
SqlExec(lnHandle,lcSql,"csrMyTable")
SELECT csrMyTable
REPLACE ALL CalcField WITH 0
I wonder if any one has a different solution. I use this throughout my system for reports, displays, etc. so it would require a fairly major change.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 CAST(0.00 AS N(8,2)) 作为 CalcField
Try with CAST(0.00 AS N(8,2)) as CalcField