Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP SQL query error with data types

Reply
Thread Tools

ASP SQL query error with data types

 
 
David McManus
Guest
Posts: n/a
 
      09-29-2004
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.


 
Reply With Quote
 
 
 
 
Meelis Lilbok
Guest
Posts: n/a
 
      09-29-2004
Hi

Use this date format and no problems

yyyymmdd

Query = "SELECT title FROM tblContent WHERE starting = '" & date & "'"

where date='yyyymmdd'


Mex



"David McManus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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.
>



 
Reply With Quote
 
 
 
 
David McManus
Guest
Posts: n/a
 
      09-29-2004
Confused....

Could you tell me precisely where in my query you mean, please?

D

"Meelis Lilbok" <(E-Mail Removed)> wrote in message
news:%23g1%(E-Mail Removed)...
> Hi
>
> Use this date format and no problems
>
> yyyymmdd
>
> Query = "SELECT title FROM tblContent WHERE starting = '" & date & "'"
>
> where date='yyyymmdd'
>
>
> Mex
>
>
>
> "David McManus" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>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.
>>

>
>



 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      09-29-2004
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:
> Confused....
>
> Could you tell me precisely where in my query you mean, please?
>
> D
>
> "Meelis Lilbok" <(E-Mail Removed)> wrote in message
> news:%23g1%(E-Mail Removed)...
>> Hi
>>
>> Use this date format and no problems
>>
>> yyyymmdd
>>
>> Query = "SELECT title FROM tblContent WHERE starting = '" & date &
>> "'"
>>
>> where date='yyyymmdd'
>>
>>
>> Mex
>>
>>
>>
>> "David McManus" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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.


--
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Incompatible types" error though types are same generic type wdh3rd@gmail.com Java 3 04-15-2007 02:36 PM
What Happened to Sql Enterprise Manager and Sql Query Analyser in Visual Studio 2005 Edward ASP .Net 4 04-10-2006 04:15 PM
equivalent c data types for vc++ data types ramu C Programming 2 02-20-2006 09:33 AM
Build dynamic sql query for JSTL <sql:query> Anonymous Java 0 10-13-2005 10:01 PM
Tools to extract data from SQL database and convert it into XML & insert XML data into SQL databases Harry Zoroc XML 1 07-12-2004 10:10 PM



Advertisments