How to get current time of SQL server?
I create some tables in SQL server. I connect to these tables using a Qt program. Qt program run on a different PC from SQL server. I want to get time of the system which run SQL server management in the qt program. I have Date field in the tables but they are empty now. How can I initial them?
@lina Did you find any specific SQL query which returns time?
Do you mean like this ?
A Date field merely holds a date type. so unless you write to it from the client
nothing is shown.
yes, I use sql server management tool. the name of database is Doc and the table which has Date field named as archive.I'm new in sql server. where should I add the below code?
-- Select the current local time
DECLARE @CurrentTime DATETIME
SET @CurrentTime = getdate()
Its been some years since i used MS SQL so not sure about it.
Links says " SQL Server Management Studio query window. "
thanks, it works.