sp_tableoption 和OBJECTPROPERTY 用法

sp_tableoption的作用是设置表选项,影响表的某些特定行为,OBJECTPROPERTY 函数用于查看对象的属性。

一,sp_tableoption

Sets option values for user-defined tables. sp_tableoption can be used to control the in-row behavior of tables with varchar(max), nvarchar(max), varbinary(max), xml, text, ntext, image, or large user-defined type columns.

The text/ntext,image in row feature will be removed in a future version of SQL Server. To store large value data, we recommend that you use of the varchar(max), nvarchar(max) and varbinary(max) data types.

Syntax

sp_tableoption [ @TableNamePattern = ] ‘table‘
     , [ @OptionName = ] ‘option_name‘
     ,[ @OptionValue =] ‘value‘

[ @TableNamePattern =] ‘table‘

Is the qualified or nonqualified name of a user-defined database table.

[ @OptionName = ] ‘option_name‘


Value


Description


table lock on bulk load


When disabled (the default), it causes the bulk load process on user-defined tables to obtain row locks. When enabled, it causes the bulk load processes on user-defined tables to obtain a bulk update lock.


large value types out of row


1 = varchar(max), nvarchar(max), varbinary(max), xml and large user-defined type (UDT) columns in the table are stored out of row, with a 16-byte pointer to the root.

0 = varchar(max), nvarchar(max), varbinary(max), xml and large UDT values are stored directly in the data row, up to a limit of 8000 bytes and as long as the value can fit in the record. If the value does not fit in the record, a pointer is stored in-row and the rest is stored out of row in the LOB storage space. 0 is the default value.

[ @OptionValue =] ‘value‘

Is whether the option_name is enabled (TRUE, ON, or 1) or disabled (FALSE, OFF, or 0). value is varchar(12), with no default. value is case insensitive.

Remarks

sp_tableoption can be used only to set option values for user-defined tables. To display table properties, use OBJECTPROPERTY.

二,OBJECTPROPERTY

Returns information about schema-scoped objects in the current database.

Syntax

OBJECTPROPERTY ( id , property )

property

Is an expression that represents the information to be returned for the object specified by id.


Property name


Object type


Description and values returned


TableIsLockedOnBulkLoad


Table


Table is locked due to a bcp or BULK INSERT job.

1 = True

0 = False

Return type: int

三,用法示例

1,设置表的option

exec sys.sp_tableoption @TableNamePattern=‘[dbo].[UserCDC]‘,
                        @OptionName =‘table lock on bulk load‘,
                        @OptionValue =‘true‘

2,查看表的property

select OBJECTPROPERTY(object_id(‘[dbo].[UserCDC]‘),N‘TableIsLockedOnBulkLoad‘)

参考文档:

https://msdn.microsoft.com/zh-cn/library/ms173530.aspx

https://msdn.microsoft.com/zh-cn/library/ms176105.aspx

时间: 2024-08-02 04:43:23

sp_tableoption 和OBJECTPROPERTY 用法的相关文章

SQL中if exists用法细节

用if exists建表[转] 1 判断数据库是否存在 Sql代码 if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名]  if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名] 2 判断表是否存在 Sql代码 if exists (select * from sysobjects w

SQL 系统存储过程用法整理

---------------------------------------------------------------------------------- -- Author : htl258(Tony) -- Date   : 2010-07-06 23:13:19 -- Version: Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86) --          Jul  9 2008 14:43:34 --    

js中获取时间new date()的用法

js中获取时间new date()的用法 获取时间:   var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获取当前年份(2位) 2 myDate.getFullYear(); //获取完整的年份(4位,1970-????) 3 myDate.getMonth(); //获取当前月份(0-11,0代表1月) 4 myDate.getDate(); //获取当前日(1-31) 5 myDate.getDay();

20.5 Shell脚本中的逻辑判断;20.6 文件目录属性判断;20.7 if特殊用法;20.8 20.9 cace判断(上下)

扩展: select用法 http://www.apelearn.com/bbs/thread-7950-1-1.html 20.5 Shell脚本中的逻辑判断 格式1:if 条件 ; then 语句; fi 1. 创建if1.sh测试脚本: [[email protected] ~]# vi if1.sh a=5,如果a大于3,满足这个条件,显示ok 添加内容: #!/bin/bash a=5 if [ $a -gt 3 ] then echo ok fi 2. 执行if1.sh脚本: [[e

20.1 Shell脚本介绍;20.2 Shell脚本结构和执行;20.3 date命令用法;20.4 Shell脚本中的变量

20.1 Shell脚本介绍 1. shell是一种脚本语言 aming_linux blog.lishiming.net 2. 可以使用逻辑判断.循环等语法 3. 可以自定义函数 4. shell是系统命令的集合 5. shell脚本可以实现自动化运维,能大大增加我们的运维效率 20.2 Shell脚本结构和执行 1. 开头(首行)需要加: #!/bin/bash 2. 以#开头的行作为解释说明: 3. 脚本的名字以.sh结尾,用于区分这是一个shell脚本 4. 执行.sh脚本方法有两种:

shell 中seq的用法 echo -n用法

用法:seq [选项]... 尾数 或:seq [选项]... 首数 尾数 或:seq [选项]... 首数 增量 尾数 从1循环到100的两种方法(bash 其它的shell没试过)for x in `seq 1 100`;do echo $x;donefor x in {1..100};do echo $x;done echo -n 不换行输出 $echo -n "123" $echo "456" 最终输出 123456 echo -e 处理特殊字符 若字符串中

sudo的用法

su -l user -C 'COMMAND' 是用user这个用户执行命令 我们一般使用sudo 这个命令 sudo [-u] user COMMAND sudo [-k] COMMAND 清除此前用户的密码. sudo的配置文件/etc/sudoers 配置项为 users    hosts=(runas)    commands users:可以是一个用户的名称也可以是一个组,也可以是一个别名 username #UID user_alias 用户别名的用法 User_Alias NETA

几招学会 Python 3 中 PyMongo 的用法

本文和大家分享的是Python3下MongoDB的存储操作相关内容,在看本文之前请确保你已经安装好了MongoDB并启动了其服务,另外安装好了Python的PyMongo库.下面进入正题,一起来看看吧,希望对大家学习Python3有所帮助. 连接MongoDB 连接MongoDB我们需要使用PyMongo库里面的MongoClient,一般来说传入MongoDB的IP及端口即可,第一个参数为地址host,第二个参数为端口port,端口如果不传默认是27017. import pymongo cl

11 css中分组选择符的用法

<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <style type="text/css"> h1,span{color:red;} a:hover{color:#2EE926;} /*分组选择符的用法*/ </style> </head> <body&