how to capture timestamp with milliseconds in ssis

2019-07-13 22:10发布

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

2条回答
啃猪蹄的小仙女
2楼-- · 2019-07-13 22:16

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';
查看更多
Juvenile、少年°
3楼-- · 2019-07-13 22:22

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.

查看更多
登录 后发表回答