문제

Got a specific requirement that we should extract only date and in YYYYMMDD format from GETDATE() in Sql-Server 2005.

How can I accomplish this.

Thanks

도움이 되었습니까?

해결책

You can use formatting in your sql query: http://www.sql-server-helper.com/tips/date-formats.aspx

Your query should be

SELECT CONVERT(VARCHAR(8), GETDATE(), 112) AS [YYYYMMDD]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top