1

Topic: ODBC. The request does not work

Hello!
There is a SQL query which is launched in excel to sheet through ODBC. Strange works. Writes "Inadmissible usage NULL". It is all from for fields [Jur of the person]. There is both the text, and number. But NULL in lines is not present.
Request in nesting.
How correctly to write request?

2

Re: ODBC. The request does not work

If in the field [Jur the person] value as the text perceives as Null. And if as number perceives normally. Why so?

3

Re: ODBC. The request does not work

If in a source code in the field [Jur the person] to set a text format normally works. How it is necessary to write request so that worked irrespective of the format as the text is set or not?

4

Re: ODBC. The request does not work

ferzmikk, and what for to a field [Jur the person] to set a format which is distinct from the text? You to add or multiply them, whether that, gather?

5

Re: ODBC. The request does not work

wrote:

and what for to a field [Jur the person] to set a format which is distinct from the text?

When you interpose the data into sheet, to default a format "General".

6

Re: ODBC. The request does not work

Here still an example. I connect two tables and deduces "Inadmissible usage NULL".
[spoiler]

SELECT
1. [The TT code];
1. [The nomenclature code];
1. [Date];
1. [1];
>>> IIF (ISNULL (2. [Date and starting time]), 0,1) AS [Day of lock] <<<
FROM
(SELECT
1. [The TT code];
CStr (Tv1. [The nomenclature Code]) AS [the nomenclature Code];
CDate (Tv1. [Date]) AS [Date];
IIf (IsNull (Tv1. [1]), Null, CDbl (Tv1. [1])) AS [1]
FROM
[_ given $] Tv1) AS 1
LEFT JOIN
(SELECT
CStr (Tv2. [The nomenclature Code]) AS [the nomenclature Code];
2. [The TT code];
IIf (IsNull (Tv2. [Jur the person]), Tv2. [Jur the person], Cstr (Tv2. [Jur the person])) AS [Jur the person];
CDate (Tv2. [Date and starting time]) AS [Date and starting time];
CDate (Tv2. [Date and ending time]) AS [Date and ending time]
FROM
[_ $] Tv2
) AS 2
ON
1. [The TT code] = 2. [The TT Code]
AND
1. [The nomenclature code] = 2. [The nomenclature Code]
AND
((1. [Date]> = 2. [Date and starting time] AND 2. [Date and ending time] =CDate (' 1/1/1900 '))
OR
(1. [Date]> = 2. [Date and starting time] AND 1. [Date] <=2. [Date and ending time]))

[/spoiler]
The field [] displays Day of lock, if this day there was a lock in correspondence to table _ returns 1, differently 0.
The selected line it is necessary as that on another to write, that did not display an error. How correctly to write?

7

Re: ODBC. The request does not work

Why the error specifies on Null if function isnull is used?