Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Other SQL Server Topics / December 2006

Tip: Looking for answers? Try searching our database.

[scripts] prompting user

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fireball - 21 Dec 2006 09:26 GMT
please, how to promt user in mu sql 2005 script? For example, I need user to
confirm some operations.. .

Thx in advance
Greg D. Moore (Strider) - 21 Dec 2006 12:50 GMT
> 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.

> Thx in advance
fireball - 21 Dec 2006 14:06 GMT
that is cruel.
fireball - 21 Dec 2006 14:13 GMT
so, I neither I can't call one script from another (from the batch I run),
right?

:(
Greg D. Moore (Strider) - 21 Dec 2006 14:57 GMT
> so, I neither I can't call one script from another (from the batch I run),
> right?

No, you can do that.

> :(
Erland Sommarskog - 21 Dec 2006 23:00 GMT
> 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.

Signature

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
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

othellomy@yahoo.com - 22 Dec 2006 05:14 GMT
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.

> please, how to promt user in mu sql 2005 script? For example, I need user to
> confirm some operations.. .
>
> Thx in advance
fireball - 28 Dec 2006 09:35 GMT
well,
is that possible at least, to exit script on given condition?
othellomy@yahoo.com - 28 Dec 2006 10:27 GMT
> 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 <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.
Erland Sommarskog - 28 Dec 2006 22:57 GMT
> 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.

Signature

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
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

fireball - 29 Dec 2006 15:37 GMT
Uzytkownik "Erland Sommarskog" <esquel@sommarskog.se> napisal w wiadomosci
>   RAISERROR('Got a good reson for taking the easy way out now', 16, 127)

Uzytkownik <othellomy@yahoo.com> napisal w wiadomosci
> If <condition> Return

all this hepled.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.