QuotedIdentifierStatus 属性
获取或设置一个 Boolean 属性值,该值指定由双引号分隔的标识符是否为 Transact-SQL 保留关键字,或者是否包含 Transact-SQL 语法规则通常不允许的字符。
命名空间: Microsoft.SqlServer.Management.Smo
程序集: Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)
语法
声明
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.ReadOnlyAfterCreation Or SfcPropertyFlags.Standalone Or SfcPropertyFlags.SqlAzureDatabase Or SfcPropertyFlags.Design)> _
Public Property QuotedIdentifierStatus As Boolean
Get
Set
用法
Dim instance As Table
Dim value As Boolean
value = instance.QuotedIdentifierStatus
instance.QuotedIdentifierStatus = value
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.ReadOnlyAfterCreation|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase|SfcPropertyFlags.Design)]
public bool QuotedIdentifierStatus { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::None|SfcPropertyFlags::ReadOnlyAfterCreation|SfcPropertyFlags::Standalone|SfcPropertyFlags::SqlAzureDatabase|SfcPropertyFlags::Design)]
public:
virtual property bool QuotedIdentifierStatus {
bool get () sealed;
void set (bool value) sealed;
}
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.ReadOnlyAfterCreation|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase|SfcPropertyFlags.Design)>]
abstract QuotedIdentifierStatus : bool with get, set
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.ReadOnlyAfterCreation|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase|SfcPropertyFlags.Design)>]
override QuotedIdentifierStatus : bool with get, set
final function get QuotedIdentifierStatus () : boolean
final function set QuotedIdentifierStatus (value : boolean)
属性值
类型:System. . :: . .Boolean
一个 Boolean 值,该值指定如何为表处理带引号的标识符。
如果为 True,则可以使用带引号的标识符来允许 Transact-SQL 语法规则中通常不允许的字符。
如果为 False(默认值),则带引号的标识符将用于指定 Transact-SQL 保留关键字。
实现
示例
The following code example gets and displays the quoted identifier status of each table in the AdventureWorks2008R2 database.
C#
Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2008R2"];
foreach (Table tb in db.Tables)
{
if (tb.QuotedIdentifierStatus == true)
{
Console.WriteLine("Quoted identifiers in " + tb.Name + " may be used to allow characters that are normally prohibited by
SQL syntax rules.");
}
else
{
Console.WriteLine("Quoted identifiers in " + tb.Name + " can only be used to specify reserved SQL keywords.");
}
}
Powershell
$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")
Foreach ($tb in $db.Tables)
{
if ($tb.QuotedIdentifierStatus -eq $TRUE)
{
Write-Host "Quoted identifiers in" $tb.Name "may be used to allow characters that are normally prohibted by SQL syntax
rules."
}
else
{
Write-Host "Quoted identifiers in" $tb.Name "can only be used to specify reserved SQL keywords."
}
}