Click to See Complete Forum and Search --> : Invalid column name 'NaN'??????


Will192
03-18-2003, 12:08 PM
I am running Javascript with ASP connecting to SQL Server 2000 on Windows 2000 Server. Here is the text that I am sending to SQL Server :

SELECT MIN(SLOTSAVAILABLE-SLOTSFULL) AS SLOTSOPEN, MIN(SLOTSAVAILABLE) AS SLOTSAVAILABLE FROM VPOFFICE WHERE OFFICECODE = 'STLX' AND DATEPART(YY,VACATIONDAY)=2003 AND DATEPART(MM,VACATIONDAY)=4 AND DATEPART(DD,VACATIONDAY)=9

I have printed the oRS.Source right before I oRS.Open, so I know that this is the sql that is sent to the server.

Here is the error that I get in the IE window when it hits the oRS.Open statement :

Invalid column name 'NaN'

What the hell is going on here? I have tried to change around the sql, but I still get an error. The statement runs fine in Query Analyzer. HELP!

Will192
(Thanks in advance for any responses to this post)

Ribeyed
03-18-2003, 09:52 PM
hi,
Dave i have a question regarding this, would his sql statement still return records if the vacation month was 12 and the day was say 20?
say the sql was this:

SELECT
MIN(SLOTSAVAILABLE-SLOTSFULL) AS SLOTSOPEN,
MIN(SLOTSAVAILABLE) AS SLOTSAVAILABLE
FROM VPOFFICE
WHERE OFFICECODE = 'STLX'
AND DatePart('y',VACATIONDAY) = 2003
AND DatePart('m',VACATIONDAY) = 12
AND DatePart('d',VACATIONDAY) = 20;

Would this return records where vaction month was 2 and day was 0?

Im not sure on this one but my thinking would be to have this, but i could very well be wrong on this:

SELECT
MIN(SLOTSAVAILABLE-SLOTSFULL) AS SLOTSOPEN,
MIN(SLOTSAVAILABLE) AS SLOTSAVAILABLE
FROM VPOFFICE
WHERE OFFICECODE = 'STLX'
AND DatePart('yy',VACATIONDAY) = 2003
AND DatePart('mm',VACATIONDAY) = 04
AND DatePart('dd',VACATIONDAY) = 09;

Can you set me straight on this Dave?