Sunday, March 11, 2012

[scripts] prompting user

please, how to promt user in mu sql 2005 script? For example, I need user to
confirm some operations.. .

Thx in advance"fireball" <fireball@.onet.kropka.euwrote in message
news:emdkdr$7ro$1@.nemesis.news.tpi.pl...

Quote:

Originally Posted by

please, how to promt user in mu sql 2005 script? For example, I need user
to confirm some operations.. .
>


Unless something has changed in T-SQL 2005 that I'm not aware of, you can't.

Quote:

Originally Posted by

Thx in advance
>

|||that is cruel.|||so, I neither I can't call one script from another (from the batch I run),
right?

:(|||"fireball" <fireball@.onet.kropka.euwrote in message
news:eme57k$mnn$1@.nemesis.news.tpi.pl...

Quote:

Originally Posted by

so, I neither I can't call one script from another (from the batch I run),
right?


No, you can do that.

Quote:

Originally Posted by

>
:(
>

|||fireball (fireball@.onet.kropka.eu) writes:

Quote:

Originally Posted by

please, how to promt user in mu sql 2005 script? For example, I need
user to confirm some operations.. .


The answer is you don't. SQL Server is a server application, and
server applications communicate with client applications, not with
end users.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Sql is 4gl and asking it to do 3gl operations like prompts and loops
and if then else logic should be illegal although now allowed.

fireball wrote:

Quote:

Originally Posted by

please, how to promt user in mu sql 2005 script? For example, I need user to
confirm some operations.. .
>
Thx in advance

|||well,
is that possible at least, to exit script on given condition?|||fireball wrote:

Quote:

Originally Posted by

well,
is that possible at least, to exit script on given condition?


Do you want a return code or not? If you don't want a return code
then you can wirite:
If <conditionReturn
If you want a return code then you need to use a stored proc and inside
the procedure you can write:
If <conditionreturn 100
In your application you can check for status of the called procedure
and take action based on that.|||fireball (fireball@.onet.kropka.eu) writes:

Quote:

Originally Posted by

is that possible at least, to exit script on given condition?


Depends on how run it. In SQLCMD or OSQL you can exit immediately
by using a RAISERROR with state 127:

RAISERROR('Got a good reson for taking the easy way out now', 16, 127)

This does not work from Query Analyzer or Mgmt Studio.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Uzytkownik "Erland Sommarskog" <esquel@.sommarskog.senapisal w wiadomosci

Quote:

Originally Posted by

RAISERROR('Got a good reson for taking the easy way out now', 16, 127)


Uzytkownik <othellomy@.yahoo.comnapisal w wiadomosci

Quote:

Originally Posted by

If <conditionReturn


all this hepled.

No comments:

Post a Comment