How to print GETDATE() in SQL Server with milliseconds in time?

前端 未结 7 590
情书的邮戳
情书的邮戳 2021-02-03 16:49

I want to print GETDATE() in SQL Server 2008, I need the time with milliseconds (this is for debugging purpose - to find sp\'s execution time )

I find this Difference

7条回答
  •  终归单人心
    2021-02-03 17:10

    Try Following

    DECLARE @formatted_datetime char(23)
    SET @formatted_datetime = CONVERT(char(23), GETDATE(), 121)
    print @formatted_datetime
    

提交回复
热议问题