使用t-sql语句在sqlserver里建库建表建约束(Use the T-SQL statement to build the database in sqlserver and build a constraint).docVIP
- 8
- 0
- 约 10页
- 2017-07-24 发布于河南
- 举报
使用t-sql语句在sqlserver里建库建表建约束(Use the T-SQL statement to build the database in sqlserver and build a constraint)
使用t-sql语句在sqlserver里建库建表建约束(Use the T-SQL statement to build the database in sqlserver and build a constraint)
- use xp_cmdshell to use the DOS command
Exec, sp_configure,show, advanced, options, 1
Go
RECONFIGURE
Go
Exec sp_configurexp_cmdshell, 1
Go
RECONFIGURE
Go
- create a folder in the D disk project
Exec xp_cmdshellmkdir D:\project
Go
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
-- database building section
-- whether the query is known as the database for MySchool
Use master - sets the current database to master to access the sysdatabases table
Go
Delete him if you have a MYSCHOOL database
If, exists (select * from, sysdatabases, where, name =MySchool)
Drop database MySchool
The new database named MySchool
Create database MySchool
On primary
(
Specific description: main data file
Name =MySchool_data1,
Filename =D:\project\MySchool1_data.mdf,
Size = 10,
Maxsize = unlimited,
Filegrowth = 20%
)
Log on
(- log file 1 describes
Name =MySchool_log1,
Filename =D:\project\MySchool1_log.ldf,
Size = 3,
Maxsize = 20,
Filegrowth = 1
)
Go
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
Create table parts
Use MySchool -- a new table in MySchool
Go
Delete if it exists
If exists (select * from, sysobjects, where, name, =Subject)
Drop table Subject
Create table Subject -- a new table
(
SubjectNo, int, identity (1,1), not, null - - course number
SubjectName nvarchar (50) not null - - course name
ClassHour int, - class hour
GradeID int - age number
)
Go
Use MySchool -- a new table in MySchool
GO
If exists (select * from, sysobjects, where, name, =Result)
Drop table Result
Create table Result
(
StudentNo, int, not, null -- student number
Subj
您可能关注的文档
- 中国和美国人的生活水平(The standard of living in China and the United States).doc
- 中国地质大学(北京)初复试考点友情提示(China University of Geosciences (Beijing) first retest examination center friendship tips).doc
- 中国对外战略难比马歇尔计划(China's foreign strategy is more difficult than Marshall plan).doc
- 中国平面设计 指导价格(China graphic design guide price).doc
- 中国居民膳食营养参考摄入量(Dietary reference intakes of Chinese Residents).doc
- 中国彩妆市场分析(Analysis of Chinese make-up Market).doc
- 中国律师现状想说爱你不容易(Chinese lawyer status quo it's not easy to say love you).doc
- 中国拥有世界最强国防工业(China has the strongest defense industry in the world).doc
- 中国新能源产业打造规模竞争优势(China's new energy industry to create scale competitive advantage).doc
- 中国特色道路接下来该如何走(Chinese characteristic road, then how to go).doc
- 使用文章(Use article).doc
- 侍道2个人心得(2 people on the way).doc
- 供应串励式直流电机控制器(Supply series type DC motor controller).doc
- 供热改革十年仍遇双重难题 制度待完善(Heating reform ten years still encounter double problems, the system needs to be improved).doc
- 供电企业班组绩效管理(Power supply enterprise, team, performance management).doc
- 供电技术(Power supply technology).doc
- 侠盗圣安地女友攻略(Grand Theft Auto Antoine girlfriend Raiders).doc
- 使人肃然起敬十二月党人的妻子们(The venerable party December wives).doc
- 你读懂人民币汇率问题的好文(You read the text of the RMB exchange rate issue).doc
- 便利店做o2o的14种模式解析(14 modes of doing o2o for convenience store).doc
最近下载
- 在线网课学堂《舰艇动力装置》单元测试考核答案.pdf VIP
- T8联考暨“五市十校”教学联盟2026届高三上学期12月检测训练物理试卷(含解析).pdf VIP
- 在线网课学堂《舰艇结构》单元测试考核答案.pdf VIP
- 船舶柴油机装配与调试章节及期末答案.docx VIP
- 1.近五年(2021-205)全国高考英语高频词汇必备表汇总(打印版).docx
- 思迅eshop小象称重管理系统5使用手册.pdf VIP
- 甘肃省武威市、嘉峪关市、临夏州2025年中考化学真题[含答案].pdf
- DB65T4502-2022 大中型灌区信息化建设技术指南.pdf VIP
- 2026年江苏南通市高三一模高考语文试卷试题(答案详解).pdf VIP
- 幼儿园小学中国传统文化《十二生肖常识介绍》PPT课件.pptx VIP
原创力文档

文档评论(0)