Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

ASP SQL query error with data types
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.



Report this thread to moderator Post Follow-up to this message
Old Post
David McManus
09-29-04 01:55 PM


Re: ASP SQL query error with data types
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.
>



Report this thread to moderator Post Follow-up to this message
Old Post
Meelis Lilbok
09-29-04 01:55 PM


Re: ASP SQL query error with data types
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... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
David McManus
09-29-04 01:55 PM


Re: ASP SQL query error with data types
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" <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.



Report this thread to moderator Post Follow-up to this message
Old Post
Bob Barrows [MVP]
09-29-04 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:41 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.