Look inside your SQL Server files with SQL File Explorer.
"Sivla" <sivla36@nethere.com> wrote in message
news:uTvHh4ZMEHA.3380@TK2MSFTNGP11.phx.gbl...
> I have a message box on the first line of my dts script
> that should display the value that i am passing from the command prompt it
> is blank.
> below is my command line in put why cant i display my global variable.
>
> dtsrun /S "TROY" /U "sa" /P "emachine" /N "FileTransfer" /A
Dtinput:typeid=8
> "Data1"
>
>
> here is my script
>
> '**********************************************************************
> ' Visual Basic ActiveX Script
> '************************************************************************
>
> Function Main()
> msgbox DTSGlobalVariables("Dtinput").Value
>
> Select case DTSGlobalVariables("Dtinput").Value
>
>
>
> Case "Data1"
> dim oFSO
> dim x
> dim mySourceConn
> dim mySourceRecordset
>
> ' instantiate the Scripting Object
> set oFSO = CreateObject("Scripting.FileSystemObject")
>
> ' Open the file
> set x = oFSO.OpenTextFile("C:\Files\data1.txt")
>
> ' store the first line, which is the Start Date, in a global variable
> DTSGlobalVariables("txtInput").Value = x.Readall
> MsgBox "This files reads: " & DTSGlobalVariables("txtInput").Value
>
> ' Instantiate the ADO objects.
> set mySourceConn = CreateObject("ADODB.Connection")
> set mySourceRecordset = CreateObject("ADODB.Recordset")
> mySourceConn.Open = "Provider=SQLOLEDB.1;Password=emachine;Persist
> Security Info=True;User ID=sa;Initial Catalog=FileLog;Data Source=TROY"
> mySQLCmdText = "INSERT INTO FileData (FileData) VALUES ('" &
> DTSGlobalVariables("txtInput").Value & "')"
> 'Execute the mySQLCmdText, and put the data into the myRecordset object.
> mySourceRecordset.Open mySQLCmdText, mySourceConn, adOpenKeyset
> x.Close
> set oFSO = nothing
> set x = nothing
> set mySourceConn = nothing
> set mySourceRecordset = nothing
>
> Case "Data2"
>
> dim oFSO2
> dim x2
> dim mySourceConn2
> dim mySourceRecordset2
> ' instantiate the Scripting Object
> set oFSO2 = CreateObject("Scripting.FileSystemObject")
>
> ' Open the file
> set x2 = oFSO.OpenTextFile("C:\Files\data2.txt")
>
> ' store the first line, which is the Start Date, in a global variable
> DTSGlobalVariables("txtInput").Value = x.Readall
> MsgBox "This files reads: " & DTSGlobalVariables("txtInput").Value
>
> ' Instantiate the ADO objects.
> set mySourceConn2 = CreateObject("ADODB.Connection")
> set mySourceRecordset2= CreateObject("ADODB.Recordset")
> mySourceConn2.Open = "Provider=SQLOLEDB.1;Password=emachine;Persist
> Security Info=True;User ID=sa;Initial Catalog=FileLog;Data Source=TROY"
> mySQLCmdText = "INSERT INTO FileData (FileData) VALUES ('" &
> DTSGlobalVariables("txtInput").Value & "')"
> 'Execute the mySQLCmdText, and put the data into the myRecordset object.
> mySourceRecordset.Open mySQLCmdText, mySourceConn, adOpenKeyset
> x2.Close
> set oFSO2 = nothing
> set x2 = nothing
> set mySourceConn2 = nothing
> set mySourceRecordset2 = nothing
>
>
> end select
>
>
>
>
> Main = DTSTaskExecResult_Success
> End Function
>
>
>
>
>
> "Dan Guzman" <danguzman@nospam-earthlink.net> wrote in message
> news:uayJzFRMEHA.128@TK2MSFTNGP09.phx.gbl...
> > You can execute your VBScript from a DTS package ActiveX Script Task.
> > Global variables can be accessed from within your script using the
> > DTSGlobalVariables collection (e.g.
DTSGlobalVariables("FilePath").Value).
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > "Sivla" <sivla36@nethere.com> wrote in message
> > news:uV5pDDNMEHA.1032@tk2msftngp13.phx.gbl...
> > > I have fixed my problem i was putting <> around the server name.
> > > now my dts runs fine but the VB script that i wrote does not execute
how
> > do
> > > i get my DTS package to run my vb Script thanks
> > > "Sivla" <sivla36@nethere.com> wrote in message
> > > news:ewiqM7MMEHA.2584@TK2MSFTNGP12.phx.gbl...
> > > > i have followed the instructions that you have provided me but i am
> > > getting
> > > > an error specified server not found. i am testing this on the local
> > > machine
> > > > so the server is running
> > > > here is my dtsrun ececution
> > > >
> > > > dtsrun /S "<TROY>" /U "sa" /P "emachine" /N "FileTransfer" /A
> > > > Datainput:Typeid=8 "Data1"
> > > >
> > > >
> > > >
> > > > "Dan Guzman" <danguzman@nospam-earthlink.net> wrote in message
> > > > news:OK4dioEMEHA.1340@TK2MSFTNGP12.phx.gbl...
> > > > > You can create DTS package global variables from the DTS Package
> > > designer
> > > > > under the Global Variables tab in package properties. In SQL
2000,
> > you
> > > > can
> > > > > use a Dynamic Properties task to assign global variable values to
> > > specific
> > > > > properties.
> > > > >
> > > > > It's a good practice to use global variables for properties that
may
> > > > change
> > > > > between packages executions, such as file locations and server
> names.
> > > > >
> > > > > --
> > > > > Hope this helps.
> > > > >
> > > > > Dan Guzman
> > > > > SQL Server MVP
> > > > >
> > > > > "Sivla" <sivla36@nethere.com> wrote in message
> > > > > news:uSCmjEBMEHA.3696@TK2MSFTNGP09.phx.gbl...
> > > > > > where do i create the globle variable?
> > > > > > thanks for your help
> > > > > > "Barry McAuslin" <barry_mcauslin@yahoo.com.nospam> wrote in
> message
> > > > > > news:e0WT9u0LEHA.2976@TK2MSFTNGP10.phx.gbl...
> > > > > > > Create a global variable called "FilePath"
> > > > > > >
> > > > > > > use "/A FilePath:typeid=8 C:\....." as an command line option.
> > > > > > > see dtsrun in BOL
> > > > > > >
> > > > > > > Use VBScript in the DTS package like this. (pseudo code)
> > > > > > >
> > > > > > > DTSGlobalVariables.Parent.Connections("ImportFile").DataSource
=
> > > > > > > DTSGlobalVariables("FilePath").Value
> > > > > > >
> > > > > > > HTH
> > > > > > >
> > > > > > > ----------
> > > > > > >
> > > > > > > Barry McAuslin
> > > > > > >
> > > > > > > Look inside your SQL Server files with SQL File Explorer.
> > > > > > > Go to
http://www.sqlfe.com for more information.
> > > > > > >
> > > > > > > "Sivla" <sivla36@nethere.com> wrote in message
> > > > > > > news:%23NZ8xH0LEHA.2396@TK2MSFTNGP12.phx.gbl...
> > > > > > > > I need to run a dts package from a command line that accepts
a
> > > > > > parameter.
> > > > > > > > then opens a text file on my c: \files folder and reads the
> > > contents
> > > > > of
> > > > > > > the