IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_g_worktime]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_g_worktime]
GO

CREATE proc [dbo].[mps_g_worktime]
@cmpid int
as
begin
set nocount on
declare @count int
select @count=count(*) from mps_worktime

if @count = 0
begin
insert into mps_worktime(wt_cmpid,wt_title,wt_time1,wt_time2,wt_iswork)
values(@cmpid,'上班之前','','',1),(@cmpid,'上午','','',0),(@cmpid,'午休','','',1)
,(@cmpid,'下午','','',0),(@cmpid,'下班之后','','',1)
end

select * from mps_worktime where wt_cmpid=@cmpid order by wt_id
end