How Do I Create A Job To Execute Several DTS Packages ?

May 22, 2001

Hi,

I'm using SQL 7.0 SP2 on NT SP6a and have a quick question.
I want to create a scheduled job to execute several DTS packages (all located on the same server). I can use Enterprise Manager to schedule an individual package but the command line of the step has something like:

DTSRun /~S 0x26CE410E3EFF5E8B738DC1C3527EEA1A /~N 0xCAAF8584582AA98C09F5CF132CB0BB5F296D1E9053DD6526 717A53AD4134C3463615FEF20330386927242B6CB7070036 /E

Is using the DTSRUN utility the only way to create several steps in a job to run DTS packages ?

Any help appreciated.

Thanks,

Tim

View 1 Replies


ADVERTISEMENT

Integration Services :: Remotely Execute Packages On SSIS Server - Packages Are Deployed In File System

Apr 22, 2015

We manage some SSIS servers, which has only SSIS and SSIS tools installed on them and not the sql server DB.

SSIS packages and configuration files are deployed on a NAS. We run the SSIS packages through DTEXEC by logging in to the server.

We want to allow developers to run their packages on their own on the server, but at the same time we dont want to give them physical access on the server i.e we do not want to add them into RDP users list on server properties. We want them to allow running their packages remotely on the server.

One way We could think of is by using powershell remoting and we are working on that. But is there any other way or any tool already present for the same.

View 4 Replies View Related

Execute DTS Packages

Sep 12, 2007

I have couple of DTS Packages that I want to run on the server running SQL Server 2000, how do I go about running those? Any help will be greatly appreciated.

View 2 Replies View Related

Execute DTS Packages

Jul 23, 2005

I have created a functioning DTS package inside Enterprise Manager andnow I want to be able to execute it outside of EM. The package importsdata from an SQL dbase to a Visual FoxPro dbase. I would like this DTSpackage to execute everytime an Insert(of certain critera) is made onthe SQL dbase. I am thinking that using an Insert Trigger on the SQLtable is the way to go about this. I am seeking advice as to... is thisthe best way to go about this.Also, and if so, in a trigger which route is the best to take...1. use dtsrun command line utility or2. setup a COM object to run the DTS packageI have tried both in SQL query analyzer and am having troubles with thesyntax. Could anyone possibly send the code for both ways. Thanks.Good Day to all,Brett

View 10 Replies View Related

Execute Several Packages With C#

Sep 10, 2007

Does anybody have feedback on how to execute several packages using c#.

Thanks Sergio

View 1 Replies View Related

Cannot Execute Job With Multiple Packages

Mar 28, 2008

I have a schedule job that errors out on the first step when I attempt to run it. There are 3 packages that I created and I can run them all manually just fine.

I get this error when I try to run the job:
-----------------------------------------------


Date,Source,Severity,Step ID,Server,Job Name,Step Name,Notifications,Message,Duration,Sql Severity,
Sql Message ID,Operator Emailed,Operator Net sent,Operator Paged,Retries Attempted

03/28/2008 13:49:22,ST Customer Data,Error,0,Server01,ST Customer Data,(Job outcome),,The job failed.

The Job was invoked by User sa.

The last step to run was step 1 (config 1).

The job was requested to start at step 1 (config 1).,00:00:01,0,0,,,,0


03/28/2008 13:49:22,ST Customer Data,Error,1,Server01,ST Customer Data,config 1,,

Executed as user: Server01SYSTEM. ...9.00.3042.00 for 32-bit

Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

Started: 1:49:23 PM Error: 2008-03-28 13:49:23.23
Code: 0xC0016016 Source:

Description: Failed to decrypt protected XML node "DTS:Password" with

error 0x8009000B "Key not valid for use in specified state.".

You may not be authorized to access this information.

This error occurs when there is a cryptographic error.
Verify that the correct key is available. End Error

Error: 2008-03-28 13:49:23.57 Code: 0xC0202009
Source: Config 1 Customer Data Connection manager "SourceConnectionOLEDB"
Description: SSIS Error Code DTS_E_OLEDBERROR.

An OLE DB error has occurred. Error code: 0x80040E4D.
An OLE DB record is available.
Source: "Microsoft SQL Native Client" Hresult: 0x80040E4D
Description: "Communication link failure".

An OLE DB record is available.
Source: "Microsoft SQL Native Client"
Hresult: 0x80...
The package execution fa...
The step failed.,00:00:01,0,0,,,,0

