sql server中可视化建库,如何用脚本语言实现

jill_yang 2000-07-18 09:36:00
我想做一个类似sql server中enterpise manager的界面,并具有其中的一些功能,如果我想建一个新的数据库,通过调用脚本语言来实现,脚本语言准备用T-sql来写,应如何写这个脚本文件?
...全文
141 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
JGTM2000 2000-07-19
  • 打赏
  • 举报
回复
可能你要用的东西是SQLDMO(SQL Server Distributed Management Object)。Enterprise Management只是一个界面,实际的功能执行大多就是用它写成的。它的用法也很简单,你一看就知。
huntout 2000-07-19
  • 打赏
  • 举报
回复
/* ************************* employee table ************************* */
CREATE TABLE employee
(
emp_id empid
CONSTRAINT PK_emp_id PRIMARY KEY NONCLUSTERED
CONSTRAINT CK_emp_id CHECK (emp_id LIKE
'[A-Z][A-Z][A-Z][1-9][0-9][0-9][0-9][0-9][FM]' or
emp_id LIKE '[A-Z]-[A-Z][1-9][0-9][0-9][0-9][0-9][FM]'),
/* Each employee ID consists of three characters that
represent the employee's initials, followed by a five
digit number ranging from 10000 to 99999 and then the
employee's gender (M or F). A (hyphen) - is acceptable
for the middle initial. */
fname varchar(20) NOT NULL,
minit char(1) NULL,
lname varchar(30) NOT NULL,
job_id smallint NOT NULL
DEFAULT 1
/* Entry job_id for new hires. */
REFERENCES jobs(job_id),
job_lvl tinyint
DEFAULT 10,
/* Entry job_lvl for new hires. */
pub_id char(4) NOT NULL
DEFAULT ('9952')
REFERENCES publishers(pub_id),
/* By default, the Parent Company Publisher is the company
to whom each employee reports. */
hire_date datetime NOT NULL
DEFAULT (getdate())
/* By default, the current system date will be entered. */
)

以上是msdn中的一個例子,若想知道更詳細,最好的辦法是先用Enterprise Manager建一個表,然後用Generate SQL Scripts產生sql語句。你不會告訴我不知道Generate SQL Scripts怎麼用吧:p 真不知道也沒關係,可以問我:)
LaoZheng 2000-07-19
  • 打赏
  • 举报
回复
use DataBaseName
go
create table TableName
(field1 int,
filed2 char(10)
..
field3 float
)
go

34,576

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