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!

date conversion.

Status
Not open for further replies.

brahman

Programmer
Apr 17, 2003
21
0
0
IN
Dear group mates,

Can anybody help me out with this date conversion from ORACLE to SQL Server.

I have written a query that gives me record in the specified range but am not able to get the same records in the SQL Server.

Please guide me out I used Convert but it is not working fine.

the oracle query is.
---------
select * from table-name where date between TO_DATE('"+ somestring +" 00:00+"','yyyy-mm-dd hh24:mi') and TO_DATE('"+somestring+ "23:59"+"','yyyy-mm-dd hh24:mi')
---------

suggest me an SQL Query for this please

waiting for the response.

bye for now
amit
 
select * from table-name where date between TO_DATE('"+ somestring +" 00:00+"','yyyy-mm-dd hh24:mi') and TO_DATE('"+somestring+ "23:59"+"','yyyy-mm-dd hh24:mi')


SELECT *
FROM table-name
WHERE date
BETWEEN CONVERT(VarChar, '2003/06/07' + ' 00:00', 100)
AND CONVERT(VarChar, '2003/06/16' + ' 00:00' , 100)

Hope this helps a bit
 
ya this solved my problem thanks a lot boss.

Bye for now
amit
 
No worries - if you've got SQL Server installed the books on-line is pretty good
Programmes -> SQL Server -> Books online

Has a pretty good page on CAST / CONVERT useful for dates.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top