一 --SQLserver 生成字段说明的语句
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字段说明' ,
@level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE',
@level1name=N'表名', @level2type=N'COLUMN', @level2name=N'列名'
二
弹出了对话框。新建一个数据模型。在Name里面可以随便输入。Copy from选择SQLServer2005模型(如果没有,可以选择SQLServer2000)。保存模板。
三 打开 SQL2005_User-》 Script-》 Column -》 ColumnComment
编辑刚才的模板。
输入上面的代码
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'%COMMENT%', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'%TABLE%', @level2type=N'COLUMN',@level2name=N'%COLUMN%'
四 新建项目,选择刚才的模板。
五 生成数据库,选择生成脚本
/*==============================================================*/
/* DBMS name: mysqlserver */
/* Created on: 2021-07-21 11:07:40 */
/*==============================================================*/
if exists (select 1
from sysobjects
where id = object_id('Device')
and type = 'U')
drop table Device
go
/*==============================================================*/
/* Table: Device */
/*==============================================================*/
create table Device (
DeviceId varchar(50) null,
Ip varbinary(50) null,
sourceid varchar(50) null,
devicename varchar(50) null,
devicetype varchar(50) null,
createtime datetime null,
updatetime datetime null,
createuser varchar(50) null,
updateuser varchar(50) null,
devicestate int null
)
go
if exists (select 1 from sys.extended_properties
where major_id = object_id('Device') and minor_id = 0)
begin
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
'user', @CurrentUser, 'table', 'Device'
end
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'Device',
'user', @CurrentUser, 'table', 'Device'
go
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'DeviceId', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'DeviceId'
go
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'Ip', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'Ip'
go
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'sourceid', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'sourceid'
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'设备名称', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'devicename'
go
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'devicetype', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'devicetype'
go
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'createtime', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'createtime'
go
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'update time', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'updatetime'
go
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'createuser', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'createuser'
go
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'updateuser', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'updateuser'
go
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'devicestate', @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'Device', @level2type=N'COLUMN',@level2name=N'devicestate'
go
导出图片的方法
全选 ctrl+a ,然后选择 编辑-》导出图像=》选择导出图片。(最好选svg格式,可以放大,不模糊)。如果导出图像按钮是灰色的,说明你没有执行全选。