Wednesday, March 21, 2012

Prompt for a database name

Hi,
Is there a way to prompt someone to enter a database name in a script? For
example, I have a script where I need to update a table to set a column with
a value found in another table in another database. We don't know exactly
what the actual db name is of where to find the table and we would like, in
the script, to be able to allow the user enter the db name so that we can do
the update correctly. We don't want to have the user to manually update
script to specify the db name in the update statement, but rather prompt them
for the name so that we can do the update for them.
Thanks in advance,
Dee
Hi Tibor,
We're using Query Analyzer. When we upgrade a customer's database for db
changes, we actually create a script where we have them run it manually via
Query Analyzer.
Thanks!
Dee
"Tibor Karaszi" wrote:

> SQL Server cannot prompt, it is a service running on a server machine. The client app can. What
> app/tool are you using? SQLCMD, OSQL, SSMS, QA, something else?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "bpdee" <bpdee@.discussions.microsoft.com> wrote in message
> news:130AABB7-8F8B-4F47-8A27-119F022F49F3@.microsoft.com...
>

No comments:

Post a Comment