日期:2014-05-19  浏览次数:20519 次

如何为表的字符字段生成测试数据
table(id,content)   id为int   ,content为varchar

我想生成1万条测试数据,content的内容随机生成。

------解决方案--------------------
select top 10000 id=identity(int,1,1),content = newid() into #t from sysobjects,syscolumns

select * from #t
------解决方案--------------------
insert into [table](id,content)
select top 10000 1,newid() from syscolumns,syscolumns
------解决方案--------------------
SELECT TOP 10000 id=identity(int,1,1),content = description into #t FROM master.dbo.sysmessages WHERE msglangid IN ( '2052 ', '1028 ')
ORDER BY NEWID()
GO
SELECT * FROM #t