1
2 /* Sccsid = "%Z% generic/sproc/src/%M% %I% %G%" */
3 /* 4.8 1.1 06/14/90 sproc/src/lock */
4
5 /*
6 ** Messages for "sp_markreport" 17712
7 **
8 ** 17712, "Report must be in your current database."
9 ** 17713, "No such report exists."
10 */
11
12 create procedure sp_markreport
13 @reportname varchar(767) /* proc name we want to mark as report */
14 as
15
16 if @@trancount = 0
17 begin
18 set chained off
19 end
20
21 set transaction isolation level 1
22
23 /*
24 ** Make sure the @reportname is local to the current database.
25 */
26 if @reportname like "%.%.%" and
27 substring(@reportname, 1, charindex(".", @reportname) - 1) != db_name()
28 begin
29 /*
30 ** 17712, "Report must be in your current database."
31 */
32 raiserror 17712
33 return (1)
34 end
35
36 /*
37 ** Make sure that it actually exists as a sproc.
38 */
39 if not exists (select *
40 from sysobjects
41 where id = object_id(@reportname)
42 and sysstat & 7 = 4 /* stored procedure */
43 and uid = user_id())
44 begin
45 /*
46 ** 17713, "No such report exists."
47 */
48 raiserror 17713
49 return (1)
50 end
51
52 update sysobjects
53 set userstat = userstat | - 32768 /* high bit means report */
54 from sysobjects
55 where id = object_id(@reportname)
56 and sysstat & 7 = 4 /* stored procedure */
57 and uid = user_id()
58
59 return (0)
60
exec sp_procxmode 'sp_markreport', 'AnyMode'
go
Grant Execute on sp_markreport to public
go