-----------------------------------------------


Any ideas?

Thanks,

John

View 2 Replies View Related

Error When Execute The Packages

Sep 13, 2007


All,

Could someone please tell me what to do with it and what might be causing it?
The packages were fine yesterday.

Here is the error message:

[Script Component 1 1 [3941]] Error: System.Runtime.InteropServices.COMException (0x80040154):
Retrieving the COM class factory for component with CLSID {A138CF39-2CAE-42C2-ADB3-022658D79F2F}
failed due to the following error:
80040154. at Microsoft.VisualBasic.Vsa.VsaEngine.CreateEngine()
at Microsoft.VisualBasic.Vsa.VsaEngine.CheckEngine()
at Microsoft.VisualBasic.Vsa.VsaEngine.set_RootMoniker(String value)
at Microsoft.SqlServer.VSAHosting.Runtime.CreateVsaEngine()
at Microsoft.SqlServer.Dts.Pipeline.ScriptRuntime..ctor(String projectName,
String moniker, String language, Boolean showErrorUI)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.CreateUserComponent()


Thanks in Advance

View 1 Replies View Related

Execute SSIS Packages From Vb.net

Nov 8, 2007

Hi!

I was following this article http://www.codeproject.com/useritems/Execute_Package_by_C_.asp to execute list of SSIS packages via vb.net. I created a windows application in server A copied the exe file in server B. the SSIS package is in server B. I deployed the package and it runs file vis integration server. below are my codes. everytime i run the exe in server B. I can see the list of packages but when i hit execute button i get error msgs that says "failure" I am not sure how to get more error out of it. I am not sure whats causing this error.
----------------------------

Imports System.Data.SqlTypes

Imports System.Data.SqlClient

Imports Microsoft.SqlServer.Management.Smo

Imports Microsoft.SqlServer.Management.Smo.Agent

Imports Microsoft.SqlServer.Dts.Runtime

Imports Microsoft.SqlServer.Management.Common

Public Class Form1

Dim app As New Microsoft.SqlServer.Dts.Runtime.Application()

