English 中文(简体)
为什么在批量档案中需要投入,才允许讲卫生运动的特性?
原标题:Why doesn t prompt for input in a batch file allow for a DASH character?

我写了这份简便的批量文件,但如果我输入包含“-”性质的数据库名称,则失败。 难道不确切地说,为什么,但我希望我能这样说?

:: open DB batch file
@echo off
:: starts Sql Server Management Studio Express 2005
:: and opens it to a specific database with query
:: window already open

cls

:SHOWDBNAMES
echo Database names detected on this system:
echo.
"%PROGRAMFILES%Microsoft SQL Server90ToolsBinnOSQL.EXE" -h-1 -S . -E -Q "SELECT CAST(name AS VARCHAR(30)) FROM sysdatabases"

@echo.
set DBNAME=
set /P DBNAME=What database name would you like to open (choose from list)? 

if "%DBNAME%" == "" (
  echo.
  echo I don t recognize your selection. Try again.
  goto SELECTDB
)

:SHOWTABLES
cls
echo.
echo Tables that you can query from %DBNAME% are:
echo.
"%PROGRAMFILES%Microsoft SQL Server90ToolsBinnOSQL.EXE" -h-1 -S . -E -Q "use [%DBNAME%];SELECT CAST(name AS VARCHAR(30)) FROM sys.Tables ORDER BY name"
echo.

:RUNIT
sqlwb.exe -nosplash -S . -E -d %DBNAME%

pause
:EOF
最佳回答

3. 在方括号内附上数据库名称:

http://www.ohchr.org。

下面是工作——你需要以唱名的方式引用数据库名称。 注

:SHOWTABLES
cls
echo.
echo Tables that you can query from %DBNAME% are:
echo.
"%PROGRAMFILES%Microsoft SQL Server90ToolsBinnOSQL.EXE" -h-1 -S . -E -Q "SELECT CAST(name AS VARCHAR(30)) FROM [%DBNAME%].sys.Tables ORDER BY name"
echo.

:RUNIT
sqlwb.exe -nosplash -S . -E -d "%DBNAME%"

我要问的是,这一说法是什么? 设在SSMS的试探员免费向你们提供所有这些信息。

另外,你的笔录还考虑到除违约外的服务器机箱——服务器快递被安装为<机关-名称和编号;SQLEXPRESS<>/代码。

问题回答

为什么不要让你试图强调(_)?

当仪表是数据库名称的第一封信时,它是否在<代码>sqlwb.exe线上失败? 如果是的话,你的问题是,sqlwb正在误用数据库名称作为指挥线选择。 应当采取某种方式,使其不这样做;检查手册。





相关问题
SQL Server database is not visible

I have installed ASP.NET application with database on our server. ASP.NET application created database using connection string below. The problem is that I do not see database in SQL Server Management ...

Most efficient way to store number 11.111 in SQL Server

What datatype is the most efficient to store a number such as 11.111. The numbers will have up 2 digits before the point and up to three after. Currently the column is a bigint , I am guessing that ...

表格和数据表

是否需要在提瓜表之后更新表格统计数据,还是自动更新?

Inconsistent Generate Change Script

I add a column of type tinyint and being set to not allow nulls in a table and generate the change scripts. The table has data in it at this time. The script has code that creates a temp table and ...

Performance of Sql subqueriesfunctions

I am currently working on a particularly complex use-case. Simplifying below :) First, a client record has a many-to-one relationship with a collection of services, that is, a single client may have ...

selecting one value out of an xml column

I have a particularly troublesome xml column to query data from. The schema is fixed by the Quebec Ministry of Revenue so "it is what it is" The important part of the query looks like this: with ...

Selecting records during recursive stored procedure

I ve got a content management system that contains a hierarchical structure of categories, with sub-categories subject to different ordering options at each level. Currently, that s retrieved by a (...

热门标签