T-SQL语句(建库,建表,事务,存储过程,触发器等...)(国外英文资料).doc

T-SQL语句(建库,建表,事务,存储过程,触发器等...)(国外英文资料).doc

  1. 1、本文档共19页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 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

您可能关注的文档

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档