Dim pInfos As PackageInfos = app.GetPackageInfos("\", "SQLKEV", "", "")



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

For Each pInfo As PackageInfo In pInfos

If pInfo.Name <> "Maintenance Plans" Then

ComboBox1.Items.Add(pInfo.Name)

End If

Next

End Sub



Private Sub btnExec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExec.Click

Dim app As Microsoft.SqlServer.Dts.Runtime.Application

app = New Microsoft.SqlServer.Dts.Runtime.Application()

Dim pkgResults_Sql As DTSExecResult

Dim pkgIn As New Package()

Try



pkgIn = app.LoadFromSqlServer("" + ComboBox1.SelectedItem.ToString().Trim(), "SQLKEV", "", "", Nothing)

pkgIn.PackagePassword = "password21"

pkgResults_Sql = pkgIn.Execute()

MessageBox.Show(pkgResults_Sql.ToString())

Catch ex As Exception

MsgBox("this is an exception" + ex.ToString)

End Try

End Sub



End Class
----------------------------



please help

View 9 Replies View Related

DTS Scheduled Packages Using Execute SQL Task

Jun 20, 2001

I have SQLServer 7, and have used Enterprise Manager to schedule local packages. The package that I'm trying to do is run a SQL script on a nightly basis. The problem that I'm having is that I need to be able to install the scheduled script customer box using an installer. I have access to execute command line programs in the installer. Do anyone know if you can schedule local packages (using SQL Scripts) from the command line? Or if a 3rd party application can do this. Any help or direction would be greatly appreciated. I've tried to use sp_add_job and sp_add_jobschedule, but haven't been able to get them to work.

Thanks
Brian

View 1 Replies View Related

Stored Procedure To Execute DTS Packages

Apr 26, 2004

Hi, hoping someone may be able to shed some light on this.

I have a stored procedure that conditionally executes different DTS Packages. Everything seems to work, there's no errors at all, but the DTS Packages are never executed. Wondering if anyone has any ideas.

Here's the stored procedure....

CREATE PROCEDURE exportLists
AS

DECLARE @script VARCHAR(8000)
DECLARE @id INT
DECLARE @max INT

select regionid,count(distinct homephone) as phone
into #phone
from tbl_template
Where exportid is null
group by regionid

select officeid,listpath
into #office
from tbl_office
WHERE startdate <= GETDATE()
AND (enddate >= GETDATE() OR enddate IS NULL)
and listpath is not null
and listpath <> ''

Select case when phone > 2500 then '"exportLists" /A MDBFile="' + listpath + '" /A OfficeID ="' + convert(varchar(10),officeid) + '" '
Else '"resetTemplate" /A OfficeID="' + convert(varchar(10),officeid) + '" '
end as cmd
,Identity(int,1,1) as rowno
,phone
into #temp
from #office as O
inner Join #phone as p
on o.officeid=p.regionid

Set @max=@@rowcount
set @id = 1

While @id <=@max
Begin
Select @script='"Dtsrun /S "' + @@SERVERNAME + '" /E /N ' + cmd
+ case when phone > 2500
then '/A ExportID="' + convert(varchar(10),(Select coalesce(Max(listid),0) + 1 from tbl_sf3Lists)) + '" '
else ' ' end
, @id=@id+1
from #temp
Where rowno = @id
End

Return
GO

View 1 Replies View Related

SSIS Packages Validating Before Execute

Feb 18, 2008

Hi

I have an SSIS package that wont run whne i try to run it in one go, but if i run it step by step it will succeed
as the reason its failing is in the 2nd step it references a table that doesn't exist (its created in the 1st step.

So at the start package is trying to validate, but it won't as the table is created in step 1.

So this is why it works if i execute this step by step, is there a way of turning off the pre run validation
on SSIS scripts ?

Thanks

View 1 Replies View Related

Child Packages: Execute Them All Out Of Process?

Nov 30, 2006

HI, I have some parent parent packages that calls child packages. When I added a bunch of packages, I faced the buffer out of memory error. I then decided to set the child packages property ExecuteOutOfProcess to TRUE. I noticed that the execution time is longer now. Is this a good practice to set the ExecuteOutOfProcess to true? If so, is it normal that the execution time is longer?

Thank you,
Ccote

View 2 Replies View Related

Urgent! DTS Packages Won&#39;t Execute Correctly When Scheduled

Dec 29, 1999

Please help,

I have a DTS package that consist of approximately 50 steps which pulls data from an as400 and populates a SQL 7.0 database. The package works perfect flawlessly when executed manually but won't run when scheduled.

The DTS package starts but hangs when it tries to connect to the as400, this is where the problem lies. The preceeding steps work fine but they execute against the SQL 7.0 database. I have client access installed on the server and configured. I checked and made sure the SQL server agent service was started and running also,I just can't figure why it works fine manually,but not when scheduled.

Any help would be welcome...

View 2 Replies View Related

Walkthrough To Execute SSIS Packages Via Web Service

Aug 17, 2007

I am seeking a walkthrough for executing packages via a web service. All I have found so far are fragmented bits of information. This article is a good start but it leaves out some critical security setting information. http://msdn2.microsoft.com/en-us/library/ms403355.aspx#service.

Does anyone know of a good walkthrough that includes the security setup: Impersonation, Proxies, etc.?

View 6 Replies View Related

Best Practices Question - How Do You Execute Multiple Packages?

Jan 26, 2006

I have 200+ plus packages that need to be flexible in how they are run. For example, an end user may choose to run packages 1,2,3 and the next end user may choose to run packages 2,3,7, etc. Prior ro running a package, I set an "instance id" inside the group of packages so I can tie them all together in the logfile - I know that packages 1,2,3 were all run as group and that's distinct from packages 2,3,7 that were run in a differnt group.

Initially I embarked on a scenario where I had a queue table that loaded up the packages to be run and then had a little c# app that read the queue, generated the "instance id" and ran all the packages (either thru dtexec.exe or the Microsoft.SqlServer.DTS.Runtime). But now I wonder if using a master package that uses the Execute Package Task is the way to go. My 200+ packages are all independent and run based on a single config file and it seems as though going the parent package route will destroy some of that independence because I'll now be relying on parent package variables.

Any comments or suggestions?

View 2 Replies View Related

For SSIS Dev Team: Is It Possible To Execute Packages Asynchronously?

Mar 28, 2007

Question is in the subject.



The reason I'm asking is because I want a workaround to a problem that a guy is having here:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1404349&SiteID=1



-Jamie

View 1 Replies View Related

Integration Services :: Execute Many Packages From One Master Package?

May 4, 2015

I have 12 packages to execute in order. I made a table in my DB where i mentioned the name of each package and his order in execution.

I want to create a master package that get the name and order from my DB table to execute all packages.

View 3 Replies View Related

Integration Services :: How To Execute Multiple Packages In Parallel

Oct 14, 2008

I'm pretty new to SSIS but I've managed to cobble together a number of individual packages to refresh SQL tables from a 3rd-party database.
 
Now, what I'd like to do is have a single package that I can use to invoke each of the individual ones. Since it will run on a quad, I'd like to invoke them such they'll run in parallel.

View 2 Replies View Related

Integration Services :: Catalog - Execute Packages Stored

Oct 27, 2015

I have 100 packages all of them stored in "Integration services catalog". Is there a way to execute packages using script task in ssis 2012.

View 5 Replies View Related

Dynamically Execute Child Packages Using A Script Task

May 27, 2008

I've been executing a package and passing a parent variable to the child using package configurations but I'd now like to do this using a script task. The script task would then programmatically load the package and execute it.



How do I do this and still use the parent variable?



I've found examples of how to load a package but I haven't been able to find out how to I load it specifying the parent variables.



I think it's possible. MSDN shows the available methods but the example is for the base method.

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.package.execute.aspx



Cheers,

Ben

View 1 Replies View Related

How Do I Do A Minimal Client Tool Install To Execute SSIS Packages

Jun 15, 2006

I am trying to migrate our processing from command line based scripts and foxpro to SQL so I need to run the SSIS packages using dtexec. I copied the dtexec file and a few dll's that are missing to our production servers but i cant execute the packages. I dont want to install the full client tools (particularly managment/business inteligence studio) on our production servers due to the overhead and limited system disk space.

Can somebody tell me what the minimum install would be so I would be able to run SSIS packages using the dtexec or dtexecui tools? I would also like to install some of the other command line client tools like osql etc.

View 8 Replies View Related

Unable To Execute Multiple SSIS Packages From Windows Service

Aug 28, 2007

Need some help...
When we tried to run mulitple packages one after the other from a windows service, first one succeeds but later ones are throwing below error :
"The script threw an exception: The element cannot be found in a collection. This error happens when you try to retrieve an element from a collection on a container during execution of the package and the element is not there.
A deadlock was detected while trying to lock variable "System:ackageName, User::BusinessDate, User::Environment, User:ortfolioName" for read access. A lock could not be acquired after 16 attempts and timed out."

Later, we tried to create separate AppDomains for each package and execute via console application, but ended up with below error (The below expressions were defined in OnError Event) :
"The result of the expression "@[User::ReportErrorFrom]" on property "FromLine" cannot be written to the property. The expression was evaluated, but cannot be set on the property.
The result of the expression ""Error At :" + @[System:ourceName] + "" +
"Error Description : "+ @[System::ErrorDescription] + "" " on property "MessageSource" cannot be written to the property. The expression was evaluated, but cannot be set on the property."

At last, we tried to span a separate process (System.Diagnostics.Process) for each package. this seems working but taking very long time:
A package that normally takes 2 min, is taking 60 min.

We also tried creating an SSIS Package that executes mulitple packages. But only first package is getting executed, and second one is throwing below error (Here the variable it is trying to lock is of first package):
"Failed to lock variable "UniqueInstrumentsQuery1" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

Please help us with some work around for this. Thanking you in advance,

View 17 Replies View Related

Integration Services :: How To Run All SSIS Packages In A Folder Using Execute Package Task

Jun 26, 2015

I have created for each container to call all the packages in a folder like below, also created a variable.

Then I add execute package task inside of foreach container and selected file system in a location and in connection called currently creating package name finally in connection properties i added variable in expression which i created and mapped into for each loop container. I referred below link 

[URL] ....

All the packages are running but its not ending once all the packages executed its re run and continue the running process, how to stop once all the packages execute. 

View 24 Replies View Related

Integration Services :: SSIS Execute Multiple Packages Based On Conditional Split

Sep 4, 2015

We are building a dataload application where parameters are store in a table. And there are multiple packages for each load.There is a column IsChecked column if it is 1 then only the child package should execute.Created a master package. In which i have taken execute SQL task in that storing a results in variable and based on the result the child package should execute. But In executesql task i selected result set as full result set.  I am getting the below error.

[Execute SQL Task] Error: Executing the query "SELECT  isnull(ID ,0) AS ID FROM DataLoadParameter..." failed with the following error: "The type of the value (DBNull) being assigned to variable "User::LoadValue" differs from the current variable type (Int32). Variables may not change type during execution. Variable types are strict, except for variables of type Object.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

View 3 Replies View Related

Execute A Stored Procedure Which Calls SSIS Packages Using A Proxy Account For Non Sysadmins In Sql Server 2005

Sep 18, 2007



Hi all,
I have a problem while i create a proxy account.The situation is like this...There is a user who has an login in to the server.He has a stored procedure which calls some on the SSIS packages and XP_cmdshell...so this stored procedure basically load some data in to the tables .So for the login in order to execute the stored procedure as he is not a Sys admin I have created a proxy account in my account as Iam an SA and then in the proxies and in principals I selected his login name and this way I have created a credential and a proxy account.

Now the problem is if he logins with his id and password and try to execute the stored procedure it gives an error message

Server: Msg 15153, Level 16, State 1, Procedure xp_cmdshell, Line 1
The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.


....so this mean the login is not able to see the proxy account.So what I did is I created a job and then in the job owner tab I have selected his login and then created a step with the type operating system (CmdExec) as I need to just execute the stored procedure and used the proxy account that I have created.

so I gave the command -- exec <stored procedure> --.
But this job fails and gives the error message as
[298] SQLServer Error: 536, Invalid length parameter passed to the SUBSTRING function. [SQLSTATE 42000]....

So now ....first My question is am I doing in a right way....if its right then why Iam not able to execute the stored procedure.

If there is any other way through which I can execute the stored procedure using a proxy account for the logins who are not sys admins....please do let me know.....

Thanks
Raja.V

View 2 Replies View Related

How To Create Master - Child Packages?

Apr 11, 2008



I have around 10 packages for dim and fact Table load. Using deployment Utility i create setup and put the packages in to test environment.
Now my requirement is call all the packages in certain order from single package. Using Execute Package Task i could call only one package. how to achive this in deployment?


Thanks
Sam K

View 3 Replies View Related

How To Create Dynamic Folder Which Contains All The Files Which Are Used By All The Packages In A Project

Mar 19, 2008

Hi,
My Problem goes Like this....

I have a folder which contains all the flat files which are used by all the packages(ex--flat file connection managers) in my project.
If we want to change the name of the folder,have to change in every package( in all connection managers) manually.It looks hardcoding and timetaking.

Is there any way to change in one place(xml,file,variable) so that it should be affected in all the packages.

one more doubt is..

If we configure the flat file connection manager in package configurations,configuration file (ex-xml)will be created (we can make changes in that file regarding that connecion mgr only.)

But i want one configuration file (ex--xml) so that i should configure the details of all the connection managers used in all packages.

View 5 Replies View Related

Unable To Edit Or Create SSIS Packages Or Maintenance Plans

Oct 30, 2007

Hi,

I am running SQL 2005 Enterprise with SP2. In the past I have been able to successfully create SSIS packages using the BIDS and also Maintenance Plans from within Management Studio.

Today I tried to edit a maintenance plan and got the following error message:-

TITLE: Microsoft SQL Server Management Studio
------------------------------
Retrieving the COM class factory for component with CLSID {0BE35203-8F91-11CE-9DE3-00AA004BB851} failed due to the following error: 80040154. (Microsoft.DataWarehouse)
------------------------------
BUTTONS:
OK
------------------------------

This error also occurs if I try to create a new Maintenance Plan.

I then tried opening an existing SSIS package in BIDS and got the following error:-

------------------------------------------------------------------------------------------
Microsoft Visual Studio is unable to load this document
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
------------------------------------------------------------------------------------------

These errors only occur on my PC so I know that the problem is with my PC. I have totally uninstalled SQL 2005 components from my PC and reinstalled them with no luck.

To my knowledge, I haven't installed any other programs since creating these packages, although there's a possiblilty my PC may have had some patches applied through SMS.

I am running Windows 2000 Professional.

Can anyone help me resolve this problem?

Thanks.

Martin

View 6 Replies View Related

Unable To Create A SSIS Deployment Utility For A Solution Which Are Having 2 Packages

Dec 28, 2007

Hi All,

I have created a solution which contains only 2 packages say Package1.dtsx and Pakage2.dtsx. I want to create a deployment utility to deploy onto other developers machince. I changed the project properties "CreateDeploymentUtility" to TRUE. When I do the build it is not creating the files in "Deployment" folder. It is saying Rebuild All Failed but the error is not showing.

For more information the 2 packages have 4 indirect configurations from environment variables which are storing the actual config file path.

Am I missing something here?

Thanks.
Venkat.

View 8 Replies View Related

Create And Execute Trigger In C#

May 31, 2008

Hi all
I've Created a Trigger statement and tried to execute this using ExecuteNonQuery.but it shows the following error

Incorrect syntax near 'GO'.
'CREATE TRIGGER' must be the first statement in a query batch.

if i start with Create Trigger statement it show "Incorrect Syntax near Create Trigger".

the following is the trigger statement which i've generated in C#
Can anyone help me?

thanks in advance
sri


IF EXISTS (SELECT name FROM sysobjects WHERE name = 'SampleTrigger' AND type = 'TR')
DROP TRIGGER SampleTrigger
GO
CREATE TRIGGER SampleTrigger
ON dbo.sample
AFTER INSERT
AS begin
SET NOCOUNT ON
DECLARE @RID as int
DECLARE @email AS nvarchar(50)
SELECT @email= i.email from inserted i
DECLARE @Name AS nvarchar(50)
SELECT @Name= i.Name from inserted i
DECLARE @Address AS nvarchar(50)
SELECT @Address= i.Address from inserted i
insert into Register(ServerName,DatabaseName,TableName) values('Sample','SamDatabase','SamTable')
SELECT @RID = @@Identity
insert into TableFields(RID,FieldName,FieldValue) values(@RID ,'Name',@Name)
insert into TableFields(RID,FieldName,FieldValue) values(@RID ,'Address',@Address)
insert into TableFields(RID,FieldName,FieldValue) values(@RID ,'email',@email)
end

View 1 Replies View Related

Execute Create Table Command From Asp.net

Jul 25, 2006

I have a little application that I have designed where I need to be able to execute create table and create function comands against the database.
It seems that it does not like my sql file. Does anyone know of a different method of doing this?
 
Error message
Line 2: Incorrect syntax near 'GO'.
Line 4: Incorrect syntax near 'GO'.
Line 8: Incorrect syntax near 'GO'.
'CREATE FUNCTION' must be the first statement in a query batch.
Must declare the variable '@usb'.
Must declare the variable '@usb'.
Must declare the variable '@i'.
A RETURN statement with a return value cannot be used in this context.
Line 89: Incorrect syntax near 'GO'.
Line 91: Incorrect syntax near 'GO'.
Line 94: Incorrect syntax near 'GO'.
 
Protected Sub Install()
   Dim err As String = ""
While err.Length < 1
'      Dim your StreamReader
      Dim TextFileStream As System.IO.TextReader
      'Load the textfile into the stream
      TextFileStream = System.IO.File.OpenText(Request.PhysicalApplicationPath & "Scripts.sql")
      'Read to the end of the file into a String variable.
      executesql(TextFileStream.ReadToEnd, err)
 
      err = "Susscessful"
End While
If err = "Susscessful" Then
      Response.Redirect("Default.aspx")
Else
      Me.lblError.Text = err
End If
End Sub
Private Function executesql(ByVal s As String, ByRef err As String) As Boolean
Try
      Dim conn As New Data.SqlClient.SqlConnection(GenConString())
      Dim cmd As New Data.SqlClient.SqlCommand(s, conn)
      conn.Open()
      cmd.ExecuteNonQuery()
      conn.Close()
      Return True
   Catch ex As Exception
      err = ex.Message.ToString
      Return False
   End Try
End Function


Example sql file
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MyFunc]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[MyFunc]
GO
CREATE FUNCTION [dbo].[MyFunc]
(
-- Add the parameters for the function here

)
RETURNS varchar(1000)
AS
BEGIN
-- Declare the return variable here
DECLARE @Result varchar(1000)
-- Add the T-SQL statements to compute the return value here
-- Do something here
-- Return the result of the function
RETURN @Result
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

View 1 Replies View Related

How Do I Create A SQL Server Job To Execute A .exe File?

Jun 10, 1999

I am having trouble getting a job step to execute an executable file. One of the options for a job step is to enter an operating system command. I have tried entering the following operating system command to execute a file:

'start c:myfile.exe'

For some reason this doesn't work. How can I get SQL Server to execute an executable file?

View 3 Replies View Related

Execute Scripts To Create Tables

Sep 20, 2007

Hi
I am supposed to execute the script provided to create tables in a database...but I am not getting it from where I run those scripts ?

The script has commands to create tables...


From where do i execute those ?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved