473,394 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Call .sql from .sql

2
Hi all,

I am a developer new to working with SQL Server. I am on 2008, and have created n number of stored procedures. Each stored procedure has been put in its own file on my system, and stored in source control. This is so that, as I continue to update the system, I can just grab the one stored procedure I am working on updating, run it to update it in the database, and then commit my changes.

The problem is that when the DBA makes changes to the database and I run his script to drop and recreate mine accordingly, I lose all of my stored procedures. I have looked online for a way in MS SQL Server to just have one master .sql file that I can call that will call all of the others and recreate all my procedures in the database. My search has been fruitless so far. It almost seems like there is no way to do this. Am I correct? Please someone tell me I've missed something, and then it would be great if you could fill me in on what it is I've missed.

Thanks for your help
Jan 17 '12 #1
4 2095
Rabbit
12,516 Expert Mod 8TB
What script are you running? And why would it drop everything just because a change was made to the database?
Jan 17 '12 #2
NeoPa
32,556 Expert Mod 16PB
What's the SQL you use to drop an individual SP? It sounds like this may be dropping all of yours. We have nothing to work with of course as you included nothing in the way of SQL to illustrate the situation :-(
Jan 17 '12 #3
bmahf
2
So I didn't add sql code because the question was how to call one sql file from another, not how to fix a problem I was having with sql code. As to the database being dropped and recreated, it's my local dev system, as opposed to the actual test db being handled by the dba, so I just run the create script since I don't want to have to deal with the specifics up moving from one db schema to another.

As to dropping my sp's, that's not what's happening. The new database instance is being created by dropping the old, therefore dropping everything in the old instance.

Anyway, I continued to look and settled for doing a .bat file using the sqlcmd tool. My file does a sqlcmd call for each file that I want run. Pretty nice, but I was really hoping not have to get out of SSMS to go to a command window and run a bat file, but one does what one has to do.

Thanks for the help...
Jan 17 '12 #4
NeoPa
32,556 Expert Mod 16PB
It's a shame your first post wasn't quite so clear on what you didn't want. That's cleared that up anyway.
bmahf:
So I didn't add sql code because the question was how to call one sql file from another
Now all we need to know is what you mean when you refer to SQL files. The only command I know of to invoke one set of SQL from another in T-SQL is the EXEC[UTE]() procedure, but that works with entities within your database. I know of nothing that refers to external files.
Jan 17 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

35
by: hasho | last post by:
Why is "call by address" faster than "call by value"?
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
5
by: Amaryllis | last post by:
I'm trying to call a CL which is located on our AS400 from a Windows application. I've tried to code it in different ways, but I seem to get the same error every time. Does anyone have any clue...
13
by: mitchellpal | last post by:
i am really having a hard time trying to differentiate the two..........i mean.....anyone got a better idea how each occurs?
7
by: archana | last post by:
Hi all, I am having application in which i am doing asynchronous call.I am using manualresetevent to wait for asynchronous call to complete. I want to stop asynchronous call after certain...
13
by: shsingh | last post by:
I have a class A containing some map as data variables. I creat an object of class A on heap by allocatiing memory by using "malloc". This will return me the required memory but the object is not...
46
by: Steven T. Hatton | last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it says. http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html <shrug> -- NOUN:1. Money or...
3
by: cberthu | last post by:
Hi all, Is it possible to have two connects in the same rexx script to different DB's? I have to get data form on DB (with specifics selects and filter out some values with RExx) and save the...
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.