Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select where data = ????

Status
Not open for further replies.

Zahier

MIS
Oct 3, 2002
97
0
0
ZA
Hi techies,

Coming from an Oracle background I am struggling to do something as simple as extracting all records where date is "what I specify"

I tried this:
select * from my_table
where convert(char(15),dtime,2) like '2004.04.20%'

When I do a select * of my_table, the dtime format is "yyyy-mm-dd hh:mm:ss:si"

Please assist me in the right direction :eek:)
 
Zahier
I think the error is the format your are using for the date, try
Code:
select * from my_table where dtime like '2004-04-20%'
The - is use the default mask for the datetime, timestamp format in the options of the database. At least the versions i've used.
If the problem persist you will have to be more specific, platform, version, error...

Hope this helps,
David.
 
Thanks for replying David. I tried your suggestion initially, but it errors with "Invalid data type comparison". I am running SYbase AS IQ on a SunOS. I am using the Sybase online manuals but find nothing. Your assistance is appreciated.
 
Hi there,

I used the dateformat function to convert the date to a string; dateformat(dtime,'yyyy/mm/dd')='2004/05/20'. It works. Thanks again for the help :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top