如何通过sql脚本,在sqlserver2000里自动生成数据库啊

createdatabasemydatabase——创建一个名为mydatabase的数据库并尝试一下!

pb执行SQL脚本文件建立数据和表

当然,要在pb中创建数据库,请单击数据库按钮,然后将sql脚本复制并粘贴到ISQLsession下。
我这里有一个例子,这是删除无用的东西后的代码createtableDEPT(DEPTNOchar(2)notnull,DEPTNAMEvarchar(20),primarykey(DEPTNO));createtableCOURSE(CNOchar(4)notnull,CNAMEvarchar(20),CREDITinteger,primarykey(CNO));createtableSTU(STUNOchar(8)notnull,DEPTNOchar(2),STUNAMEvarchar(10),STUSEXchar(2),STUAGEinteger,STUCODEchar(10),主键(STUNO));createtableTEA(TEANOchar(3)notnull,DEPTNOchar(2),CNOchar(4),TEANAMEvarchar(10),TEASEXchar(2),TEACODEchar(10),主键(TEANO));createtableSC(STUNOchar(8)notnull,CNOchar(4)notnull,SCOREinteger,primarykey(STUNO,CNO));altertableSTUaddforeignkeyFK_STU_RELATION__DEPT(DEPTNO)referenceDEPT(DEPTNO)onupdaterestrictionondeleterestriction;alterTEA添加外键FK_TEA_RELATION__DEPT(DEPTNO)referenceDEPT(DEPTNO)直到aterestrictondeleterestrict;altertableTEAaddforeignkeyFK_TEA_RELATION__COURSE(CNO)referencesCOURSE(CNO)onupdaterestrictondeleterestrict;altertableSCaddforeignkeyFK_SC_RELATION__STU(STUNO)referencesSTU(STUNO)onupdaterestrictionondeleterestrict;altertableSCaddforeignkeyFK_SC_RELATION__COURSE(CNO)NO)referencesCOURSE(CNO)onupdaterestrictondeleterestrict;只要把这个粘贴到ISQL部分,然后执行design-excuteisql,执行完之后就看不到数据库中的表了。
相当于刷新