IT-Hardware & Networking
Ravi Vishwakarma is a dedicated Software Developer with a passion for crafting efficient and innovative solutions. With a keen eye for detail and years of experience, he excels in developing robust software systems that meet client needs. His expertise spans across multiple programming languages and technologies, making him a valuable asset in any software development project.
In Microsoft Microsoft SQL Server, both
GETDATE()andCURRENT_TIMESTAMPreturn the current system date and time.But there are some differences.
GETDATE() vs CURRENT_TIMESTAMP
()datetimedatetimeExample
GETDATE()
Example Output:
CURRENT_TIMESTAMP
Example Output:
Key Difference
GETDATE()
CURRENT_TIMESTAMP
Internally
In SQL Server:
Result:
Both return the same value.
Practical Example
Insert Current Date
OR
Which One Should You Use?
GETDATE()CURRENT_TIMESTAMPCURRENT_TIMESTAMPRelated Functions
GETDATE()SYSDATETIME()GETUTCDATE()CURRENT_TIMESTAMPHigher Precision Example
Returns:
GETDATE()only returns milliseconds precision.