Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 executing stored procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-02-24 : 08:20:23
Piyush Kacha writes "Consider n databases for n countries all of them with similar structure on same server. Since the stored procedures for all the countries are same functionality wise only the database will change, rest everything else remains same(i.e. the table name, field size.).

for e.g. i have 2 database DBIndia - 1st Database and DBUSA - 2 nd Database

Both the Database's have one table name Master with fields Name, City, State, Country.

Consider stored procedure usp_disp_master in DBIndia which has the following piece of code

SELECT Name, City from Master


Consider stored procedure usp_disp_master in DBUSA which has the following piece of code

SELECT Name, City from Master


1) Now conidering the above scenario instead of writing stored proc for each database can i write one stored proc which will do the same stuff as the above 2 stored procs do.
2) What could be the limitations or the drawback of using such stuff.

3) Is there any better solution for doing the above scenario(i mean stored proc)

As i find maintaining the stored proc for all database can be very tedious and error prone."

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2004-02-24 : 08:36:16
Well, I remember reading a thread that explained how you could name common stored procedures with the prefix "sp_(proc name)" and create them in the master database. When such a procedure is called from another database, it is invoked in the context of the calling database, which seems to suit your situation. But I'm not quite sure how safe this is.

OS
Go to Top of Page
   

- Advertisement -