Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 DTS Export in Text file But File Name Variable

Author  Topic 

aiman
Starting Member

18 Posts

Posted - 2007-06-25 : 01:42:42
DTS Package Data Export in Text file But problem is File Name should be with Time Stamp. How can i implement it. Please help me.
Export File Name should be.

WorkCode20070625121010
WorkCode20070625121310
WorkCode20070625121610
WorkCode20070625121910

Package will run schedulely after every 3 minitue.Name format is <WorkCodeYearMonthDayHoureMinuteSecond>

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-25 : 03:51:59
Duplicate of http://sqlteam.com/forums/topic.asp?TOPIC_ID=85485

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ekb18c
Starting Member

18 Posts

Posted - 2007-06-27 : 21:15:13
Well in DTS you need to declare a globalvariable in an activeX script something like:

________________________________________________________________________________________
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()

Dim SerialTime SerialDate
SerialDate = DatePart("yyyy",date) & Right("00000" & DatePart("m",date),2) & Right("00000" & DatePart("d",date),2)
SerialTime = trim(replace(left( time(),8),":",""))

DTSGlobalVariables("exportfile1").Value = "C:\workcode" & SerialDate & SerialTime

Main = DTSTaskExecResult_Success
End Function

___________________________________________________________


Then use dynamic properties to set the txt file destination to the global var.

Go to Top of Page

ekb18c
Starting Member

18 Posts

Posted - 2007-06-27 : 21:28:49
oh..

change SerialTime = trim(replace(left( time(),8),":",""))

to

SerialTime = trim(replace(left( time(),6),":",""))

and you should get exactly what you want..

Try it out with a msgbox
Go to Top of Page
   

- Advertisement -