VFP spt查询SqlServer 2008 R2

发布于 2024-12-12 11:57:55 字数 585 浏览 0 评论 0原文

我必须支持 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日记撕了你也走了 2024-12-19 11:57:55

尝试使用 CAST(0.00 AS N(8,2)) 作为 CalcField

lcSql = "SELECT field1, field2, CAST(0.00 AS N(8,2)) as CalcField FROM myTable"
SqlExec(lnHandle,lcSql,"csrMyTable")

Try with CAST(0.00 AS N(8,2)) as CalcField

lcSql = "SELECT field1, field2, CAST(0.00 AS N(8,2)) as CalcField FROM myTable"
SqlExec(lnHandle,lcSql,"csrMyTable")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文