문제

SQL Server 사용 - 날짜 검색에 사용하는 가장 빠르거나 모범 사례 방법은 무엇입니까? 차이가 있습니까?

도움이 되었습니까?

해결책

CURRENT_TIMESTAMP is standard ANSI SQL, and so is theoretically one tiny little island of 'don't need to change' amongst your thousands of SQL Server-specific lines of SQL if you ever need to move databases....

다른 팁

CURRENT_TIMESTAMP is part of the ANSI SQL spec. GETDATE() is a SQL Server-specific function inherited from the original Sybase code on which SQL Server is based.

They do exactly the same thing, though.

My vote is for CURRENT_TIMESTAMP for 'portability' reasons i.e. why be SQL Server -specific when there is a direct SQL-92 equivalent?

PS why was it not named getdatetime()? Now that SQL Server 2008 has a DATE and TIME data type, we can hope to get support for SQL-92's CURRENT_DATE and CURRENT_TIME, at which point getdate() could be potentially even more confusing.

Books Online tells us that CURRENT_TIMESTAMP "is equivalent to GETDATE()".

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top