Showing posts with label multiple. Show all posts
Showing posts with label multiple. Show all posts

Friday, March 30, 2012

Running an SSRS 2005 report against a stored procedure with multiple

Hi, I'm looking to confirm what I suspect - that if I have a single
stored procedure that returns 2 results, I can only "design" against the
first result in the designer.
I realize that I can create multiple data sources, and call the stored
proc twice with a parameter to indicate which of the 2 results to return
- I just want to verify that you CAN'T create a single data source that
calls a stored proc that returns two (or more) results, and then try to
design the report against both results.
Thanks,
KevinRS can only use one dataset from a stored procedure.
"Kevin" wrote:
> Hi, I'm looking to confirm what I suspect - that if I have a single
> stored procedure that returns 2 results, I can only "design" against the
> first result in the designer.
> I realize that I can create multiple data sources, and call the stored
> proc twice with a parameter to indicate which of the 2 results to return
> - I just want to verify that you CAN'T create a single data source that
> calls a stored proc that returns two (or more) results, and then try to
> design the report against both results.
> Thanks,
> Kevin
>

Wednesday, March 28, 2012

Running a report against multiple databases

We have multiple databases on the same server. When I publish a report to
the Report Server how do I point to the database I want to run the report
against?If you use Report Manager, click on the property tab for the report and then
on the Data Source sub-tab. From here you can enter in all necessary
connection information.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Doni G" <DoniG@.discussions.microsoft.com> wrote in message
news:81C1CFCE-7A33-4A3D-AB30-5430EA3EA628@.microsoft.com...
> We have multiple databases on the same server. When I publish a report to
> the Report Server how do I point to the database I want to run the report
> against?

Friday, March 23, 2012

Running .Sql Files in a batch

Hi,
I have got multiple .sql files(text files) having T-SQL Statements. I want
to run them all together from query analyzer...how can i do that...
Your help will be appreciatedhI
Let me say you have a file as
Use Pubs
GO
CREATE PROCEDURE spMyProc
AS
SELECT * FROM Titles
--Run this command in QA
EXEC master..xp_cmdshell 'osql.exe -S SERVERNAME -U sa -P pass -i
"D:\ORD1.sql"'
"kailux4" <kailux4@.discussions.microsoft.com> wrote in message
news:067CC39F-41E2-4170-B132-927FDB458C9C@.microsoft.com...
> Hi,
> I have got multiple .sql files(text files) having T-SQL Statements. I want
> to run them all together from query analyzer...how can i do that...
> Your help will be appreciated|||"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eS%23FL1oaFHA.2900@.TK2MSFTNGP15.phx.gbl...
> hI
> Let me say you have a file as
> Use Pubs
> GO
> CREATE PROCEDURE spMyProc
> AS
> SELECT * FROM Titles
> --Run this command in QA
> EXEC master..xp_cmdshell 'osql.exe -S SERVERNAME -U sa -P pass -i
> "D:\ORD1.sql"'
But bear in mind that "D:\" is a drive on the __server__, not on the client.
Regards
Wojtek|||"kailux4" <kailux4@.discussions.microsoft.com> wrote in message
news:067CC39F-41E2-4170-B132-927FDB458C9C@.microsoft.com...
> Hi,
> I have got multiple .sql files(text files) having T-SQL Statements. I want
> to run them all together from query analyzer...how can i do that...
> Your help will be appreciated
Why from QA? Why not write a batch and use isql.exe within?
Regards
Wojtek|||Hi,
I recommend you to run the .SQL files from command prompt using OSQL
redirecting the output to a log file.
OSQL -SSERVER_NAME -Uuser -Ppassword -d db_name -i file_name.sql >
output.log
OSQL -SSERVER_NAME -Uuser -Ppassword -d db_name -i file_name1.sql >>
output.log
OSQL -SSERVER_NAME -Uuser -Ppassword -d db_name -i file_name2.sql >>
output.log
Thanks
Hari
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eS%23FL1oaFHA.2900@.TK2MSFTNGP15.phx.gbl...
> hI
> Let me say you have a file as
> Use Pubs
> GO
> CREATE PROCEDURE spMyProc
> AS
> SELECT * FROM Titles
> --Run this command in QA
> EXEC master..xp_cmdshell 'osql.exe -S SERVERNAME -U sa -P pass -i
> "D:\ORD1.sql"'
>
> "kailux4" <kailux4@.discussions.microsoft.com> wrote in message
> news:067CC39F-41E2-4170-B132-927FDB458C9C@.microsoft.com...
>> Hi,
>> I have got multiple .sql files(text files) having T-SQL Statements. I
>> want
>> to run them all together from query analyzer...how can i do that...
>> Your help will be appreciated
>

Running .Sql Files in a batch

Hi,
I have got multiple .sql files(text files) having T-SQL Statements. I want
to run them all together from query analyzer...how can i do that...
Your help will be appreciated
hI
Let me say you have a file as
Use Pubs
GO
CREATE PROCEDURE spMyProc
AS
SELECT * FROM Titles
--Run this command in QA
EXEC master..xp_cmdshell 'osql.exe -S SERVERNAME -U sa -P pass -i
"D:\ORD1.sql"'
"kailux4" <kailux4@.discussions.microsoft.com> wrote in message
news:067CC39F-41E2-4170-B132-927FDB458C9C@.microsoft.com...
> Hi,
> I have got multiple .sql files(text files) having T-SQL Statements. I want
> to run them all together from query analyzer...how can i do that...
> Your help will be appreciated
|||"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eS%23FL1oaFHA.2900@.TK2MSFTNGP15.phx.gbl...
> hI
> Let me say you have a file as
> Use Pubs
> GO
> CREATE PROCEDURE spMyProc
> AS
> SELECT * FROM Titles
> --Run this command in QA
> EXEC master..xp_cmdshell 'osql.exe -S SERVERNAME -U sa -P pass -i
> "D:\ORD1.sql"'
But bear in mind that "D:\" is a drive on the __server__, not on the client.
Regards
Wojtek
|||"kailux4" <kailux4@.discussions.microsoft.com> wrote in message
news:067CC39F-41E2-4170-B132-927FDB458C9C@.microsoft.com...
> Hi,
> I have got multiple .sql files(text files) having T-SQL Statements. I want
> to run them all together from query analyzer...how can i do that...
> Your help will be appreciated
Why from QA? Why not write a batch and use isql.exe within?
Regards
Wojtek
|||Hi,
I recommend you to run the .SQL files from command prompt using OSQL
redirecting the output to a log file.
OSQL -SSERVER_NAME -Uuser -Ppassword -d db_name -i file_name.sql >
output.log
OSQL -SSERVER_NAME -Uuser -Ppassword -d db_name -i file_name1.sql >>
output.log
OSQL -SSERVER_NAME -Uuser -Ppassword -d db_name -i file_name2.sql >>
output.log
Thanks
Hari
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eS%23FL1oaFHA.2900@.TK2MSFTNGP15.phx.gbl...
> hI
> Let me say you have a file as
> Use Pubs
> GO
> CREATE PROCEDURE spMyProc
> AS
> SELECT * FROM Titles
> --Run this command in QA
> EXEC master..xp_cmdshell 'osql.exe -S SERVERNAME -U sa -P pass -i
> "D:\ORD1.sql"'
>
> "kailux4" <kailux4@.discussions.microsoft.com> wrote in message
> news:067CC39F-41E2-4170-B132-927FDB458C9C@.microsoft.com...
>
sql

