Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

sqlcmd in silent mode

 
   Database Help (Home) -> Programming RSS
Next:  Table Joins  
Author Message
John

External


Since: Jun 01, 2007
Posts: 3



(Msg. 1) Posted: Mon Feb 19, 2007 12:29 pm
Post subject: sqlcmd in silent mode
Archived from groups: microsoft>public>sqlserver>programming (more info?)

Is it possible to run sqlcmd in silent, or quiet mode where the console
window does not appear?

I am setting up an automatic backup system using calls to sqlcmd -Q with
the Windows Task Scheduler. The transaction log backups, especially,
will likely be run as users are working on the application. I do not
want the sqlcmd window to suddenly appear and then dissapear while the
user is working at their computer.

Thanks.

 >> Stay informed about: sqlcmd in silent mode 
Back to top
Login to vote
Tibor Karaszi

External


Since: Jan 29, 2004
Posts: 1559



(Msg. 2) Posted: Mon Feb 19, 2007 10:33 pm
Post subject: Re: sqlcmd in silent mode [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

It is not SQLCMD, it is the Windows handling which is the problem. Windows does echo the output when
you execute something. Either have a scheduler with the ability to suppress the console output (like
SQL Server agent does), or perhaps do a little bit of .NET coding and use SMO for the backups?

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi


"John" wrote in message
> Is it possible to run sqlcmd in silent, or quiet mode where the console window does not appear?
>
> I am setting up an automatic backup system using calls to sqlcmd -Q with the Windows Task
> Scheduler. The transaction log backups, especially, will likely be run as users are working on the
> application. I do not want the sqlcmd window to suddenly appear and then dissapear while the user
> is working at their computer.
>
> Thanks.

 >> Stay informed about: sqlcmd in silent mode 
Back to top
Login to vote
John

External


Since: Jun 01, 2007
Posts: 3



(Msg. 3) Posted: Mon Feb 19, 2007 10:33 pm
Post subject: Re: sqlcmd in silent mode [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tibor Karaszi wrote:
> It is not SQLCMD, it is the Windows handling which is the problem.
> Windows does echo the output when you execute something. Either have a
> scheduler with the ability to suppress the console output (like SQL
> Server agent does), or perhaps do a little bit of .NET coding and use
> SMO for the backups?
>
The strangest thing, if I run the task as NT AUTHORITY\SYSTEM the window
does not appear. Luckily, NT AUTHORITY\SYSTEM has rights in SQL Server
to perform backups.

I can't use SMO because we need to support Express Edition, which does
not have the Agent.
 >> Stay informed about: sqlcmd in silent mode 
Back to top
Login to vote
Tibor Karaszi

External


Since: Jan 29, 2004
Posts: 1559



(Msg. 4) Posted: Tue Feb 20, 2007 2:36 pm
Post subject: Re: sqlcmd in silent mode [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> The strangest thing, if I run the task as NT AUTHORITY\SYSTEM the window does not appear. Luckily,
> NT AUTHORITY\SYSTEM has rights in SQL Server to perform backups.

That is because the process started now isn't in your own user name context, so it will not have the
screen that you see. This is why you don't see the console.


> I can't use SMO because we need to support Express Edition, which does not have the Agent.

SMO is not the same thing as Agent. You can write an app using SMO and schedule it using the Windows
Scheduler.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


"John" wrote in message
> Tibor Karaszi wrote:
>> It is not SQLCMD, it is the Windows handling which is the problem. Windows does echo the output
>> when you execute something. Either have a scheduler with the ability to suppress the console
>> output (like SQL Server agent does), or perhaps do a little bit of .NET coding and use SMO for
>> the backups?
>>
> The strangest thing, if I run the task as NT AUTHORITY\SYSTEM the window does not appear. Luckily,
> NT AUTHORITY\SYSTEM has rights in SQL Server to perform backups.
>
> I can't use SMO because we need to support Express Edition, which does not have the Agent.
 >> Stay informed about: sqlcmd in silent mode 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
sqlcmd mode and r command - I have this small piece of SQL running in sqlcmd mode. DECLARE @v VARCHAR (MAX) SET @v = 'c:\asdf.sql' :setvar filename @v PRINT $(filename) :r $(filename) I get this error: A fatal scripting error occurred. The file specified for :r command was not..

sqlcmd -v - Hello, SQL Server 2005 STD edition SP1 Trying to call the following from a stored Proc. Yes XP_CmdShell is enabled Declare @Server_Instance sysname ,@cmd varchar(1000) set @Server_Instance = 'Server\Instance' set @cmd = 'SQLCMD -S<Host serve...

SQLCMD Output - Hello, The documentation says that sqlcmd shows column headers above an output resultset. That is what I want. I use the -o parameter (tried the >> operator also) to put the output in a file. There are no column headers in the file. Am I missing....

SQLCMD -L doesn't find all my servers - I have one domain with many SQL servers. Of them all, 4 (that i know of) aren't being found. Can someone point me to some good documentation on how SQLCMD -L works. Also, has anyone else seen this, and have they solved it? Thanks. -- The Spirit....

sqlcmd output is UTF-8 - If I create a simple sqlcmd script: :out c:\temp\temp2.sql SELECT 1 GO :out STDOUT and run it, the output appears to be UTF-8. This causes problems not least because SSMS saves code as ANSI. I can open the output files in Notepad and save them a...
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]