A97 - 尝试使用Nz - 获取字符串而不是数字的返回值??? [英] A97 - Experimenting with Nz - getting return values that are strings rather than numbers???
本文介绍了A97 - 尝试使用Nz - 获取字符串而不是数字的返回值???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:Nz([LaborCost],0)返回300和300。如果
[LaborCost]字段中的值是300(货币数据类型)和0。如果值是
零或null。我在查询输出中得到了字符串 - 它们都被保留了
对齐,我无法在没有先将它们转换为
值的情况下添加它们。可能导致这种情况的原因是什么?
For example: Nz([LaborCost],0) returns "300" if the value in
[LaborCost] field is 300 (currency data type) and "0" if the value is
zero or null. I get strings in the query output - they are all left
aligned and I cannot add them without first converting them to
values. What might be causing this?
推荐答案
我再次对此进行了测试,使其变得尽可能简单。以下
SQL描述了一个基于单个表及其两个字段的查询。
第一个是长整数类型,第二个是货币类型。
SELECT Nz([VehicleJobID],0)AS Case1,Nz([LaborCost],0)AS Case2
FROM tblENF262SpecificInfo;
我在查询动态集中得到的输出是STRING类型数据。我想
我很疯狂所以我运行了上述SQL的这个修改...
SELECT Nz([VehicleJobID],0)AS Case1,Nz([ LaborCost],0)AS Case2,
VarType([Case1])AS Type1,VarType([Case2])AS Type2
FROM tblENF262SpecificInfo;
下面的输出告诉我一切都是字符串...
案例1案例2类型1类型2
1 0 8 8
23 0 8 8
24 0 8 8
26 0 8 8
27 0 8 8
28 0 8 8
29 0 8 8
30 0 8 8
31 0 8 8
32 0 8 8
33 0 8 8
34 0 8 8
36 0 8 8
38 0 8 8
42 0 8 8
72 0 8 8
73 0 8 8
74 0 8 8
77 0 8 8
78 0 8 8
83 0 8 8
85 0 8 8
4 0 8 8
5 0 8 8
6 0 8 8
7 0 8 8
8 0 8 8
9 0 8 8
10 0 8 8
11 0 8 8
12 0 8 8
14 0 8 8
15 0 8 8
16 0 8 8
17 0 8 8
19 0 8 8
20 0 8 8
21 0 8 8
76 0 8 8
82 0 8 8
88 0 8 8
89 0 8 8
80 0 8 8
94 0 8 8
95 507 8 8
84 0 8 8
79 0 8 8
90 0 8 8
91 0 8 8
93 0 8 8
97 0 8 8
96 85 8 8
98 0 8 8
99 0 8 8
104 0 8 8
I tested this again, making it as simple as I could. The following
SQL describes a query based on a single table and 2 of its fields.
The first is a long integer type the second is a currency type.
SELECT Nz([VehicleJobID],0) AS Case1, Nz([LaborCost],0) AS Case2
FROM tblENF262SpecificInfo;
The output I get in the query dynaset is STRING type data. I figure
I''m nuts so I ran this modification of the above SQL...
SELECT Nz([VehicleJobID],0) AS Case1, Nz([LaborCost],0) AS Case2,
VarType([Case1]) AS Type1, VarType([Case2]) AS Type2
FROM tblENF262SpecificInfo;
And the output below suggests to me that everything is string...
Case1 Case2 Type1 Type2
1 0 8 8
23 0 8 8
24 0 8 8
26 0 8 8
27 0 8 8
28 0 8 8
29 0 8 8
30 0 8 8
31 0 8 8
32 0 8 8
33 0 8 8
34 0 8 8
36 0 8 8
38 0 8 8
42 0 8 8
72 0 8 8
73 0 8 8
74 0 8 8
77 0 8 8
78 0 8 8
83 0 8 8
85 0 8 8
4 0 8 8
5 0 8 8
6 0 8 8
7 0 8 8
8 0 8 8
9 0 8 8
10 0 8 8
11 0 8 8
12 0 8 8
14 0 8 8
15 0 8 8
16 0 8 8
17 0 8 8
19 0 8 8
20 0 8 8
21 0 8 8
76 0 8 8
82 0 8 8
88 0 8 8
89 0 8 8
80 0 8 8
94 0 8 8
95 507 8 8
84 0 8 8
79 0 8 8
90 0 8 8
91 0 8 8
93 0 8 8
97 0 8 8
96 85 8 8
98 0 8 8
99 0 8 8
104 0 8 8
进一步说明关键,我用这个SQL提取并且
显示实际的表字段值和他们的Nz处理
等价物......
SELECT Nz([VehicleJobID],0)AS Case1,Nz([LaborCost],0)AS Case2,
tblENF262SpecificInfo.VehicleJobID,tblENF262SpecificInfo.LaborCost
FROM tblENF262SpecificInfo ;
这里是查询输出...
案例1案例2 VehicleJobID LaborCost
1 0 1
To further illustrate the point, I used this SQL to extract and
display the actual table field values AND their Nz processed
equivalents...
SELECT Nz([VehicleJobID],0) AS Case1, Nz([LaborCost],0) AS Case2,
tblENF262SpecificInfo.VehicleJobID, tblENF262SpecificInfo.LaborCost
FROM tblENF262SpecificInfo;
Here''s the query output...
Case1 Case2 VehicleJobID LaborCost
1 0 1
0.00
23 0 23
24 0 24
26 0 26
27 0 27
28 0 28
29 0 29
30 0 30
31 0 31
32 0 32
33 0 33
34 0 34
36 0 36
38 0 38
42 0 42
72 0 72
73 0 73
74 0 74
77 0 77
78 0 78
83 0 83
85 0 85
4 0 4
5 0 5
6 0 6
7 0 7
8 0 8
9 0 9
10 0 10
11 0 11
12 0 12
14 0 14
15 0 15
16 0 16
17 0 17
19 0 19
20 0 20
21 0 21
76 0 76
82 0 82
88 0 88
89 0 89
80 0 80
94 0 94
95 507 95
0.00
23 0 23
24 0 24
26 0 26
27 0 27
28 0 28
29 0 29
30 0 30
31 0 31
32 0 32
33 0 33
34 0 34
36 0 36
38 0 38
42 0 42
72 0 72
73 0 73
74 0 74
77 0 77
78 0 78
83 0 83
85 0 85
4 0 4
5 0 5
6 0 6
7 0 7
8 0 8
9 0 9
10 0 10
11 0 11
12 0 12
14 0 14
15 0 15
16 0 16
17 0 17
19 0 19
20 0 20
21 0 21
76 0 76
82 0 82
88 0 88
89 0 89
80 0 80
94 0 94
95 507 95
这篇关于A97 - 尝试使用Nz - 获取字符串而不是数字的返回值???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文