Running .Sql Files in a batch

Hi,
I have got multiple .sql files(text files) having T-SQL Statements. I want
to run them all together from query analyzer...how can i do that...
Your help will be appreciatedhI
Let me say you have a file as
Use Pubs
GO
CREATE PROCEDURE spMyProc
AS
SELECT * FROM Titles
--Run this command in QA
EXEC master..xp_cmdshell 'osql.exe -S SERVERNAME -U sa -P pass -i
"D:\ORD1.sql"'
"kailux4" <kailux4@.discussions.microsoft.com> wrote in message
news:067CC39F-41E2-4170-B132-927FDB458C9C@.microsoft.com...
> Hi,
> I have got multiple .sql files(text files) having T-SQL Statements. I want
> to run them all together from query analyzer...how can i do that...
> Your help will be appreciated|||"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eS%23FL1oaFHA.2900@.TK2MSFTNGP15.phx.gbl...
> hI
> Let me say you have a file as
> Use Pubs
> GO
> CREATE PROCEDURE spMyProc
> AS
> SELECT * FROM Titles
> --Run this command in QA
> EXEC master..xp_cmdshell 'osql.exe -S SERVERNAME -U sa -P pass -i
> "D:\ORD1.sql"'
But bear in mind that "D:\" is a drive on the __server__, not on the client.
Regards
Wojtek|||"kailux4" <kailux4@.discussions.microsoft.com> wrote in message
news:067CC39F-41E2-4170-B132-927FDB458C9C@.microsoft.com...
> Hi,
> I have got multiple .sql files(text files) having T-SQL Statements. I want
> to run them all together from query analyzer...how can i do that...
> Your help will be appreciated
Why from QA? Why not write a batch and use isql.exe within?
Regards
Wojtek|||Hi,
I recommend you to run the .SQL files from command prompt using OSQL
redirecting the output to a log file.
OSQL -SSERVER_NAME -Uuser -Ppassword -d db_name -i file_name.sql >
output.log
OSQL -SSERVER_NAME -Uuser -Ppassword -d db_name -i file_name1.sql >>
output.log
OSQL -SSERVER_NAME -Uuser -Ppassword -d db_name -i file_name2.sql >>
output.log
Thanks
Hari
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eS%23FL1oaFHA.2900@.TK2MSFTNGP15.phx.gbl...
> hI
> Let me say you have a file as
> Use Pubs
> GO
> CREATE PROCEDURE spMyProc
> AS
> SELECT * FROM Titles
> --Run this command in QA
> EXEC master..xp_cmdshell 'osql.exe -S SERVERNAME -U sa -P pass -i
> "D:\ORD1.sql"'
>
> "kailux4" <kailux4@.discussions.microsoft.com> wrote in message
> news:067CC39F-41E2-4170-B132-927FDB458C9C@.microsoft.com...
>

Tuesday, March 20, 2012

run sql query on multiple databases

I need to run a same query on 15 different databases and union the results.

Does any of the experts know how to do this with good performance?

Any help is appreciated.

Phil....the only reason i posted in T-Sql is because i will be using this query in reporting services :)

Thanks

Nice to see you over here...

The only reason I invited you over here is that using the power of SSIS may be better suited than doing a large cross-database query. Here's what I'd suggest...

Build a package in SSIS that connects to all of your various databases, and then using the union all component, you can store the results in a staging table to be used in SSRS. Or do you need the results real-time?|||The results will be updated every week.|||

RookieDBA wrote:

The results will be updated every week.

There you go... Using concepts from the data warehouse world, this is your best bet anyhow. You're performance may be faster obtaining the results through SSIS (versus transact-sql -- only you can test that), but certainly when users run reports in SSRS against this "reporting" table, they'll be most appreciative that they aren't waiting for data to be assembled.|||If all source tables have same estructure; you could have a dataflow with only one Source/destination component and then call the package 15 times; passing each time a difrent connection for the source component; that would help incase more sources are added down the road...|||

Yeah its fifteen different databases with five same tables and same sql code.

I will try using SSIS and see the performance.

Thanks

|||

Rafael, could you tell me what toolbox item to use for "call the package 15 times, passing each time a different connection for the source..........."

Thanks

|||

There is not an specific task for that. You would need to create an extra package; a master package that will call the child package that performs the extract/load. The trick would be to use a ForEach loop that iterates through the 15 set of connections and put the connection strings in variables (they can be in a table/file etc); inside of the ForEach Loop you will have an Execute Package task. Then the child package would need to use package configuration (from parent variable) to get the proper connection string on each iteration.

Does this make sense?

The only problem I see with this approach, it is that each iteration has to wait until the previous one is completed; so parallelization is not possible. I used a different approach to achieve parallel execution some time ago; but to be honest I did not like it at all; as you have to use a execute package task for every single execution you need (in your case would be 15!). I explained here in case you want to take a look:

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

Run Sql on multiple databases

I need to run a same query on 15 different databases and union the results.

Does any of the experts know how to do this with good performance?

Any help is appreciated.

Thanks

Come on over to the SSIS forum and we'll be glad to help you out with this.|||

What are you trying to do? You may get adequate performance just by executing the query:

select column1, column2
from database1.schema.table
union all
select column1, column2
from database2.schema.table
...

union all
select column1, column2
from databaseN.schema.table

The key is:

1. RAM - enough to work with the set in memory, if possible
2. Query plans - one slow query will run much slower than 15 fast ones (I just built a 26 query join on 15 million rows that runs in < 1 second.))

Run scripts on multiple servers in SQL Management Studio

I have a number of scripts that I need to run on multiple servers and databases. Once I have created a Solution with them all in, how do I make them run in a specific sequence, and how can I switch the focus of the entire set of scripts to the other databases I want to run them on?

Thanks,

-Rob

There is no way to do this included in SQL Management Studio. Solutions in SMS aren't like VS solutions, in that you can execute code pages and objects. In SMS the solution is just a convenient place to store and organize the script files you are working with.

