- 1、本文档共19页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
T-SQL语句(建库,建表,事务,存储过程,触发器等...)(国外英文资料)
T-SQL语句(建库,建表,事务,存储过程,触发器等...)
T-SQL statements (library building, table building, transaction, stored procedures, triggers, etc.) drop, database, bankDB
Use master
Exec, sp_attach_db, @dbname=bankDB, @filename1=f:\bank\bankDB_data.mdf -- additional database, parameter 1:, physical name (database name), parameter 2:, file path name
Exec, sp_detach_db,bankDB, null -- separating database parameters, 1: database names, and parameter 2: type values.??
Go
Use master
Go
If exists (select * from, sysdatabases, where, name =bankDB) - to determine if the system exists, the bankDB database exists and is deleted
Drop database bankDB
Go
Exec, xp_cmdshell,mkdir, F:\bank-- new folder
Go
Create database bankDB - new database name
On primary
(
Name = bankDB_data, - logical name
Filename =F:\bank\bankDB_data.mdf, - master database name
Size = 10MB, - file size
Filegrowth = 15% - growth rate
)
Log on
(
Name = bankDB_log, - logical name
Filename =F:\bank\bankDB_log.ldf-- log file
Size = 1MB, - file size
Maxsize = 20MB -- File maximum capacity
Filegrowth = 10% - growth rate
)
Go
Exec, xp_cmdshell,rmdir, F:\bank-- delete database
Use bankDB
Go
If exists (select *, from, sysobjects, where, name =userInfo) - determines whether the table name exists in the system and exists deletion
Drop table userInfo
Go
Create table userInfo - new table name
(
UID, int, not, null, identity (1,1) -- the customer number automatically grows
Uname varchar (8) - not null, account name, required
PID varchar (18) not - null, ID number, required
Telephone varchar (13) - not null, telephone number is required
Address varchar (32) - address, optional input
)
Alter table userInfo
Add, constraint, PK_UID, primary, key (UID) -- primary key constraints
Constraint, UQ_PID, unique (PID) -- unique constraints
Constraint, CK_PID, check (len (PID), =18, or, len (PID), =15) -- check constraints
Constraint CK_telephone check (telephone, like,0[0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9], or, telephone, like,0[0-9][0-9
您可能关注的文档
- 6、冰川地貌.ppt.Convertor(国外英文资料).doc
- 41-高中物理高考适应训练题(三)(国外英文资料).doc
- 6、冰川地貌pptConvertor(国外英文资料).doc
- 7-食品安全2(国外英文资料).doc
- 6个月以后食谱(国外英文资料).doc
- 700多条建筑设计知识(国外英文资料).doc
- 2橡胶(国外英文资料).doc
- 705吹扫方案(国外英文资料).doc
- 6-03癃闭(国外英文资料).doc
- 729_621-褚氏遗书(国外英文资料).doc
- 2024 农业机械行业深度研究报告:农业机械,全球万亿级市场,受益国内回暖、出口加速,格局向头部集中.pptx
- 2024 基础化工行业深度报告:复合肥行业景气向上,布局磷矿未来可期.docx
- 2024 机械行业深度:粮食安全是‘国之大者’,关注农机正当时.pptx
- 2024 机械设备行业深度报告:国产叉车出海空间广阔,锂电池+智能化有望重塑世界新格局.docx
- 2024 豪华车市场分析:市场持续扩容,自主品牌拾级而上.pptx
- 2024 低空系列报告之总览篇:低空腾飞,基建先行.docx
- 2024 从消费者体验的角度看AI对手机行业的影响.docx
- 2024 彩电欧洲线下渠道实录:借助欧洲杯营销,TCL海信加速扩张,渠道渗透率较三星提升空间大.docx
- 2024 L4自动驾驶:Robotaxi研究十问(整体框架篇).pptx
- 2024 AI专题:从模型视角看端侧AI,模型技术持续演进,交互体验有望升级.pptx
文档评论(0)