2

How to capture current timestamp in ssis package 2016

I declared a variable and using expression but milliseconds are missing

@currenttimestamp = (DT_WSTR,50)(DT_DBTIMESTAMP)@[System::StartTime]

I want the milliseconds too

Thanks

SQL006
  • 439
  • 6
  • 21
  • Is there any way to use the below answer with @[System::StartTime], as it returns .000 in milliseconds place – SQL006 Mar 05 '18 at 06:58

2 Answers2

0

The issue was solved when casting to (DT_DBTIMESTAMP2,3):

(DT_WSTR,50)(DT_DBTIMESTAMP2,3)GETDATE()

but the time get changes as it using the getdate() asit returns the current time, I need the package start time I used the following

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

but the milliseconds is coming as .000

Do i have to use the getdate() in ExecuteSQLTask and assign that value to a string variable. I am new to ssis please give suggestions.

SQL006
  • 439
  • 6
  • 21
  • I used the ExecuteSQLTask but here also it storing only the datetime without milliseconds – SQL006 Mar 05 '18 at 07:32
  • You shouldn't ask a new, or followup, question in an answer and expect to get responses. You should either post a new question, or delete this answer and edit your existing question. – Tab Alleman Mar 05 '18 at 15:03
0

Use the below comand in the Execute SQL Task at the begining of the package that will give you the exact start time of the package.

SELECT CAST(GETDATE() as datetime2(6)) 'Date';
Adithya Alapati
  • 191
  • 1
  • 12