-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmpl_storedProcedure.sql
More file actions
66 lines (54 loc) · 1.23 KB
/
Copy pathtmpl_storedProcedure.sql
File metadata and controls
66 lines (54 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
select 'script is' = '150_<srv>_p_<sproc>', 'The time is :' = getdate(), 'on server' = @@servername
go
Use <db>
go
-- before change row counts
print 'Before image'
if exists (select * from sysobjects where id = object_id(N'[dbo].[<sproc>]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
begin
print ' exec sp_helptext <sproc>'
exec sp_helptext 'dbo.<sproc>'
end
else
print ' <sproc> does not exist'
GO
set XACT_ABORT ON
;
-- for testing,
-- comment out for production migration
begin tran
go
print 'Update Begin'
go
if exists (select * from sysobjects where id = object_id(N'[dbo].[<sproc>]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
begin
print ' Dropping <sproc>'
drop procedure if exists [dbo].[<sproc>]
end
GO
print ' Creating <sproc>'
go
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROCEDURE [dbo].[<sproc>]
<params>
AS
BEGIN
<body>
END
GO
print 'Update Done'
-- after change row counts
print 'After image'
print ' exec sp_helptext <sproc>'
exec sp_helptext 'dbo.<sproc>'
go
-- for testing,
-- comment out for production migration
--rollback tran
commit
go
select 'script is' = '150_<srv>_p_<sproc>', 'The time is :' = getdate(), 'on server' = @@servername
go