Showing posts with label temp. Show all posts
Showing posts with label temp. Show all posts

Friday, March 9, 2012

DTS Package

How can I have a DTS package rename a file?
for example, I have a file c:\temp.txt
I would like to have a DTS package change it to c:\temp060806.txt (the
numbers is teh date)
ThanksYou need an ActiveX script task in your DTS package to do this. In your
ActiveX script task, you have to instantiate the FileSystemObject object to
rename the file.
Here's an example from one of my DTS packages:
dim DataFile, FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
DataFile = DTSGlobalVariables("FileLocation")
If FSO.FileExists(DataFile) Then
FSO.MoveFile DataFile, DTSGlobalVariables("ProcessedFiles") + "Orders_"
+CStr(Year(Now)) + Right("0" + CStr(Month(Now)), 2) + Right("0" +
CStr(Day(Now)), 2) + Right("0" + CStr(Hour(Now)), 2) + Right("0" +
CStr(Minute(Now)), 2) + Right("0" + CStr(Second(Now)), 2) + ".txt"
End If
Main = DTSTaskExecResult_Success
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Johnfli" <john@.ivhs.us> wrote in message
news:OFU2fLxiGHA.4204@.TK2MSFTNGP02.phx.gbl...
How can I have a DTS package rename a file?
for example, I have a file c:\temp.txt
I would like to have a DTS package change it to c:\temp060806.txt (the
numbers is teh date)
Thanks

DTS Package

I have created a DTS package that connects to the database fills a temp table with data based on my sql statement, generates a text file with the data in the temp table, and after the file is generated the temp table to truncated. The package has been added as a job to run daily, but the problem is sometimes the job will not generate data in the text file. I get an email with the file attached as soon as the job ends, and if i see that no data is in the file I run the package manually, and for what ever reason the file will then have data. Can someone tell me why the job will sometimes pull data, and sometimes not. But manualy running it will always pull data.

Thanks in adavance for helping!!

Is it possible that the dependency for the text file generation is not quite 'right', and that the file is generated before the temp table is completed?|||Also enable the DTS package log to see the underlying events during the data administration.

Wednesday, March 7, 2012

DTS Package

How can I have a DTS package rename a file?
for example, I have a file c:\temp.txt
I would like to have a DTS package change it to c:\temp060806.txt (the
numbers is teh date)
ThanksYou need an ActiveX script task in your DTS package to do this. In your
ActiveX script task, you have to instantiate the FileSystemObject object to
rename the file.
Here's an example from one of my DTS packages:
dim DataFile, FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
DataFile = DTSGlobalVariables("FileLocation")
If FSO.FileExists(DataFile) Then
FSO.MoveFile DataFile, DTSGlobalVariables("ProcessedFiles") + "Orders_"
+CStr(Year(Now)) + Right("0" + CStr(Month(Now)), 2) + Right("0" +
CStr(Day(Now)), 2) + Right("0" + CStr(Hour(Now)), 2) + Right("0" +
CStr(Minute(Now)), 2) + Right("0" + CStr(Second(Now)), 2) + ".txt"
End If
Main = DTSTaskExecResult_Success
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Johnfli" <john@.ivhs.us> wrote in message
news:OFU2fLxiGHA.4204@.TK2MSFTNGP02.phx.gbl...
How can I have a DTS package rename a file?
for example, I have a file c:\temp.txt
I would like to have a DTS package change it to c:\temp060806.txt (the
numbers is teh date)
Thanks

Sunday, February 19, 2012

DTS Invalid pointer

This continues from the tread DTS using #temp tables. I have a temp table
that gets populated through a really complex SP (with
selects/update/inserts). When all the processing is completed, the very last
SELECT * from @.table is executed to get the results. I need these results
pumped to an external text file on a nightly basis.
I started with #temp tables and couldn't get the DTS to see the table. So I
converted the table to @.table datatype and now the DTS can see the
definitions.
When I execute the DTS step to pump the data to the text file I get the
error message: 'Invalid Pointer'. The DTS can see all the transforms and
objects in the SP, but I cannot figure this error. For whatever reason, if I
"Preview" the data in the DTS it will say no row set was returned. But
running it in Query Analyzer produces results.
I've been struggling with this for two days. Any further assistance is
appreciated.
--
JP
.NET Software Developertry SET NOCOUNT ON at the start of the procedure.
I'm not sure your situation but sounds what i experience before
Hope that help.
"JP" <JP@.discussions.microsoft.com> wrote in message
news:3D2B9092-7DC8-4FCB-810C-923E4EA7EF09@.microsoft.com...
> This continues from the tread DTS using #temp tables. I have a temp table
> that gets populated through a really complex SP (with
> selects/update/inserts). When all the processing is completed, the very
last
> SELECT * from @.table is executed to get the results. I need these results
> pumped to an external text file on a nightly basis.
> I started with #temp tables and couldn't get the DTS to see the table. So
I
> converted the table to @.table datatype and now the DTS can see the
> definitions.
> When I execute the DTS step to pump the data to the text file I get the
> error message: 'Invalid Pointer'. The DTS can see all the transforms and
> objects in the SP, but I cannot figure this error. For whatever reason, if
I
> "Preview" the data in the DTS it will say no row set was returned. But
> running it in Query Analyzer produces results.
> I've been struggling with this for two days. Any further assistance is
> appreciated.
> --
> JP
> .NET Software Developer|||
"JP" wrote:

> This continues from the tread DTS using #temp tables. I have a temp table
> that gets populated through a really complex SP (with
> selects/update/inserts). When all the processing is completed, the very la
st
> SELECT * from @.table is executed to get the results. I need these results
> pumped to an external text file on a nightly basis.
> I started with #temp tables and couldn't get the DTS to see the table. So
I
> converted the table to @.table datatype and now the DTS can see the
> definitions.
> When I execute the DTS step to pump the data to the text file I get the
> error message: 'Invalid Pointer'. The DTS can see all the transforms and
> objects in the SP, but I cannot figure this error. For whatever reason, if
I
> "Preview" the data in the DTS it will say no row set was returned. But
> running it in Query Analyzer produces results.
> I've been struggling with this for two days. Any further assistance is
> appreciated.
> --
> JP
> .NET Software Developer|||Andy Warren posted this reply which may help.
By: Andy Warren
Email : awarren@.cfl.rr.com
Last Modified: 11/16/2001
The problem is that the query must be a single line of T-SQL code. Most
likely you have a "use " line before the query which will cause this error.
(Back to SQL Server 7.0/2000:DTS FAQs)
"Atenza" wrote:

> try SET NOCOUNT ON at the start of the procedure.
> I'm not sure your situation but sounds what i experience before
> Hope that help.
> "JP" <JP@.discussions.microsoft.com> wrote in message
> news:3D2B9092-7DC8-4FCB-810C-923E4EA7EF09@.microsoft.com...
> last
> I
> I
>
>