How to get current time of SQL server?
-
wrote on 18 Feb 2017, 05:38 last edited by A Former User
Hi,
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?
-
Hi
Do you mean like this ?
http://www.blackwasp.co.uk/SQLGetDate.aspxA Date field merely holds a date type. so unless you write to it from the client
nothing is shown. -
Hi
Do you mean like this ?
http://www.blackwasp.co.uk/SQLGetDate.aspxA Date field merely holds a date type. so unless you write to it from the client
nothing is shown.wrote on 18 Feb 2017, 19:52 last edited byHi,
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
**SELECT getdate()DECLARE @CurrentTime DATETIME
SET @CurrentTime = getdate()
PRINT @CurrentTime** -
Hi,
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
**SELECT getdate()DECLARE @CurrentTime DATETIME
SET @CurrentTime = getdate()
PRINT @CurrentTime**@lina
Hi
Its been some years since i used MS SQL so not sure about it.
Links says " SQL Server Management Studio query window. " -
@lina
Hi
Its been some years since i used MS SQL so not sure about it.
Links says " SQL Server Management Studio query window. "
1/6