SolvedPrivate

sql scripts

Posted on 2013-06-01
6
26 Views
Last Modified: 2016-02-11
i have a script that updates a field in the table.
i want to break the script into 4 parts.
how do i call the script one after the other without using a ssis package?
0
Comment
Question by:package_monkey
  • 3
  • 2
6 Comments
 
LVL 18

Expert Comment

by:Matthew Kelly
ID: 39213541
How are you calling them now?

Generally, you could make them stored procedures, and then just have one script call each procedure.

Lots of examplese of stored procedures here: http://msdn.microsoft.com/en-us/library/ms187926(v=sql.90).aspx
0
 

Author Comment

by:package_monkey
ID: 39213836
i have a package that executes sql tasks, it creates a  temp table.
next temp table is populated with the the values from 4 fields from the production table.
i update the table with another temp table which is created using inserts from the excel sheet.
then i use inner join to update the production table using the updated temp table.
my question is how do i break the scripts? i do not want to run the whole sucker as one script.
0
 
LVL 18

Expert Comment

by:Matthew Kelly
ID: 39214371
The four scripts you want are:

1. Scripts

Creates a  temp table.

2. Scripts

Populate temp table with the the values from 4 fields from the production table.

3. Scripts

Update the table with another temp table which is created using inserts from the excel sheet.

4. Scripts

Use inner join to update the production table using the updated temp table.
You then want the single SSIS package you have to execute all four scripts in order when called?

To do that, the best method is to create four stored procedures, each one doing one step of the above tasks; then have the SSIS package call each of the stored procedures. You would also be able to call the stored procedures manually one at a time without the package as well.

Is it timing out? Is that why you want to break the scripts up?
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

Author Comment

by:package_monkey
ID: 39214401
i do not want to  run it in a one swing, as so many rows are being inserted and updated.
i do not want to cause any problem down the pipeline.
0
 

Author Comment

by:package_monkey
ID: 39214417
it is a one time update. that is why i do not want to do it as a package or as a stored procedure.
0
 
LVL 25

Accepted Solution

by:
jogos earned 300 total points
ID: 39214532
Split your script in 4 and then you have (besides running it in a sql-window) different options

Sql*agent
http://databases.about.com/od/sqlserver/ss/sql_server_agent_3.htm

SQLCMD
http://msdn.microsoft.com/en-us/library/ms162773(v=sql.90).aspx
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question