You would have to open each script seperately and execute it against the server and database you wanted in the order you wanted.

Sorry, it's going to be a manual process. There are some 3rd party tools that might help some. Check Red Gate and APEX products.

|||

You can do this by using a batch file to execute either OSQL or SQLCMD (preferred) - both of which can be used to execute script files. If you pass server and database names as parameters into your batch file you can then pass the parameter values to OSQL or SQLCMD.

I don't have any examples to hand, but the following links should set you on the right track:

http://msdn2.microsoft.com/en-us/library/ms162806.aspx

http://msdn2.microsoft.com/en-us/library/ms162773.aspx

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true

This is how we deploy changes to our databases in each of our environments - the only thing that changes between each environment is the server name parameter. We generally have one batch file per database and one SQL script per database object - one batch file can be used to execute hundreds of SQL script files if need be.

Chris

|||

Dan and Chris,

Thanks for your response on my question. Not the answers I was hoping to get, but thanks anyway!! I have used the DOS bat file method successfully in the the past, but it is a bit clunky and was hoping against hope that there would be a better method in the SQL management Studio. DO you think I may be looking in the wrong tool?

I can't believe that I am the only one who thinks that the lack of a tool or process to set up implementation of scripts is a serious gap in the SQL Management Studio.

Thanks again, Rob

|||

You have to remember that SQL Server is an RDBMS. Tools provide for development are extras that I find invaluable. Just look at how clunky the management and development tools that come with Oracle have been over the years.

On a good note, you may be able to make some progress by developing your procedures and sql code in Visual Studio instead of SMS. If you have VS 2005 professional edition you can create a sql server database project that will allow you to write t-sql code and execute it. You should be able to write a minor application that would execute the scripts for you against a list of databases and/or servers.

Sorry that there isn't an easier way to do it through SMS. Perhaps it will be a forthcoming feature. I'll suggest it on the product feedback group.

Run scripts on multiple servers in SQL Management Studio

I have a number of scripts that I need to run on multiple servers and databases. Once I have created a Solution with them all in, how do I make them run in a specific sequence, and how can I switch the focus of the entire set of scripts to the other databases I want to run them on?

Thanks,

-Rob

There is no way to do this included in SQL Management Studio. Solutions in SMS aren't like VS solutions, in that you can execute code pages and objects. In SMS the solution is just a convenient place to store and organize the script files you are working with.

You would have to open each script seperately and execute it against the server and database you wanted in the order you wanted.

Sorry, it's going to be a manual process. There are some 3rd party tools that might help some. Check Red Gate and APEX products.

|||

You can do this by using a batch file to execute either OSQL or SQLCMD (preferred) - both of which can be used to execute script files. If you pass server and database names as parameters into your batch file you can then pass the parameter values to OSQL or SQLCMD.

I don't have any examples to hand, but the following links should set you on the right track:

http://msdn2.microsoft.com/en-us/library/ms162806.aspx

http://msdn2.microsoft.com/en-us/library/ms162773.aspx

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true

This is how we deploy changes to our databases in each of our environments - the only thing that changes between each environment is the server name parameter. We generally have one batch file per database and one SQL script per database object - one batch file can be used to execute hundreds of SQL script files if need be.

Chris

|||

Dan and Chris,

Thanks for your response on my question. Not the answers I was hoping to get, but thanks anyway!! I have used the DOS bat file method successfully in the the past, but it is a bit clunky and was hoping against hope that there would be a better method in the SQL management Studio. DO you think I may be looking in the wrong tool?

I can't believe that I am the only one who thinks that the lack of a tool or process to set up implementation of scripts is a serious gap in the SQL Management Studio.

Thanks again, Rob

|||

You have to remember that SQL Server is an RDBMS. Tools provide for development are extras that I find invaluable. Just look at how clunky the management and development tools that come with Oracle have been over the years.

On a good note, you may be able to make some progress by developing your procedures and sql code in Visual Studio instead of SMS. If you have VS 2005 professional edition you can create a sql server database project that will allow you to write t-sql code and execute it. You should be able to write a minor application that would execute the scripts for you against a list of databases and/or servers.

Sorry that there isn't an easier way to do it through SMS. Perhaps it will be a forthcoming feature. I'll suggest it on the product feedback group.

Monday, March 12, 2012

run query on multiple server

query return list of user or
query return list od databases or
something else
This is fine when I run query on one server.
I must get resault for other server.
How to get information for all servers on the LAN or from txt file with
servers name?
Thanks
TaleHi
If you have a text file with the server names (say servers.txt) you could do
FOR /F %i IN (servers.txt) DO osql -S%i -E -dMaster -Q"SELECT * FROM
Pubs..Authors"
John
"Tale" <tales@.eunet.yu> wrote in message news:e1t5k9$kmn$2@.news.eunet.yu...
> query return list of user or
> query return list od databases or
> something else
> This is fine when I run query on one server.
> I must get resault for other server.
> How to get information for all servers on the LAN or from txt file with
> servers name?
> Thanks
> Tale
>

run query on multiple server

query return list of user or
query return list od databases or
something else
This is fine when I run query on one server.
I must get resault for other server.
How to get information for all servers on the LAN or from txt file with
servers name?
Thanks
TaleHi
If you have a text file with the server names (say servers.txt) you could do
FOR /F %i IN (servers.txt) DO osql -S%i -E -dMaster -Q"SELECT * FROM
Pubs..Authors"
John
"Tale" <tales@.eunet.yu> wrote in message news:e1t5k9$kmn$2@.news.eunet.yu...
> query return list of user or
> query return list od databases or
> something else
> This is fine when I run query on one server.
> I must get resault for other server.
> How to get information for all servers on the LAN or from txt file with
> servers name?
> Thanks
> Tale
>

Run query against multilpe database

I have to run a script I have written against multiple databases (about 40) - how would I do this? Once I have the results I need them all to be unioned into one table.

Part of the script is below...

Thanks for any help.

Smile

Code Snippet

USE db1

SELECT * FROM Users
WHERE (Users.user_type = '1.0' AND Users.user_id <> 'itadmin')
OR (Users.user_id LIKE '%test%' OR Users.user_forename LIKE '%test%' OR Users.user_surname LIKE '%test%')

If the databases are on the same server, fully qualify the field: i.e. databasename.tablename.fieldname

If they are on different servers, you'll need to use sp_addlinkedserver which, if you're not the DBA, you might have access to.

In this case, I normally just port the tables on to a development database usign the Import/Export wizard and discard them when I'm done.

Adamus

