Tuesday, November 24, 2009

how to get current date without time in sql server 2005

use these queries in sql server to get only date without time

-- Get current date (without time) as string:
SELECT CONVERT( CHAR(8), GetDate(), 112)

-- Get current date (without time) as date:
SELECT CAST( CONVERT( CHAR(8), GetDate(), 112) AS DATETIME)

No comments:

Post a Comment