sybase函数学习(八)
1.alter database? 增加分配給數(shù)據(jù)庫(kù)的控件量<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
alter database mydb on mydate =50?????--(在數(shù)據(jù)庫(kù)設(shè)備mydb 上加<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />50m數(shù)據(jù)空間,)
??????????????????????????????????log on mylog=10????? --(在數(shù)據(jù)庫(kù)設(shè)備mylog上加10m日志空間,)
?
2.alter role? 定義角色之間的互斥關(guān)系;為角色添加,刪除和更改口令;指定口令有效期,最小口令長(zhǎng)度以及知道角色允許的最大登陸嘗試失敗次數(shù).
例子1:將intern_role和specialist_role定義為互斥:
alter role specialist_role add exclusive membership intern_role
?
?
例子2:在成員資格級(jí)別和激活級(jí)別將角色定義為互斥
alter role specialist_role add exclusive membership intern_role
alter role intern_roleadd add exclusive activation surgeon_role
?
例子3:添加口令到現(xiàn)有的角色
alter role doctor_role add password “zhang”
?
例子4:從現(xiàn)有角色刪除口令
alter role doctor_role drop password
?
例子5:鎖定角色physician_role
alter role physician_role? lock
?
例子6:解鎖角色physician_role
alter role physician_role? unlock
?
例子7:將physician_role允許的最大登陸嘗試失敗次數(shù)改為5
alter role physician_role set max failed_logins 5
?
例子8:將現(xiàn)有角色physician_role的最短口令長(zhǎng)度設(shè)置為5個(gè)字符
alter role physician_role set min password length 5
?
例子9:替換所有角色的最短口令長(zhǎng)度
alter role “all overrides”? set min password length-1
?
例子10 刪除所有角色的最大登陸失敗次數(shù)的替換值
alter role? “all overrides”? set max password length-1
?
注意:一般為角色更改口令,請(qǐng)先刪除口令,在添加口令.
?
3.alter table 向表添加新列;刪除或修改現(xiàn)在的列;添加,更改或刪除約束;更改現(xiàn)有表的屬性;啟用或禁用表上的觸發(fā)器;
例子1:向表中添加一列
alter table tablename add? manager_name varchar(50) null
?
例子2: 向表中添加identity列
alter table tablename add? user_id? numeric(19,0) identity
?
例子3 向表中添加主鍵約束.
alter table? autors add? constraint? au_identification primary key(au_id,au_lname,au_fname)
?
例子4 在authors表上創(chuàng)建索引,設(shè)置reservepagegap值為16,在索引中為每15個(gè)分配的頁(yè)留一個(gè)空白頁(yè)
alter table? authors
add constraint au_identification
primary key(au_id,au_lname,au_fname)
with reservepagegap=16
?
例子5 刪除au_identification約束
alter table tablename
drop constraint au_identification
?
例子6 刪除authors表中phone列的缺省約束.如果列允許為空值,則沒(méi)有指定值時(shí)會(huì)插入空值.如果列不允許空值,則不指定列的插入,操作將失敗
alter table? authors
replace? phone default null
?
例子7:為表創(chuàng)建4個(gè)新的頁(yè)鏈.將表分區(qū)后,現(xiàn)有的數(shù)據(jù)會(huì)保存在第一個(gè)分區(qū),但是新的行會(huì)插入到所有這5個(gè)分區(qū)中
alter table tablename? partition 5
?
例子8 并置表的所有頁(yè)鏈,然后將其重新分區(qū)為6個(gè)分區(qū)
alter table tablename? unpartition
alter table tablename? partition 6
?
例子9 將tablename表的鎖定方案更改為數(shù)據(jù)行鎖定
alter table tablename lock datarows
?
例子10 將非空列author_type 添加到缺省值為primary_author的authors表
alter table authors
add author_type varchar(20)
default “primary_author”? not null
?
例子11 從表中刪除列
alter table tablename
drop id,name
?
例子12 將表authors的city列修改為默認(rèn)值為空值的varchar(30)
alter table authors
modify city varchar(30)? null
?
例子13 將stores表中的name列修改為非空.
alter table stores
modify name not null
?
例子14 修改titles表的type列,并將titles表的鎖定方案從所有頁(yè)鎖定更改為數(shù)據(jù)行鎖定
alter? table titles
modify type varchar(10)
lock datarows
?
例子15 將titles表的notes列由varchar(50),將缺省值由空更改為非空,并知道exp_row_size值為40
alter table titles
modify notes varhcar(50)? not null
with? exp_row_size=40
?
例子16 添加,修改和刪除一列,然后在同一查詢中添加另一列.改變鎖定方案,并指定新列的exp_row_size值.
alter table titles
modify city varhcar(50)?? null
drop notes
add sec_advance money default 1000 not null
lock datarows
with? exp_row_size=40
?
轉(zhuǎn)載于:https://www.cnblogs.com/zyl-8183/archive/2006/12/28/606441.html
新人創(chuàng)作打卡挑戰(zhàn)賽發(fā)博客就能抽獎(jiǎng)!定制產(chǎn)品紅包拿不停!總結(jié)
以上是生活随笔為你收集整理的sybase函数学习(八)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 关于Socket通信服务的心跳包(转)
- 下一篇: 高动态范围成像