English 中文(简体)
如何将“不断变动的数据库环境”信息停止至......
原标题:How to stop the "Changed database context to ..." message

是否有办法阻止<代码>。 当部分有<条码>USE 数据库时,将数据库背景改为:?

最佳回答

http://msdn.microsoft.com/en-us/library/ms162773.aspx,>errorlevel of sqlcmd,该编码为0。 注:此处不将错误等级与<代码>sqlcmd的退出代码混为一谈。 转至<代码>cmd.exe,作为<编码>ERRORLEVEL。

为所有<代码>sqlcmd session、使用-m的用户发放这一信息 指挥方案:

sqlcmd -m 1 <other options>

将这一信息分解成一组代码,使用:setvar 战斗指挥:

USE [mydb]
GO

-- Disable message for next USE command
:setvar SQLCMDERRORLEVEL 1
USE [mydb]
GO

-- Reenable
:setvar SQLCMDERRORLEVEL 0

...

为了使用<代码>:setvar(或其他CMD batchtors)在Kall管理演播室使用,你需要使KallCMD能为你回的问窗(门u “Query /QCMD Mode”)使用。 阁下认为,从以下几条线路开始,它就能够做到:有光线背景。

问题回答

I release updates by having SQLCMD run all my .sql scripts in a directory. But when you start everything with a USE myDB you get a repetitive changed context message in the log file, which is dull. So I use this one liner instead. If the context is actually changed, you still get the message, which is good.

缩略语 WHERE DB_NAME(不包括我国)

另一种想法是把三部分名字用在你的座位上,例如......。

USE b. 胎盘; SlectT name from dbo.Authors;

...write...

www.un.org/spanish/sc Pubs.dbo.Authors;

就我而言,简单易行的解决办法是首先处理小问题,例如<代码>SlectT 1;。 通告<代码> 因此,“号”数据库的变更与第1次查询合并,并在没有这一错误信息的情况下检索以下查询。

Simple solution: add -m 1 to your sqlcmd command line arguments.





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签