all groups > sql server (alternate) > december 2006 >
You're in the

sql server (alternate)

group:

[scripts] prompting user


[scripts] prompting user fireball
12/21/2006 10:26:40 AM
sql server (alternate):
please, how to promt user in mu sql 2005 script? For example, I need user to
confirm some operations.. .

Thx in advance

Re: [scripts] prompting user Greg D. Moore (Strider)
12/21/2006 12:50:02 PM

[quoted text, click to view]

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


[quoted text, click to view]

Re: [scripts] prompting user Greg D. Moore (Strider)
12/21/2006 2:57:10 PM

[quoted text, click to view]

No, you can do that.


[quoted text, click to view]

Re: [scripts] prompting user fireball
12/21/2006 3:06:13 PM
that is cruel.

Re: [scripts] prompting user fireball
12/21/2006 3:13:15 PM
so, I neither I can't call one script from another (from the batch I run),
right?

:(

Re: prompting user othellomy NO[at]SPAM yahoo.com
12/21/2006 9:14:26 PM
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.

[quoted text, click to view]
Re: [scripts] prompting user Erland Sommarskog
12/21/2006 11:00:22 PM
fireball (fireball@onet.kropka.eu) writes:
[quoted text, click to view]

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/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
Re: prompting user Erland Sommarskog
12/28/2006 12:00:00 AM
fireball (fireball@onet.kropka.eu) writes:
[quoted text, click to view]

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/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
Re: prompting user othellomy NO[at]SPAM yahoo.com
12/28/2006 2:27:34 AM
[quoted text, click to view]

Do you want a return code or not? If you don't want a return code
then you can wirite:
If <condition> Return
If you want a return code then you need to use a stored proc and inside
the procedure you can write:
If <condition> return 100
In your application you can check for status of the called procedure
and take action based on that.
Re: prompting user fireball
12/28/2006 10:35:56 AM
well,
is that possible at least, to exit script on given condition?

Re: prompting user fireball
12/29/2006 4:37:51 PM
Uzytkownik "Erland Sommarskog" <esquel@sommarskog.se> napisal w wiadomosci
[quoted text, click to view]

Uzytkownik <othellomy@yahoo.com> napisal w wiadomosci
[quoted text, click to view]




all this hepled.

AddThis Social Bookmark Button