|||The problem with this is that the script is really long, and with so many databases, adding the full link to the db is not practical. I am currently trying to use the sp_msforeachdb proc, which seems a bit better, but still not really there yet!
Thanks anyway.
|||Ok, so I've got a bit further... Have managed to get all of the info from all of the databases - but does anyone know how I could union all of the results gained from this piece of code.
Thanks
Smile

declare @.cmd1 varchar(500)
set @.cmd1 =
' if ''?'' NOT IN (''tempdb'')
USE ?
SELECT ''?'',Users.* FROM Users
WHERE (Users.user_type = ''1.0'' AND Users.user_id <> ''itadmin'')
OR (Users.user_id LIKE ''%test%'' OR Users.user_forename LIKE ''%test%'' OR Users.user_surname LIKE
''%test%'')'
exec sp_MSforeachdb @.command1=@.cmd1

|||

Best of luck

Adamus

|||

This seemed like a great thing to do with CROSS APPLY

But, alas, I couldn't find a way to initiate dynamic SQL from within a function

I did come up with this....it's not elegant, but it's functional

Code Snippet

create table #dblist ( dbname varchar(100) )

insert into #dblist

select '[db1]' union all

select '[db2]' union all

select '[db3]' union all

.

.

.

select '[db40]'

DECLARE @.dbname varchar(100),

@.selectfrom nvarchar(20),

@.scriptbody nvarchar(4000),

@.sql nvarchar(200)

--@.selectfrom is the part of the script before the dbname qualifier

SET @.selectfrom = N'select * from '

--@.scriptbody is the .dbo.tablename {rest of script}

SET @.scriptbody = N'.dbo.mytable'

--This table variable holds the results of all the query executions

-- make it a perm table or a temp table or whatever.

DECLARE @.results table ( id int, [name] varchar(100) )

DECLARE db_csr CURSOR FOR

SELECT dbname FROM #dblist --probably make #dblist a permanent table

OPEN db_csr

FETCH NEXT FROM db_csr

INTO @.dbname

WHILE @.@.FETCH_STATUS = 0

BEGIN

PRINT ' Start: ' + @.dbname

PRINT getdate()

--this is the guts

SET @.sql = @.selectfrom + @.dbname + @.scriptbody

INSERT INTO @.results

EXEC (@.sql)

PRINT ' End: ' + @.dbname

PRINT getdate()

FETCH NEXT FROM db_csr

INTO @.dbname

END

CLOSE db_csr

DEALLOCATE db_csr

--============

--review final product

SELECT *

FROM @.results

Let me know if you have any questions.

|||

Here's a version that uses USE DB

plus a couple of variable tweaks

Code Snippet

create table #dblist ( dbname varchar(100) )

insert into #dblist

select '[db1]' union all

select '[db2]' union all

select '[db3]' union all

.

.

.

select '[db40]'

DECLARE @.dbname varchar(100),

@.use nvarchar(20),

@.scriptbody nvarchar(max),

@.sql nvarchar(max)

--@.use is the part of the script before the dbname qualifier

SET @.use = N'use '

--@.scriptbody is the rest of script

SET @.scriptbody = N'; select * from mytable;'

--This table variable holds the results of all the query executions

-- define the columns as you need it

-- make it a perm table or a temp table or whatever.

DECLARE @.results table ( id int, [name] varchar(100) )

DECLARE db_csr CURSOR FOR

SELECT dbname FROM #dblist --probably make #dblist a permanent table

OPEN db_csr

FETCH NEXT FROM db_csr

INTO @.dbname

WHILE @.@.FETCH_STATUS = 0

BEGIN

PRINT ' Start: ' + @.dbname

PRINT getdate()

--this is the guts

SET @.sql = @.use + @.dbname + @.scriptbody

INSERT INTO @.results

EXEC (@.sql)

PRINT ' End: ' + @.dbname

PRINT getdate()

FETCH NEXT FROM db_csr

INTO @.dbname

END

CLOSE db_csr

DEALLOCATE db_csr

--============

--review final product

SELECT *

FROM @.results

|||

Kate

SSIS is designed to handle these types of tasks as well.

There is a FOREACH process you can use as well as accessing various data sources.

|||As Dale indicates, SSIS is most likely the best solution for your problem.|||Can anyone point me in the direction of a good tutorial/explanation of SSIS? I've not used it before with SQL Server.
Cheers
K Smile
|||

You might find that a visit to http://www.sqlis.com/ is worth your time and effort.

Also:

http://msdn2.microsoft.com/en-us/library/ms167031.aspx

http://digg.com/programming/Tutorial_1_Creating_Your_First_SSIS_Package_Using_SQL_Server_2005_Beta_2

|||Thanks for that Arnie - I will look at them now.
K Smile
|||Thanks for this Dale - I don't have SSIS on my PC, so this has been used to create my answer. Smile

