Tuesday, March 27, 2012
DTS execution
I'm assuming that this is the SSIS package you built using the Transact-SQL that I provided, and that you are running this on the SQL 2005 Express machine... If any of those assumptions are bad, the rest of this message is worthless.
If I told you to use DTSRUN, that was my mistake... I should have specified DTSEXEC. See the web page on dtsrun to dtexec Command Option Mapping (http://msdn2.microsoft.com/en-us/library/ms345282.aspx) for more details on the conversion from DTSRUN to DTSEXEC.
Anywho, its good to see you here! Hopefully you'll get quicker answers here than waiting for me, but then again I do make "housecalls" for old friends when I'm in the neighborhood!
-PatPsql
Thursday, March 22, 2012
DTS Delimited Record Question
I am using SQL Server 2000 and am processing records via DTS. The
records are delimited and I have no trouble breaking them using the
file object but every record ends with a tilde (~) that I would like to
strip off. Is it possible to set the record delimiter to "Tilde+cr+lf"
so that the tilde would get chopped off each record before being passed
to my AxtiveX script? The records do not have the same number of
elements, so I can not simply chmop the tilde off the Nth field.
If the above will not work, how can I determine the final field in each
record and remove the offending tilde?
Thanks!
--greg
Hi
If you do not expect a tilda in any field you can just replace any occurence
in every field. If you activeX scripts assumes that there are at most n
fields you can check backwards to the last non-blank field and remove the
tilda.
John
"tubaranger@.gmail.com" wrote:
> Hello-
> I am using SQL Server 2000 and am processing records via DTS. The
> records are delimited and I have no trouble breaking them using the
> file object but every record ends with a tilde (~) that I would like to
> strip off. Is it possible to set the record delimiter to "Tilde+cr+lf"
> so that the tilde would get chopped off each record before being passed
> to my AxtiveX script? The records do not have the same number of
> elements, so I can not simply chmop the tilde off the Nth field.
> If the above will not work, how can I determine the final field in each
> record and remove the offending tilde?
> Thanks!
> --greg
>
sql
DTS Delimited Record Question
I am using SQL Server 2000 and am processing records via DTS. The
records are delimited and I have no trouble breaking them using the
file object but every record ends with a tilde (~) that I would like to
strip off. Is it possible to set the record delimiter to "Tilde+cr+lf"
so that the tilde would get chopped off each record before being passed
to my AxtiveX script? The records do not have the same number of
elements, so I can not simply chmop the tilde off the Nth field.
If the above will not work, how can I determine the final field in each
record and remove the offending tilde?
Thanks!
--gregHi
If you do not expect a tilda in any field you can just replace any occurence
in every field. If you activeX scripts assumes that there are at most n
fields you can check backwards to the last non-blank field and remove the
tilda.
John
"tubaranger@.gmail.com" wrote:
> Hello-
> I am using SQL Server 2000 and am processing records via DTS. The
> records are delimited and I have no trouble breaking them using the
> file object but every record ends with a tilde (~) that I would like to
> strip off. Is it possible to set the record delimiter to "Tilde+cr+lf"
> so that the tilde would get chopped off each record before being passed
> to my AxtiveX script? The records do not have the same number of
> elements, so I can not simply chmop the tilde off the Nth field.
> If the above will not work, how can I determine the final field in each
> record and remove the offending tilde?
> Thanks!
> --greg
>
DTS Delimited Record Question
I am using SQL Server 2000 and am processing records via DTS. The
records are delimited and I have no trouble breaking them using the
file object but every record ends with a tilde (~) that I would like to
strip off. Is it possible to set the record delimiter to "Tilde+cr+lf"
so that the tilde would get chopped off each record before being passed
to my AxtiveX script? The records do not have the same number of
elements, so I can not simply chmop the tilde off the Nth field.
If the above will not work, how can I determine the final field in each
record and remove the offending tilde?
Thanks!
--gregHi
If you do not expect a tilda in any field you can just replace any occurence
in every field. If you activeX scripts assumes that there are at most n
fields you can check backwards to the last non-blank field and remove the
tilda.
John
"tubaranger@.gmail.com" wrote:
> Hello-
> I am using SQL Server 2000 and am processing records via DTS. The
> records are delimited and I have no trouble breaking them using the
> file object but every record ends with a tilde (~) that I would like to
> strip off. Is it possible to set the record delimiter to "Tilde+cr+lf"
> so that the tilde would get chopped off each record before being passed
> to my AxtiveX script? The records do not have the same number of
> elements, so I can not simply chmop the tilde off the Nth field.
> If the above will not work, how can I determine the final field in each
> record and remove the offending tilde?
> Thanks!
> --greg
>
Monday, March 19, 2012
DTS automatic dat file import
I'm having some trouble with the following script I use in a
dts-package. I use it to automatically import a dat-file of which the
name changes every day. Today the name f.e. is P0000020.dat, tomorrow
it's P0000021.dat and the day after P0000022.dat etc etc The error I
get is end of instruction expected.
This is the script:
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Function Main()
Dim oPkg, oDataPump
Dim sSourceTable, sDestinationTable
' Derive the new table names
sSourceTable ="" & GetName
sDestinationTable = sSourceTable
' Get reference to the DataPump Task
Set oPkg = DTSGlobalVariables.Parent
Set oDataPump = oPkg.Tasks("DTSTask_DTSDataPumpTask_1").CustomTask
' Set the new values
oDataPump.SourceObjectName = sSourceTable
oDataPump.DestinationObjectName = "[Test].[test].[tblXafaxOutput]"
' Clean Up
Set oDataPump = Nothing
Set oPkg = Nothing
Main = DTSTaskExecResult_Success
End Function
Function GetName
Dim number, counter, file
counter = 1
number = DTSGlobalVariables("NextNumber").Value
number = number + 1
For counter = 1 To 7 - Len(number)
file = file & "O"
Next teller
file = "P" & file & getal & ".dat"
DTSGlobalVariables("NextNumber").Value = number
GetName = file
End Function
I've used this script before in another dts-package where the
file-name needs to be based up-on the date and it worked just fine.
You can find the script at:
http://groups.google.be/groups?hl=n...l e.com#link10
I hope anyone can help me.
thanx in advance
Piedro
PS I've my english is crap it's because it ain't my mothertongue."Piedro" <pproost@.hotmail.com> wrote in message
news:b7e3650a.0309231319.7d8d0ffa@.posting.google.c om...
> Hi y'all
> I'm having some trouble with the following script I use in a
> dts-package. I use it to automatically import a dat-file of which the
> name changes every day. Today the name f.e. is P0000020.dat, tomorrow
> it's P0000021.dat and the day after P0000022.dat etc etc The error I
> get is end of instruction expected.
> This is the script:
> '************************************************* *********************
> ' Visual Basic ActiveX Script
> '************************************************* ***********************
> Function Main()
> Dim oPkg, oDataPump
> Dim sSourceTable, sDestinationTable
> ' Derive the new table names
> sSourceTable ="" & GetName
> sDestinationTable = sSourceTable
> ' Get reference to the DataPump Task
> Set oPkg = DTSGlobalVariables.Parent
> Set oDataPump = oPkg.Tasks("DTSTask_DTSDataPumpTask_1").CustomTask
> ' Set the new values
> oDataPump.SourceObjectName = sSourceTable
> oDataPump.DestinationObjectName = "[Test].[test].[tblXafaxOutput]"
> ' Clean Up
> Set oDataPump = Nothing
> Set oPkg = Nothing
> Main = DTSTaskExecResult_Success
> End Function
> Function GetName
> Dim number, counter, file
> counter = 1
> number = DTSGlobalVariables("NextNumber").Value
> number = number + 1
> For counter = 1 To 7 - Len(number)
> file = file & "O"
> Next teller
> file = "P" & file & getal & ".dat"
> DTSGlobalVariables("NextNumber").Value = number
> GetName = file
> End Function
>
> I've used this script before in another dts-package where the
> file-name needs to be based up-on the date and it worked just fine.
> You can find the script at:
http://groups.google.be/groups?hl=n...l e.com#link10
> I hope anyone can help me.
> thanx in advance
> Piedro
>
> PS I've my english is crap it's because it ain't my mothertongue.
The message you get is probably because of the For .. Next loop. In
VBScript, you can't put the counter variable name after Next (as you would
in VB):
For x = 1 To 10
' Do something
Next ' This is OK
For x = 1 To 10
' Do something
Next x ' This is wrong
Simon