-4

I want the package start time including milliseconds, in the below code I am using @[System::StartTime] but have milliseconds like this .000 no numbers are displaying

(DT_WSTR,50)(DT_DBTIMESTAMP2,3)@[System::StartTime] 

How to get the package start time with milliseconds?


Edit

I am getting milliseconds in this code (DT_WSTR,50)(DT_DBTIMESTAMP2,3)GETDATE() but the problem is GETDATE() returns only the current time not the starting time. How to execute this code at the start and assign the value to another variable

James Z
  • 12,209
  • 10
  • 24
  • 44
SQL006
  • 439
  • 6
  • 21
  • When I used ExecuteSQLTask and used SELECT GETDATE then I also not getting the milliseconds but in SQL server I am getting the milliseconds – SQL006 Mar 06 '18 at 04:21
  • I am getting milliseconds in this code (DT_WSTR,50)(DT_DBTIMESTAMP2,3)GETDATE() but the problem is GETDATE() returns only the current time not the starting time. How to execute this code at the start and assign the value to another variable – SQL006 Mar 06 '18 at 04:30
  • 2
    Possible duplicate of [how to capture Package start time with milliseconds in ssis package 2016](https://stackoverflow.com/questions/49104035/how-to-capture-package-start-time-with-milliseconds-in-ssis-package-2016) – Prabhat G Mar 06 '18 at 05:31

2 Answers2

0

I used an ExecuteSQLTask and used the following code

SELECT CAST(GETDATE() as datetime2(6)) 
SQL006
  • 439
  • 6
  • 21
0

Use this SQL comand in Execute SQL task at the begining of the package.

SELECT CONVERT(VARCHAR(10),GETDATE(),103)+' '+CONVERT(VARCHAR(8),GETDATE(),108)+'.'+CONVERT(VARCHAR(3),DATEPART(MS,GETDATE()))
Adithya Alapati
  • 191
  • 1
  • 12