| Author |
ASP SQL query error with data types
|
|
| David McManus 2004-09-29, 8:55 am |
| I am trying to use a query to filter SQL Server 2000 records by a date
value.
Here is relevant columns in my database table (tblContent):
title [nvarchar]
starting [smalldatetime]
.... and here is my query:
Query = "SELECT title FROM tblContent WHERE starting = '" & date & "'"
I've done exactly this query on numberous occassions in the past with no
problems at all but this time I get the following error:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of char data
type to smalldatetime data type resulted in an out-of-range smalldatetime
value.
What on earth is going on? I'm not using a char data type anywhere! I am
doing all the initial development locally and I have just installed XP
Service Pack 2. I realise it's unlikely, but that's the only thing I can
possibly attribute it to. Or am I just missing something obvious?
Anyone able to help, please?
Thanks.
| |
| Meelis Lilbok 2004-09-29, 8:55 am |
| Hi
Use this date format and no problems
yyyymmdd
Query = "SELECT title FROM tblContent WHERE starting = '" & date & "'"
where date='yyyymmdd'
Mex
"David McManus" <dave@TAKETHISOUTnqo.com> wrote in message
news:uSgEJPhpEHA.1164@TK2MSFTNGP10.phx.gbl...
>I am trying to use a query to filter SQL Server 2000 records by a date
>value.
> Here is relevant columns in my database table (tblContent):
>
> title [nvarchar]
> starting [smalldatetime]
>
> ... and here is my query:
>
> Query = "SELECT title FROM tblContent WHERE starting = '" & date & "'"
>
> I've done exactly this query on numberous occassions in the past with no
> problems at all but this time I get the following error:
>
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
> [Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of char data
> type to smalldatetime data type resulted in an out-of-range smalldatetime
> value.
>
> What on earth is going on? I'm not using a char data type anywhere! I am
> doing all the initial development locally and I have just installed XP
> Service Pack 2. I realise it's unlikely, but that's the only thing I can
> possibly attribute it to. Or am I just missing something obvious?
>
> Anyone able to help, please?
> Thanks.
>
| |
| David McManus 2004-09-29, 8:55 am |
| Confused....
Could you tell me precisely where in my query you mean, please?
D
"Meelis Lilbok" <meelis.lilbok@deltmar.ee> wrote in message
news:%23g1%23wThpEHA.3424@TK2MSFTNGP12.phx.gbl...
> Hi
>
> Use this date format and no problems
>
> yyyymmdd
>
> Query = "SELECT title FROM tblContent WHERE starting = '" & date & "'"
>
> where date='yyyymmdd'
>
>
> Mex
>
>
>
> "David McManus" <dave@TAKETHISOUTnqo.com> wrote in message
> news:uSgEJPhpEHA.1164@TK2MSFTNGP10.phx.gbl...
>
>
| |
| Bob Barrows [MVP] 2004-09-29, 8:55 am |
| http://www.aspfaq.com/show.asp?id=2313 vbscript
http://www.aspfaq.com/show.asp?id=2040 help with dates
http://www.aspfaq.com/show.asp?id=2260 dd/mm/yyy confusion
Bob Barrows
David McManus wrote:[color=darkred]
> Confused....
>
> Could you tell me precisely where in my query you mean, please?
>
> D
>
> "Meelis Lilbok" <meelis.lilbok@deltmar.ee> wrote in message
> news:%23g1%23wThpEHA.3424@TK2MSFTNGP12.phx.gbl...
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
|
|
|
|