Run Multiple Stored Procedures in order with a script?

Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
scripts to run. The scripts always come in a folder numbered in the order
they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
I've been running them all manaully one by one so that I can look for errors
in the results. I'd love to be able to point a batch file to the folder
with all the scripts, have them run one by one, and have the results output
in one file with:
Results.txt:
001 - ScriptA.sql
Command Completed Successfully
002 - ScriptB.sql
Command Completed Successfully
003 - ScriptC.sql
Error in line 1...etc
004 - ScriptD.sql
Command Completed Successfully
etc.
I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
However, this is often causes problems as sometimes the end of one script
will join directly to the start of the first script making statements that
don't exist (EndscriptGo).. two statements joint into one. Or other times
scripts will be left out for some reason. Piping has caused many problems
and isn't trusted anymore.
I tried using osql
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
g
but I don't know how to run scripts 001 through say 108 in order, or how to
have them output into one file.
Is there a way to use this or something else (like run 001*.sql, then run
001+1*.sql [I have no idea how to program!) so that I can just point it to
the folder with the numbered scripts and have them run one by one in order?
Any help is REALLY REALLY appreciated!!!!
Thank you
Why not put the names of the scripts in a table and loop thru with a cursor
and call oSql one script at a time?
Andrew J. Kelly SQL MVP
"Tom" <none@.none.com> wrote in message
news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for
> errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results
> output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
> OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how
> to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point it to
> the folder with the numbered scripts and have them run one by one in
> order?
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>
|||Okay, that is way over my head!
I would have to create a new DB for it because I can't add a new table to
the live DB.
If I tried adding all the script names to a table wouldn't I have to type
all the names of the scritps in the table? If there's a way to automate
that I could try it, but it sounds like it could end up being as manual a
process as running them one by one.
What do you think?
Thanks
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:OeJdMvA0EHA.3908@.TK2MSFTNGP12.phx.gbl...
> Why not put the names of the scripts in a table and loop thru with a
cursor[vbcol=seagreen]
> and call oSql one script at a time?
> --
> Andrew J. Kelly SQL MVP
>
> "Tom" <none@.none.com> wrote in message
> news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
100+[vbcol=seagreen]
order[vbcol=seagreen]
script[vbcol=seagreen]
that[vbcol=seagreen]
times[vbcol=seagreen]
problems[vbcol=seagreen]
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
run[vbcol=seagreen]
to
>
|||See
http://www.nigelrivett.net/s_ProcessAllFilesInDir.html
It will execute a proc for each file in a directory in order of the file name.
Create a proc which takes two parameters, file path and file name and
executes a osql command to run that file with output to a file.
Set @.ProcSp to be this proc and you are done.
"Tom" wrote:

> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
> OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point it to
> the folder with the numbered scripts and have them run one by one in order?
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>
|||Awesome, I'll check it out!
Thanks so much Nigel!
Tom
"Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> See
> http://www.nigelrivett.net/s_ProcessAllFilesInDir.html
> It will execute a proc for each file in a directory in order of the file
name.[vbcol=seagreen]
> Create a proc which takes two parameters, file path and file name and
> executes a osql command to run that file with output to a file.
> Set @.ProcSp to be this proc and you are done.
>
> "Tom" wrote:
100+[vbcol=seagreen]
order[vbcol=seagreen]
errors[vbcol=seagreen]
output[vbcol=seagreen]
script[vbcol=seagreen]
that[vbcol=seagreen]
times[vbcol=seagreen]
problems[vbcol=seagreen]
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
to[vbcol=seagreen]
run[vbcol=seagreen]
to[vbcol=seagreen]
order?[vbcol=seagreen]
|||Nigel, is there an output file in this?
Thanks,
Tom
"Tom" <none@.none.com> wrote in message
news:uJKqlyC0EHA.2600@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Awesome, I'll check it out!
> Thanks so much Nigel!
>
> Tom
> "Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
> news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> name.
> 100+
> order
> errors
folder
> output
> script
> that
> times
> problems
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
how[vbcol=seagreen]
> to
> run
it
> to
> order?
>
|||Nigel,
How do I create the @.procSP and what exactly do I put in it in this case?
Thanks,
Tom
"Tom" <none@.none.com> wrote in message
news:uJKqlyC0EHA.2600@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Awesome, I'll check it out!
> Thanks so much Nigel!
>
> Tom
> "Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
> news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> name.
> 100+
> order
> errors
folder
> output
> script
> that
> times
> problems
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
how[vbcol=seagreen]
> to
> run
it
> to
> order?
>
|||Tom wrote:
> but it sounds like it could end up
> being as manual a process as running them one by one.
> What do you think?
Yes, but only the first time...
David Gugick
Imceda Software
www.imceda.com
|||Consider this:
1. Create a text file with the .sql files listed one per line.
2. Create a command/batch file to submit each to osql.exe
3. Have osql send results to the screen, but instead redirect results to a
logfile
For example:
text.txt contents
sqlscript1.sql
sqlscript2.sql
sqlscript3.sql
sqlcommand.cmd contents
for /F %%i IN (text.txt) DO osql -Usa -Ppass -Sdb123 -i%%i >> logfile.txt
So, for each file in text.txt, submit the osql script file and redirect to
logfile.
Check out Windows Help on the For command, it's quite handy. I suggest using
the text.txt file so you can edit which scripts run and in which order, in
case your numeric sequence needs to be reordered.
Larry
"Tom" <none@.none.com> wrote in message
news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for
errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results
output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how
to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point it to
> the folder with the numbered scripts and have them run one by one in
order?
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>

Run Multiple Stored Procedures in order with a script?

Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
scripts to run. The scripts always come in a folder numbered in the order
they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
I've been running them all manaully one by one so that I can look for errors
in the results. I'd love to be able to point a batch file to the folder
with all the scripts, have them run one by one, and have the results output
in one file with:
Results.txt:
001 - ScriptA.sql
Command Completed Successfully
002 - ScriptB.sql
Command Completed Successfully
003 - ScriptC.sql
Error in line 1...etc
004 - ScriptD.sql
Command Completed Successfully
etc.
I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
However, this is often causes problems as sometimes the end of one script
will join directly to the start of the first script making statements that
don't exist (EndscriptGo).. two statements joint into one. Or other times
scripts will be left out for some reason. Piping has caused many problems
and isn't trusted anymore.
I tried using osql
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
g
but I don't know how to run scripts 001 through say 108 in order, or how to
have them output into one file.
Is there a way to use this or something else (like run 001*.sql, then run
001+1*.sql [I have no idea how to program!) so that I can just point it to
the folder with the numbered scripts and have them run one by one in order?
Any help is REALLY REALLY appreciated!!!!
Thank you
Why not put the names of the scripts in a table and loop thru with a cursor
and call oSql one script at a time?
Andrew J. Kelly SQL MVP
"Tom" <none@.none.com> wrote in message
news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for
> errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results
> output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
> OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how
> to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point it to
> the folder with the numbered scripts and have them run one by one in
> order?
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>
|||Okay, that is way over my head!
I would have to create a new DB for it because I can't add a new table to
the live DB.
If I tried adding all the script names to a table wouldn't I have to type
all the names of the scritps in the table? If there's a way to automate
that I could try it, but it sounds like it could end up being as manual a
process as running them one by one.
What do you think?
Thanks
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:OeJdMvA0EHA.3908@.TK2MSFTNGP12.phx.gbl...
> Why not put the names of the scripts in a table and loop thru with a
cursor[vbcol=seagreen]
> and call oSql one script at a time?
> --
> Andrew J. Kelly SQL MVP
>
> "Tom" <none@.none.com> wrote in message
> news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
100+[vbcol=seagreen]
order[vbcol=seagreen]
script[vbcol=seagreen]
that[vbcol=seagreen]
times[vbcol=seagreen]
problems[vbcol=seagreen]
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
run[vbcol=seagreen]
to
>
|||See
http://www.nigelrivett.net/s_ProcessAllFilesInDir.html
It will execute a proc for each file in a directory in order of the file name.
Create a proc which takes two parameters, file path and file name and
executes a osql command to run that file with output to a file.
Set @.ProcSp to be this proc and you are done.
"Tom" wrote:

> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
> OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point it to
> the folder with the numbered scripts and have them run one by one in order?
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>
|||Awesome, I'll check it out!
Thanks so much Nigel!
Tom
"Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> See
> http://www.nigelrivett.net/s_ProcessAllFilesInDir.html
> It will execute a proc for each file in a directory in order of the file
name.[vbcol=seagreen]
> Create a proc which takes two parameters, file path and file name and
> executes a osql command to run that file with output to a file.
> Set @.ProcSp to be this proc and you are done.
>
> "Tom" wrote:
100+[vbcol=seagreen]
order[vbcol=seagreen]
errors[vbcol=seagreen]
output[vbcol=seagreen]
script[vbcol=seagreen]
that[vbcol=seagreen]
times[vbcol=seagreen]
problems[vbcol=seagreen]
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
to[vbcol=seagreen]
run[vbcol=seagreen]
to[vbcol=seagreen]
order?[vbcol=seagreen]
|||Nigel, is there an output file in this?
Thanks,
Tom
"Tom" <none@.none.com> wrote in message
news:uJKqlyC0EHA.2600@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Awesome, I'll check it out!
> Thanks so much Nigel!
>
> Tom
> "Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
> news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> name.
> 100+
> order
> errors
folder
> output
> script
> that
> times
> problems
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
how[vbcol=seagreen]
> to
> run
it
> to
> order?
>
|||Nigel,
How do I create the @.procSP and what exactly do I put in it in this case?
Thanks,
Tom
"Tom" <none@.none.com> wrote in message
news:uJKqlyC0EHA.2600@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Awesome, I'll check it out!
> Thanks so much Nigel!
>
> Tom
> "Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
> news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> name.
> 100+
> order
> errors
folder
> output
> script
> that
> times
> problems
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
how[vbcol=seagreen]
> to
> run
it
> to
> order?
>
|||Tom wrote:
> but it sounds like it could end up
> being as manual a process as running them one by one.
> What do you think?
Yes, but only the first time...
David Gugick
Imceda Software
www.imceda.com
|||Consider this:
1. Create a text file with the .sql files listed one per line.
2. Create a command/batch file to submit each to osql.exe
3. Have osql send results to the screen, but instead redirect results to a
logfile
For example:
text.txt contents
sqlscript1.sql
sqlscript2.sql
sqlscript3.sql
sqlcommand.cmd contents
for /F %%i IN (text.txt) DO osql -Usa -Ppass -Sdb123 -i%%i >> logfile.txt
So, for each file in text.txt, submit the osql script file and redirect to
logfile.
Check out Windows Help on the For command, it's quite handy. I suggest using
the text.txt file so you can edit which scripts run and in which order, in
case your numeric sequence needs to be reordered.
Larry
"Tom" <none@.none.com> wrote in message
news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for
errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results
output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how
to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point it to
> the folder with the numbered scripts and have them run one by one in
order?
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>

Run Multiple Stored Procedures in order with a script?

Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
scripts to run. The scripts always come in a folder numbered in the order
they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
I've been running them all manaully one by one so that I can look for errors
in the results. I'd love to be able to point a batch file to the folder
with all the scripts, have them run one by one, and have the results output
in one file with:
Results.txt:
001 - ScriptA.sql
Command Completed Successfully
002 - ScriptB.sql
Command Completed Successfully
003 - ScriptC.sql
Error in line 1...etc
004 - ScriptD.sql
Command Completed Successfully
etc.
I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
However, this is often causes problems as sometimes the end of one script
will join directly to the start of the first script making statements that
don't exist (EndscriptGo).. two statements joint into one. Or other times
scripts will be left out for some reason. Piping has caused many problems
and isn't trusted anymore.
I tried using osql
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
g
but I don't know how to run scripts 001 through say 108 in order, or how to
have them output into one file.
Is there a way to use this or something else (like run 001*.sql, then run
001+1*.sql [I have no idea how to program!) so that I can just point it to
the folder with the numbered scripts and have them run one by one in order?
Any help is REALLY REALLY appreciated!!!!
Thank you
Why not put the names of the scripts in a table and loop thru with a cursor
and call oSql one script at a time?
Andrew J. Kelly SQL MVP
"Tom" <none@.none.com> wrote in message
news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for
> errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results
> output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
> OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how
> to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point it to
> the folder with the numbered scripts and have them run one by one in
> order?
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>
|||Okay, that is way over my head!
I would have to create a new DB for it because I can't add a new table to
the live DB.
If I tried adding all the script names to a table wouldn't I have to type
all the names of the scritps in the table? If there's a way to automate
that I could try it, but it sounds like it could end up being as manual a
process as running them one by one.
What do you think?
Thanks
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:OeJdMvA0EHA.3908@.TK2MSFTNGP12.phx.gbl...
> Why not put the names of the scripts in a table and loop thru with a
cursor[vbcol=seagreen]
> and call oSql one script at a time?
> --
> Andrew J. Kelly SQL MVP
>
> "Tom" <none@.none.com> wrote in message
> news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
100+[vbcol=seagreen]
order[vbcol=seagreen]
script[vbcol=seagreen]
that[vbcol=seagreen]
times[vbcol=seagreen]
problems[vbcol=seagreen]
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
run[vbcol=seagreen]
to
>
|||See
http://www.nigelrivett.net/s_ProcessAllFilesInDir.html
It will execute a proc for each file in a directory in order of the file name.
Create a proc which takes two parameters, file path and file name and
executes a osql command to run that file with output to a file.
Set @.ProcSp to be this proc and you are done.
"Tom" wrote:

> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
> OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point it to
> the folder with the numbered scripts and have them run one by one in order?
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>
|||Awesome, I'll check it out!
Thanks so much Nigel!
Tom
"Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> See
> http://www.nigelrivett.net/s_ProcessAllFilesInDir.html
> It will execute a proc for each file in a directory in order of the file
name.[vbcol=seagreen]
> Create a proc which takes two parameters, file path and file name and
> executes a osql command to run that file with output to a file.
> Set @.ProcSp to be this proc and you are done.
>
> "Tom" wrote:
100+[vbcol=seagreen]
order[vbcol=seagreen]
errors[vbcol=seagreen]
output[vbcol=seagreen]
script[vbcol=seagreen]
that[vbcol=seagreen]
times[vbcol=seagreen]
problems[vbcol=seagreen]
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
to[vbcol=seagreen]
run[vbcol=seagreen]
to[vbcol=seagreen]
order?[vbcol=seagreen]
|||Nigel, is there an output file in this?
Thanks,
Tom
"Tom" <none@.none.com> wrote in message
news:uJKqlyC0EHA.2600@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Awesome, I'll check it out!
> Thanks so much Nigel!
>
> Tom
> "Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
> news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> name.
> 100+
> order
> errors
folder
> output
> script
> that
> times
> problems
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
how[vbcol=seagreen]
> to
> run
it
> to
> order?
>
|||Nigel,
How do I create the @.procSP and what exactly do I put in it in this case?
Thanks,
Tom
"Tom" <none@.none.com> wrote in message
news:uJKqlyC0EHA.2600@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Awesome, I'll check it out!
> Thanks so much Nigel!
>
> Tom
> "Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
> news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> name.
> 100+
> order
> errors
folder
> output
> script
> that
> times
> problems
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
how[vbcol=seagreen]
> to
> run
it
> to
> order?
>
|||Tom wrote:
> but it sounds like it could end up
> being as manual a process as running them one by one.
> What do you think?
Yes, but only the first time...
David Gugick
Imceda Software
www.imceda.com
|||Consider this:
1. Create a text file with the .sql files listed one per line.
2. Create a command/batch file to submit each to osql.exe
3. Have osql send results to the screen, but instead redirect results to a
logfile
For example:
text.txt contents
sqlscript1.sql
sqlscript2.sql
sqlscript3.sql
sqlcommand.cmd contents
for /F %%i IN (text.txt) DO osql -Usa -Ppass -Sdb123 -i%%i >> logfile.txt
So, for each file in text.txt, submit the osql script file and redirect to
logfile.
Check out Windows Help on the For command, it's quite handy. I suggest using
the text.txt file so you can edit which scripts run and in which order, in
case your numeric sequence needs to be reordered.
Larry
"Tom" <none@.none.com> wrote in message
news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for
errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results
output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how
to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point it to
> the folder with the numbered scripts and have them run one by one in
order?
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>
|||Have you thought about using DTS?. The Active-X filesystem
object would help you figure out the file names and I'm
sure DTS would help you setup a loop to execute your
programs.
Vinay
vinaydottoomuatschwabptdotcom
>--Original Message--
>Tom wrote:
>Yes, but only the first time...
>--
>David Gugick
>Imceda Software
>www.imceda.com
>.
>

Run Multiple Stored Procedures in order with a script?

Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
scripts to run. The scripts always come in a folder numbered in the order
they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
I've been running them all manaully one by one so that I can look for errors
in the results. I'd love to be able to point a batch file to the folder
with all the scripts, have them run one by one, and have the results output
in one file with:
Results.txt:
001 - ScriptA.sql
Command Completed Successfully
--
002 - ScriptB.sql
Command Completed Successfully
--
003 - ScriptC.sql
Error in line 1...etc
--
004 - ScriptD.sql
Command Completed Successfully
--
etc.
I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
However, this is often causes problems as sometimes the end of one script
will join directly to the start of the first script making statements that
don't exist (EndscriptGo).. two statements joint into one. Or other times
scripts will be left out for some reason. Piping has caused many problems
and isn't trusted anymore.
I tried using osql
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
g
but I don't know how to run scripts 001 through say 108 in order, or how to
have them output into one file.
Is there a way to use this or something else (like run 001*.sql, then run
001+1*.sql [I have no idea how to program!) so that I can just point it
to
the folder with the numbered scripts and have them run one by one in order'
Any help is REALLY REALLY appreciated!!!!
Thank youWhy not put the names of the scripts in a table and loop thru with a cursor
and call oSql one script at a time?
Andrew J. Kelly SQL MVP
"Tom" <none@.none.com> wrote in message
news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for
> errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results
> output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
> OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.
lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how
> to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point i
t to
> the folder with the numbered scripts and have them run one by one in
> order'
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>|||Okay, that is way over my head!
I would have to create a new DB for it because I can't add a new table to
the live DB.
If I tried adding all the script names to a table wouldn't I have to type
all the names of the scritps in the table? If there's a way to automate
that I could try it, but it sounds like it could end up being as manual a
process as running them one by one.
What do you think?
Thanks
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:OeJdMvA0EHA.3908@.TK2MSFTNGP12.phx.gbl...
> Why not put the names of the scripts in a table and loop thru with a
cursor
> and call oSql one script at a time?
> --
> Andrew J. Kelly SQL MVP
>
> "Tom" <none@.none.com> wrote in message
> news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
100+[vbcol=seagreen]
order[vbcol=seagreen]
script[vbcol=seagreen]
that[vbcol=seagreen]
times[vbcol=seagreen]
problems[vbcol=seagreen]
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
run[vbcol=seagreen]
to[vbcol=seagreen]
>|||See
http://www.nigelrivett.net/s_ProcessAllFilesInDir.html
It will execute a proc for each file in a directory in order of the file nam
e.
Create a proc which takes two parameters, file path and file name and
executes a osql command to run that file with output to a file.
Set @.ProcSp to be this proc and you are done.
"Tom" wrote:

> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for erro
rs
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results outpu
t
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
> OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.
lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how t
o
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point i
t to
> the folder with the numbered scripts and have them run one by one in order
'
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>|||Awesome, I'll check it out!
Thanks so much Nigel!
Tom
"Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> See
> http://www.nigelrivett.net/s_ProcessAllFilesInDir.html
> It will execute a proc for each file in a directory in order of the file
name.[vbcol=seagreen]
> Create a proc which takes two parameters, file path and file name and
> executes a osql command to run that file with output to a file.
> Set @.ProcSp to be this proc and you are done.
>
> "Tom" wrote:
>
100+[vbcol=seagreen]
order[vbcol=seagreen]
errors[vbcol=seagreen]
output[vbcol=seagreen]
script[vbcol=seagreen]
that[vbcol=seagreen]
times[vbcol=seagreen]
problems[vbcol=seagreen]
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo[vbcol=seagreen]
to[vbcol=seagreen]
run[vbcol=seagreen]
to[vbcol=seagreen]
order'[vbcol=seagreen]|||Nigel, is there an output file in this?
Thanks,
Tom
"Tom" <none@.none.com> wrote in message
news:uJKqlyC0EHA.2600@.TK2MSFTNGP09.phx.gbl...
> Awesome, I'll check it out!
> Thanks so much Nigel!
>
> Tom
> "Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
> news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> name.
> 100+
> order
> errors
folder[vbcol=seagreen]
> output
> script
> that
> times
> problems
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
how[vbcol=seagreen]
> to
> run
it[vbcol=seagreen]
> to
> order'
>|||Nigel,
How do I create the @.procSP and what exactly do I put in it in this case?
Thanks,
Tom
"Tom" <none@.none.com> wrote in message
news:uJKqlyC0EHA.2600@.TK2MSFTNGP09.phx.gbl...
> Awesome, I'll check it out!
> Thanks so much Nigel!
>
> Tom
> "Nigel Rivett" <sqlnr@.hotmail.com> wrote in message
> news:3FD23957-DF3C-4EEB-9987-869B69B6C195@.microsoft.com...
> name.
> 100+
> order
> errors
folder[vbcol=seagreen]
> output
> script
> that
> times
> problems
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
how[vbcol=seagreen]
> to
> run
it[vbcol=seagreen]
> to
> order'
>|||Tom wrote:
> but it sounds like it could end up
> being as manual a process as running them one by one.
> What do you think?
Yes, but only the first time...
David Gugick
Imceda Software
www.imceda.com|||Consider this:
1. Create a text file with the .sql files listed one per line.
2. Create a command/batch file to submit each to osql.exe
3. Have osql send results to the screen, but instead redirect results to a
logfile
For example:
text.txt contents
--
sqlscript1.sql
sqlscript2.sql
sqlscript3.sql
sqlcommand.cmd contents
--
for /F %%i IN (text.txt) DO osql -Usa -Ppass -Sdb123 -i%%i >> logfile.txt
So, for each file in text.txt, submit the osql script file and redirect to
logfile.
Check out Windows Help on the For command, it's quite handy. I suggest using
the text.txt file so you can edit which scripts run and in which order, in
case your numeric sequence needs to be reordered.
Larry
"Tom" <none@.none.com> wrote in message
news:eDGJSmA0EHA.4028@.TK2MSFTNGP15.phx.gbl...
> Hello. I have to run many sql scripts each day. Sometimes I'll have 100+
> scripts to run. The scripts always come in a folder numbered in the order
> they need to be run (001 - ScriptA, 002 - ScriptB, etc.).
> I've been running them all manaully one by one so that I can look for
errors
> in the results. I'd love to be able to point a batch file to the folder
> with all the scripts, have them run one by one, and have the results
output
> in one file with:
> Results.txt:
> 001 - ScriptA.sql
> Command Completed Successfully
> --
> 002 - ScriptB.sql
> Command Completed Successfully
> --
> 003 - ScriptC.sql
> Error in line 1...etc
> --
> 004 - ScriptD.sql
> Command Completed Successfully
> --
> etc.
>
> I have tried piping them using c:\Scipts\*.sql > c:\AllScripts.sql
> However, this is often causes problems as sometimes the end of one script
> will join directly to the start of the first script making statements that
> don't exist (EndscriptGo).. two statements joint into one. Or other times
> scripts will be left out for some reason. Piping has caused many problems
> and isn't trusted anymore.
> I tried using osql
>
OSQL -Usa -Ppass -Sdb123 -iC:\scripts\001scriptA.sql -oC:\logs\001scriptA.lo
> g
> but I don't know how to run scripts 001 through say 108 in order, or how
to
> have them output into one file.
> Is there a way to use this or something else (like run 001*.sql, then run
> 001+1*.sql [I have no idea how to program!) so that I can just point i
t to
> the folder with the numbered scripts and have them run one by one in
order'
>
> Any help is REALLY REALLY appreciated!!!!
>
> Thank you
>
>

Run multiple SSIS packages in order

I built 3 diffrent packages and i want to be executed in order. The first one is exporting some tables to another database and the other two packages are based on the database built in the first package.

Any suggestions?

Thank you in advance:)

I assume you wish to automate this process. The simplest option would be to create a SQL Server Agent job, and just have three steps within the job, one for each package.

A more SSIS orientated approach would be to use a master package, that has three execute package tasks, one for each of your existing packages. Link the Execute package Tasks together with workflow constraints to enforce the order of execution for the tasks and hence the packages.

|||

Darren,

Just a question: when we're talking about the maximum number of DTSX inside a DTSPROJ only limitation is the memory?

TIA

|||

Yes.

If you do have a lot then I'd be tempted to write a more dynamic process.

Perhaps use a SQL table to contain the list of packages, and also have a column for the order. You could then use the Exec SQL Task with simple SELECT query to extract the list of packages in order of execution. You could store this results in a variable, and then loop and shred this via the For Each Loop.

This example uses Data Flow task to get the result set into a variable, but I normally find an Exec SQL Task easier. It does show the shredding of the results via the loop though.

Shredding a Recordset

(http://www.sqlis.com/default.aspx?59)

|||

I used the SQL Server Agent Job.

thanks for the help :)

Run multiple query on VB 2005

Assume that I got 10 line of insert query to be carry out, how can I run all these 10 insert query at on time instead of using sqlcommand.executenonquery for 10 time. Thanks.

You can create a Stored Procedure that contains all 10 queries, pass all of the necessary parameters to the Stored Procedure, and the execute the Stored Procedure.

Perhaps if you posted your queries, we could better help you.

|||Well, if I got one or two insert query, one or two delete query and some update query, assume that the data validation is valid, could these be carry out together?|||

Yes.

In the Stored Procedure, if they are 'all or none' actions, you may wish to put all of the queries/actions in a SQL TRANSACTION to make sure that there are no errors.

|||Can I have a sample code on how to execute multiple queries at one time?|||Look in Books Online for the topic 'TRANSACTION'. There are several good examples.

run multiple file .sql in Analyser

Who can i run multiple file .sql in SQL Analyser
something like this:
ecec c:\test\file1.sql
ecec c:\test\file2.sql
ecec c:\test\file3.sql
thanks
Franky
franky@.boucheros.comI think you want to look at the osql utility. It is the command-line version of Query analyzer. there is more documentation for osql in SQL BOL.

HTH

Hugh Scott|||thanks!

Run Maintanance Plan As Agent Job Step

Hi Everyone,
I have created a maintanance plan to generate a full database backup with no
schedule.
I have then created a new Agent job with multiple steps, most of the steps
execute TSQL and these seem to be working. One of the job steps is to execute
the Full database backup SSIS package generated by the Maintanance plan. This
step executes in less than 1 second without an error and does not generate
the backup.
If I execute the maintanance plan directly via the right click EXECUTE
command it works as expected.
I have checked to ensure that the Agent job owner is a member of the
sysadmin so I don't think access rights are an issue.
Does anyone have any ideas?
I have considered copying the TSQL the maintanance plan generated and
executing this in the step instead of the SSIS package but I would like to
know why my existing configuration will not work.
Please help
ACM
On Jun 11, 12:58 pm, ACM <A...@.discussions.microsoft.com> wrote:
> Hi Everyone,
> I have created a maintanance plan to generate a full database backup with no
> schedule.
> I have then created a new Agent job with multiple steps, most of the steps
> execute TSQL and these seem to be working. One of the job steps is to execute
> the Full database backup SSIS package generated by the Maintanance plan. This
> step executes in less than 1 second without an error and does not generate
> the backup.
> If I execute the maintanance plan directly via the right click EXECUTE
> command it works as expected.
> I have checked to ensure that the Agent job owner is a member of the
> sysadmin so I don't think access rights are an issue.
> Does anyone have any ideas?
> I have considered copying the TSQL the maintanance plan generated and
> executing this in the step instead of the SSIS package but I would like to
> know why my existing configuration will not work.
> Please help
> ACM
Hi
Try running dtexec with verbose reporting see
http://msdn2.microsoft.com/en-us/library/ms162810(SQL.90).aspx
John