Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1827971
  • 博文数量: 323
  • 博客积分: 5970
  • 博客等级: 大校
  • 技术积分: 2764
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-03 23:13
文章分类

全部博文(323)

文章存档

2018年(2)

2017年(11)

2016年(10)

2015年(27)

2014年(2)

2013年(30)

2012年(197)

2011年(44)

分类: Oracle

2013-06-05 16:50:23

---CREATE PROCEDURE tesetp1
---	@p1 varchar(36),@p2 nvarchar(36)=N'test'

--AS
--	SELECT @p1, @p2
---GO

---select convert(char, getdate(), 114) --hh:mm:ss:mmm(24h)

----create Procedure-------------------------------

IF EXISTS (
  SELECT *
    FROM INFORMATION_SCHEMA.ROUTINES
   WHERE
      SPECIFIC_NAME = N'GenerateMInstanceData'
)
   DROP PROCEDURE GenerateMInstanceData
GO

create PROCEDURE GenerateMInstanceData

@id_1 nvarchar(36)=null,@id_2 nvarchar(36)=null,@id_3 nvarchar(36)=null,@id_4 nvarchar(36)=null,@name varchar(200)=null

AS
set nocount on
--print @id_1;
--print @id_2;
--print @id_3;
--print @id_4;
--print @name;
--GO
--exec GenerateMInstanceData N'1'
	--SELECT @p1, @p2
--GO
--execute tesetp N'hello',N'world'

--declare @time nvarchar(36);
--select @time=getdate();
--print @time;

--declare @id_1 nvarchar(36),@id_2 nvarchar(36),@id_3 nvarchar(36),@id_4 nvarchar(36),@name varchar(200);
 select @id_1=newid();--N'1f5bd90a-d73b-4433-8b32-d1015b65d4e5';
  select  @id_2=newid();--N'10f19992-4229-4a5f-afe5-79e6f02dc086';
  select  @id_3=newid();--N'179d04ba-9522-47a2-900f-34d352e669e8';
  select  @id_4=newid();--N'1be09d59-2e5f-4ef5-b51a-ba86eb666aa7';
  select @name=replace(convert(varchar, getdate(), 114),N':',N'');

--print @id_1;
--print @id_2;
--print @id_3;
--print @id_4;
--print @name;

exec sp_executesql N'INSERT INTO mcore_minstance (name, typeid, id) VALUES (@p0, @p1, @p2)',N'@p0 nvarchar(4000),@p1 nvarchar(36),@p2
nvarchar(36)',@p0=NULL,@p1=N'1f83f985-4e3b-4cf7-996a-f08459996870',@p2=@id_1

exec sp_executesql N'INSERT INTO mcore_mslot (instanceid, featureid, value, id) VALUES (@p0, @p1, @p2, @p3)',N'@p0 nvarchar(36),@p1 nvarchar(36),@p2
nvarchar(4000),@p3
nvarchar(36)',@p0=@id_1,@p1=N'3773e5e9-eab6-4f33-bc0e-839ddcb2b95b',@p2=NULL,@p3=@id_2

exec sp_executesql N'INSERT INTO mcore_mdataslot (datavalue, id) VALUES (@p0, @p1)',N'@p0 varchar(200),@p1
nvarchar(36)',@p0=@name,@p1=@id_2

exec sp_executesql N'INSERT INTO mcore_mslot (instanceid, featureid, value, id) VALUES (@p0, @p1, @p2, @p3)',N'@p0 nvarchar(36),@p1 nvarchar(36),@p2
nvarchar(4000),@p3
nvarchar(36)',@p0=@id_1,@p1=N'526684f7-c7a4-4aa1-b699-0404c8284a8c',@p2=NULL,@p3=@id_3

exec sp_executesql N'INSERT INTO mcore_mdataslot (datavalue, id) VALUES (@p0, @p1)',N'@p0 varchar(200),@p1
nvarchar(36)',@p0=@name,@p1=@id_3

exec sp_executesql N'INSERT INTO mcore_mslot (instanceid, featureid, value, id) VALUES (@p0, @p1, @p2, @p3)',N'@p0 nvarchar(36),@p1 nvarchar(36),@p2
nvarchar(36),@p3
nvarchar(36)',@p0=@id_1,@p1=N'14a55b56-5bac-4873-80ef-f7ed68c6ed6d',@p2=N'9d3722c0-6ed6-4648-92f2-322827b26fa9',@p3=@id_4

exec sp_executesql N'UPDATE mcore_minstance SET name = @p0, typeid = @p1 WHERE id = @p2',N'@p0 varchar(200),@p1 nvarchar(36),@p2
nvarchar(36)',@p0=@name,@p1=N'1f83f985-4e3b-4cf7-996a-f08459996870',@p2=@id_1

exec sp_executesql N'UPDATE mcore_mslot SET instanceid = @p0 WHERE id = @p1',N'@p0 nvarchar(36),@p1
nvarchar(36)',@p0=@id_1,@p1=@id_2

exec sp_executesql N'UPDATE mcore_mslot SET instanceid = @p0 WHERE id = @p1',N'@p0 nvarchar(36),@p1
nvarchar(36)',@p0=@id_1,@p1=@id_3

exec sp_executesql N'UPDATE mcore_mslot SET instanceid = @p0 WHERE id = @p1',N'@p0 nvarchar(36),@p1
nvarchar(36)',@p0=@id_1,@p1=@id_4

GO

USE IOneDatabase;
GO
declare @count int;
set @count=1000;
print getutcdate()
print  N' Starting...';
WHILE (@count > 0)
	BEGIN
		exec GenerateMInstanceData;
		set @count=@count-1;
	END
GO
print getutcdate()
print N'Execute Completed';

10W条花了3个小时,看来效率很低啊


阅读(1040) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~