[dba-SQLServer] Storing sql in database and other stuff

Fred Hooper fahooper at trapo.com
Mon Mar 24 17:39:50 CDT 2008


A stored procedure can have a large number of queries. I recently created
five that replaced 400 Access queries. E.g.

Update foo
Set fld1 = 2;

Update foo2
Set fld1 = 3
Where fld2=1;

Etc.

They will run in the order you type them. You can also use if statements if
some alternatives are needed. I used

If Month(GetDate()) = 11 then 
Begin
	Series of statements to process a new budget
End;


-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Monday, March 24, 2008 4:22 PM
To: 'Discussion concerning MS SQL Server'
Subject: [dba-SQLServer] Storing sql in database and other stuff

Guys, here is the deal.

I have a sequence of steps which need to be performed in an rather exact
order to get an order filled.  These steps include running a bunch of action
queries in a specific order.  At the moment I have built the queries and
have them stored in a directory but I KNOW that somehow I actually saved the
queries inside of my database one time.  I think maybe I saved them as
stored procedures though I am not sure.

So, I need to figure out how to save the queries inside of my database, then
I need to build a stored procedure to run all of these queries (or stored
procedures?) in order.  If I can accomplish that then building an order will
drop to an hour instead many hours.

So, how do I store the queries inside of a database?

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com





More information about the dba-SQLServer mailing list