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