Get Time From datetime field in SQL2005
SELECT * FROM tablename WHERE CONVERT(VARCHAR(8),datetimecloumnName,108) >= '10:35:16 AM' AND CONVERT(VARCHAR(8),datetimecloumnName,108) <= '11:35:16 AM'
Get Date From datetime field in SQL2005 (103-as dd/mm/yyyy)
SELECT * FROM tablename WHERE CONVERT(VARCHAR(10),datetimecloumnName,103) ='02/06/2012'
SELECT * FROM tablename WHERE CONVERT(VARCHAR(8),datetimecloumnName,108) >= '10:35:16 AM' AND CONVERT(VARCHAR(8),datetimecloumnName,108) <= '11:35:16 AM'
Get Date From datetime field in SQL2005 (103-as dd/mm/yyyy)
SELECT * FROM tablename WHERE CONVERT(VARCHAR(10),datetimecloumnName,103) ='02/06/2012'
No comments:
Post a Comment