批量生成PowerDesigner日期型、中文字符型、数字型测试数据
Powerdesigner可以在数据模型中方便地生成测试数据。本文主要简介利用PowerDesigner生成三种基本类型的数据:日期型、中文字符型、数字型。
基本测试表如下:
基本测试表如下:if exists (select 1
from sysobjects
where id = object_id('DepartDemo')
and type = 'U')
drop table DepartDemo
go
/*==============================================================*/
/* Table: DepartDemo */
/*==============================================================*/
create table DepartDemo (
PKID int identity(101,1),
DName nvarchar(200) null,
DCode nvarchar(500) null,
Manager nvarchar(50) null,
ParentID int null default 0,
AddUser nvarchar(50) null,
AddTime datetime null,
ModUser nvarchar(50) null,
ModTime datetime null,
CurState smallint not null default 0,
Remark nvarchar(500) null,
F1 int not null default 0,
F2 nvarchar(300) null,
constraint PK_DEPARTDEMO primary key (PKID)
)
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'部门表',
'user', @CurrentUser, 'table', 'DepartDemo'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'主键ID',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'PKID'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'名称',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'DName'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'编码',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'DCode'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'主管',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'Manager'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'上级部门',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'ParentID'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'申请人',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'AddUser'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'申请时间',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'AddTime'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'ModUser'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改时间',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'ModTime'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'当前状态',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'CurState'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'备注',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'Remark'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'扩展1',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'F1'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'扩展2',
'user', @CurrentUser, 'table', 'DepartDemo', 'column', 'F2'
go