473,320 Members | 1,535 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,320 software developers and data experts.

Parametrizar nombre de BD (Español)

Bueno a los suscritos que lean en español:

Sucede que quisiera parametrizar el nombre que la base de datos en un
SP, es decir :

Create Procedure Prueba
As
Begin
Select * From mibase..mitabla
End

En dode mibase, es mi base de datos, la que pobria tener distintos nombres.

No puedo usar exec pues solo tengo permiso de ejecución sobre el SP y
por motivos de seguridad no tengo permisos sobre la tabla (mitabla).

Además, estos procedimientos tienen querys con join a distintas bd, las
que me gustaría parametrizar, y además estas tablas se pueden llama
igual en bases de datos distintas. Por lo tanto, no puedo crear un sp
publico en la master.

La idea sería tener "sinónimos" o "constantes", de modo de, apuntar en
los sp a estos objetos y no a nombre fijos, así, si el nombre de la BD
cambia, solo tendría que modificar el "sinónimo" o la "constante" y
ya... los SP funcionarían como si nada pasó.

Si alguien tiene alguna idea, le estaré profundamente agradecido.

Atte.

Enrique.

Pd: La explicación en gringo se las quedo debiendo.

Jul 20 '05 #1
1 4068
Enrique Nuñez Fuentes (en*****@vtr.net) writes:
Bueno a los suscritos que lean en español:
Quizás es mejor de usar un group en español, per ejempio
microsoft.public.es.sqlserver. Normalmente, escribimos en ingles aquí.

Mas, creo que comprendo la questión:
Sucede que quisiera parametrizar el nombre que la base de datos en un
SP, es decir :

Create Procedure Prueba
As
Begin
Select * From mibase..mitabla
End

En dode mibase, es mi base de datos, la que pobria tener distintos
nombres.

No puedo usar exec pues solo tengo permiso de ejecución sobre el SP y
por motivos de seguridad no tengo permisos sobre la tabla (mitabla).

Además, estos procedimientos tienen querys con join a distintas bd, las
que me gustaría parametrizar, y además estas tablas se pueden llama
igual en bases de datos distintas. Por lo tanto, no puedo crear un sp
publico en la master.


Hay solo due possibilidads: SQL dinamco, e "system procedures" in master.
Y ambas de cuestas solucionas son malas.

Ver también aquí: http://www.hayes.ch/sql/sql_dinamico.html#Dyn_DB.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Oxygenearth | last post by:
Please who could help me with this... I had my structure in Win32, with Apache, PHP, and MySQL, I had a page in which I am transfering an image to the database in MySQL using PHP. But now I am...
0
by: Oscar22pr | last post by:
QUIERES GANAR DINERO PARA PAGAR TUS DEUDAS??? GASTE 5 MINUTOS DE SU VIDA EN LEER ESTO Y VERA QUE REALMENTE FUNCIONA. LEGALMENTE!!!!!! !!!IMPRIME ESTA HOJA ...YAAAAAAAAAAA!!! Permíteme empezar...
0
by: Eduardo Quiroz Salinas | last post by:
eso... gracias -- ------------------------------- Eduardo Quiroz Salinas 09-5149349 eduardoquiroz@vtr.net -------------------------------
0
by: edward.garnica | last post by:
Buenas Tardes.. Me pueden ayudar diciendome como puedo utilizar la función SendKyes para cerrar un programa que esta abierto en la barra de tareas.. O que comandos debo de darle para que el...
0
by: Santiago Cassina | last post by:
Hi list. I just want to send to you an sql file containing tools for audit the UPDATE and DELETE statements in a database by saving all the modifications made by a network/system/database user. I...
4
by: Dan Krantz | last post by:
I have the following template to ensure that a given number (val) falls into a range (between vmin & vmax): template<typename T> T ForceNumericRange( const T& val, const T& vmin, const T& vmax)...
9
by: aleplgr | last post by:
Hi! I'm trying to let the end-user select the language of the menues I'm showing him. To do that I've got this Selector class that shows the end user a combo box, a label and a button. In the combo...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.