Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SELECT DATE

Author  Topic 

putane.sanjay
Yak Posting Veteran

77 Posts

Posted - 2006-11-09 : 06:43:07
Hi
IN THE TABLE I HAVE A DATE COLUMN IN THE FORMAT
'0000-00-00 00:00:00'

I HAVE TO GET THE WHEN I PUT ONLY A DATEPART

EX: @A='2006-10-05'

I TRIED
select vfilename, deliverydate from JobsAvailable where deliverydate='2006-10-05'
but i got the error
Please give me a syntax


khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-11-09 : 07:35:32
what is the data type for the date column ?


KH

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-09 : 07:42:34
Try ISO format yyyymmdd

select vfilename, deliverydate from JobsAvailable where deliverydate='20061005' 


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-11-09 : 07:53:22
quote:

I TRIED
select vfilename, deliverydate from JobsAvailable where deliverydate='2006-10-05'
but i got the error
Please give me a syntax


What is the error message ?



KH

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-09 : 07:56:34
quote:
What is the error message ?


My guess:

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.



Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-11-09 : 08:01:14
Maybe not really error but the query does not work.

Try this

select vfilename, deliverydate
from JobsAvailable
where deliverydate >= '2006-10-05'
and deliverydate < '2006-10-06'



KH

Go to Top of Page
   

- Advertisement -