DatabaseProcApplicationCreatedLinks
sybsystemprocssp_checkreswords  31 Aug 14Defects Dependencies

1     /*
2     **Messages for "sp_checkreswords"	18035
3     **
4     ** 17232, "No user with the specified name exists in the current database."
5     ** 18035, "Reserved Words Used as Database Object Names for Database, "
6     ** 18036, " Upgrade renames sysobjects.schema to sysobjects.schemacnt."
7     ** 18037, " Found no reserved words used as names for database-wide objects."
8     ** 18038, " Found no reserved words used as database object names."
9     */
10    create procedure sp_checkreswords
11        @user_name_param varchar(30) = NULL
12    as
13    
14    
15        declare @msg varchar(1024)
16    
17        declare @baduse_cnt int /* Return the count of items that */
18        /* have reserved word names.	  */
19        declare @owner_cnt int /* Count of owner-based bad items */
20    
21        declare @uid_param int
22        declare @user_name varchar(30)
23        declare @dbname varchar(30)
24        declare @uid int
25    
26        /*
27        ** Note: do not set isolation level, because this sproc must run in
28        ** 4.x as well as System 10.
29        **
30        ** Also, do not call sp_getmessage since this sproc must run on 4.8
31        ** which cannot support the '%1!' syntax in the print statement.
32        ** The main side affect of this is that the messages printed out by
33        ** this sproc are not localized.
34        */
35    
36        set nocount on
37    
38        /*
39        ** 18035, "Reserved Words Used as Database Object Names for Database, "
40        **
41        ** NOTE:  sp_getmessage is not used for retrieving message text
42        ** because this sproc must also run on 4.8 servers which cannot
43        ** support the '%1!' syntax in the print statement.
44        */
45        select @dbname = db_name()
46        select @msg = description from master.dbo.sysmessages
47        where error = 18035
48            and langid is NULL
49        select @msg = @msg + @dbname + "."
50        print @msg
51        print ""
52    
53        select @baduse_cnt = 0
54    
55        create table #uids
56        (
57            uid int NULL,
58            catagory char(1)
59        )
60    
61        if (@user_name_param is NULL or @user_name_param = "dbo")
62        begin
63            /*
64            ** 18036, " Upgrade renames sysobjects schema to sysobjects schemacnt."
65            **
66            ** NOTE:  sp_getmessage is not used for retrieving message text
67            ** because this sproc must also run on 4.8 servers which cannot
68            ** support the '%1!' syntax in the print statement.
69            */
70            select @msg = description from master.dbo.sysmessages
71            where error = 18036
72                and langid is NULL
73            print @msg
74            print ""
75        end
76    
77        if (@user_name_param is not NULL)
78        begin
79            select @uid_param = user_id(@user_name_param)
80            if (@uid_param is NULL)
81            begin
82                /*
83                ** 17232, "No user with the specified name exists in the 
84                **	   current database."
85                **
86                ** NOTE:  sp_getmessage is not used for retrieving message text
87                ** because this sproc must also run on 4.8 servers which cannot
88                ** support the '%1!' syntax in the print statement.
89                */
90                select @msg = description from master.dbo.sysmessages
91                where error = 17232
92                    and langid is NULL
93                print @msg
94                return (0)
95            end
96    
97            insert #uids
98            select o.uid, "c"
99            from sysobjects o, master.dbo.spt_values v, syscolumns c
100           where lower(c.name) = v.name and v.type = 'W'
101               and c.id = o.id
102               and o.uid = @uid_param
103               and not (o.id = 1 and c.name = "schema")
104           group by o.uid
105           order by o.uid
106   
107           insert #uids
108           select o.uid, "i"
109           from sysobjects o, master.dbo.spt_values v, sysindexes i
110           where lower(i.name) = v.name and v.type = 'W'
111               and i.id = o.id
112               and o.uid = @uid_param
113               and i.indid != 0 and i.indid != 255
114           group by o.uid
115           order by o.uid
116   
117           insert #uids
118           select o.uid, "o"
119           from sysobjects o, master.dbo.spt_values v
120           where lower(o.name) = v.name and v.type = 'W'
121               and o.uid = @uid_param
122           group by o.uid
123           order by o.uid
124   
125           insert #uids
126           select t.uid, "t"
127           from systypes t, master.dbo.spt_values v
128           where lower(t.name) = v.name and v.type = 'W'
129               and t.uid = @uid_param
130           group by t.uid
131           order by t.uid
132       end
133       else
134       begin
135           /*
136           ** Get the uids into a temp table.
137           */
138   
139           insert #uids
140           select o.uid, "c"
141           from sysobjects o, master.dbo.spt_values v, syscolumns c
142           where lower(c.name) = v.name and v.type = 'W'
143               and c.id = o.id
144               and not (o.id = 1 and c.name = "schema")
145           group by o.uid
146           order by o.uid
147   
148           insert #uids
149           select o.uid, "i"
150           from sysobjects o, master.dbo.spt_values v, sysindexes i
151           where lower(i.name) = v.name and v.type = 'W'
152               and i.id = o.id
153               and i.indid != 0 and i.indid != 255
154           group by o.uid
155           order by o.uid
156   
157           insert #uids
158           select o.uid, "o"
159           from sysobjects o, master.dbo.spt_values v
160           where lower(o.name) = v.name and v.type = 'W'
161           group by o.uid
162           order by o.uid
163   
164           insert #uids
165           select t.uid, "t"
166           from systypes t, master.dbo.spt_values v
167           where lower(t.name) = v.name and v.type = 'W'
168           group by t.uid
169           order by t.uid
170       end
171   
172       /* Not using cursors because this sproc must run in 4.x, in order for 
173       ** clients to check their databases before upgrade.
174       */
175   
176       select @user_name = min(user_name(uid)) from #uids
177   
178       while (@user_name is not NULL)
179       begin
180           /* Print the owner-specific information:
181           **    columns, indexes, objects(tables, sprocs, etc.), and datatypes
182           */
183   
184           select @uid = user_id(@user_name)
185           select "Owner" = @user_name
186   
187           if exists (select * from #uids
188                   where user_name(uid) = @user_name and catagory = "c")
189           begin
190               select "Table" = o.name,
191                   "Reserved Word Column Names " = c.name
192               from sysobjects o, master.dbo.spt_values v, syscolumns c
193               where lower(c.name) = v.name and v.type = 'W'
194                   and c.id = o.id
195                   and o.uid = @uid
196                   and not (o.id = 1 and c.name = "schema")
197               order by o.name, c.name
198   
199               select @baduse_cnt = @baduse_cnt + @@rowcount
200           end
201   
202           if exists (select * from #uids
203                   where user_name(uid) = @user_name and catagory = "i")
204           begin
205               select "Table" = o.name,
206                   "Reserved Word Index Names" = i.name
207               from sysobjects o, master.dbo.spt_values v, sysindexes i
208               where lower(i.name) = v.name and v.type = 'W'
209                   and i.id = o.id
210                   and o.uid = @uid
211                   and i.indid != 0 and i.indid != 255
212               order by o.name, i.name
213   
214               select @baduse_cnt = @baduse_cnt + @@rowcount
215           end
216   
217           if exists (select * from #uids
218                   where user_name(uid) = @user_name and catagory = "o")
219           begin
220               select "Object Type" = convert(char(30), x.name),
221                   "Reserved Word Object Names" = o.name
222               from sysobjects o, master.dbo.spt_values v,
223                   master.dbo.spt_values x
224               where lower(o.name) = v.name and v.type = 'W'
225                   and o.uid = @uid
226                   and o.sysstat & 2063 = x.number
227                   and x.type = "O"
228               order by x.name, o.name
229   
230               select @baduse_cnt = @baduse_cnt + @@rowcount
231           end
232   
233           if exists (select * from #uids
234                   where user_name(uid) = @user_name and catagory = "t")
235           begin
236               select "Reserved Word Datatype Names" = t.name
237               from systypes t, master.dbo.spt_values v
238               where lower(t.name) = v.name and v.type = 'W'
239                   and t.uid = @uid
240               order by t.name
241   
242               select @baduse_cnt = @baduse_cnt + @@rowcount
243           end
244   
245           /* Get next id  */
246           select @user_name = min(user_name(uid)) from #uids
247           where user_name(uid) > @user_name
248   
249           /* If there are more user names, print a dividing mark between them. */
250           if (@user_name is not NULL)
251           begin
252               select "-------------------------------------------------------------"
253           end
254       end
255   
256   
257       if (@user_name_param is NULL)
258       begin
259   
260           select @owner_cnt = @baduse_cnt
261   
262           if (@baduse_cnt != 0)
263           begin
264               select "-------------------------------------------------------------"
265           end
266           select "Database-wide Objects" = " "
267   
268           /*
269           ** Print the database wide objects: users and segments
270           */
271   
272           if exists (select * from sysusers u, master.dbo.spt_values v
273                   where lower(u.name) = v.name and v.type = 'W'
274                       and u.name != "public")
275           begin
276               select "Reserved Word User Names" = u.name
277               from sysusers u, master.dbo.spt_values v
278               where lower(u.name) = v.name and v.type = 'W'
279                   and u.name != "public"
280               order by u.name
281   
282               select @baduse_cnt = @baduse_cnt + @@rowcount
283           end
284   
285           if exists (select * from syssegments s, master.dbo.spt_values v
286                   where lower(s.name) = v.name and v.type = 'W'
287                       and s.name != "default")
288           begin
289               select "Reserved Word Segment Names" = s.name
290               from syssegments s, master.dbo.spt_values v
291               where lower(s.name) = v.name and v.type = 'W'
292                   and s.name != "default"
293               order by s.name
294   
295               select @baduse_cnt = @baduse_cnt + @@rowcount
296           end
297   
298   
299           if (db_name() = "master")
300           begin
301               /* Print the Server-wide information:
302               **	logins, charsets, databases, and languages
303               */
304   
305               if exists (select * from master.dbo.syslogins l,
306                           master.dbo.spt_values v
307                       where lower(l.name) = v.name and v.type = 'W')
308               begin
309                   select "Reserved Word Login Names" = l.name
310                   from master.dbo.syslogins l, master.dbo.spt_values v
311                   where lower(l.name) = v.name and v.type = 'W'
312                   order by l.name
313   
314                   select @baduse_cnt = @baduse_cnt + @@rowcount
315               end
316   
317               if exists (select * from master.dbo.syscharsets c,
318                           master.dbo.spt_values v
319                       where lower(c.name) = v.name and v.type = 'W')
320               begin
321                   select "Reserved Word Charset Names" = c.name
322                   from master.dbo.syscharsets c, master.dbo.spt_values v
323                   where lower(c.name) = v.name and v.type = 'W'
324                   order by c.name
325   
326                   select @baduse_cnt = @baduse_cnt + @@rowcount
327               end
328   
329               if exists (select * from master.dbo.sysdatabases d,
330                           master.dbo.spt_values v
331                       where lower(d.name) = v.name and v.type = 'W')
332               begin
333                   select "Reserved Word Database Names" = d.name
334                   from master.dbo.sysdatabases d, master.dbo.spt_values v
335                   where lower(d.name) = v.name and v.type = 'W'
336                   order by d.name
337   
338                   select @baduse_cnt = @baduse_cnt + @@rowcount
339               end
340   
341               if exists (select * from master.dbo.syslanguages l,
342                           master.dbo.spt_values v
343                       where lower(l.name) = v.name and v.type = 'W')
344               begin
345                   select "Reserved Word Language Names" = l.name
346                   from master.dbo.syslanguages l, master.dbo.spt_values v
347                   where lower(l.name) = v.name and v.type = 'W'
348                   order by l.name
349   
350                   select @baduse_cnt = @baduse_cnt + @@rowcount
351               end
352   
353               if exists (select * from master.dbo.sysdevices d,
354                           master.dbo.spt_values v
355                       where lower(d.name) = v.name and v.type = 'W')
356               begin
357                   select "Reserved Word Device Names" = d.name
358                   from master.dbo.sysdevices d, master.dbo.spt_values v
359                   where lower(d.name) = v.name and v.type = 'W'
360                   order by d.name
361   
362                   select @baduse_cnt = @baduse_cnt + @@rowcount
363               end
364   
365               if exists (select * from master.dbo.sysremotelogins r,
366                           master.dbo.spt_values v
367                       where lower(r.remoteusername) = v.name and v.type = 'W')
368               begin
369                   select "Reserved Word Remote Logins" =
370                       r.remoteusername
371                   from master.dbo.sysremotelogins r,
372                       master.dbo.spt_values v
373                   where lower(r.remoteusername) = v.name and v.type = 'W'
374                   order by r.remoteusername
375   
376                   select @baduse_cnt = @baduse_cnt + @@rowcount
377               end
378   
379               if exists (select * from master.dbo.sysservers s,
380                           master.dbo.spt_values v
381                       where lower(s.srvname) = v.name and v.type = 'W')
382               begin
383                   select "Reserved Word Server Names" = s.srvname
384                   from master.dbo.sysservers s, master.dbo.spt_values v
385                   where lower(s.srvname) = v.name and v.type = 'W'
386                   order by s.srvname
387   
388                   select @baduse_cnt = @baduse_cnt + @@rowcount
389               end
390   
391               if exists (select * from master.dbo.sysservers s,
392                           master.dbo.spt_values v
393                       where lower(s.srvnetname) = v.name and v.type = 'W')
394               begin
395                   select "Reserved Word ServerNetNames" = s.srvnetname
396                   from master.dbo.sysservers s, master.dbo.spt_values v
397                   where lower(s.srvnetname) = v.name and v.type = 'W'
398                   order by s.srvnetname
399   
400                   select @baduse_cnt = @baduse_cnt + @@rowcount
401               end
402           end
403           if (@baduse_cnt != 0 and @owner_cnt = @baduse_cnt)
404           begin
405               /*
406               ** 18037, " Found no reserved words used as names for 
407               **	    database-wide objects."
408               **
409               ** NOTE:  sp_getmessage is not used for retrieving message text
410               ** because this sproc must also run on 4.8 servers which cannot
411               ** support the '%1!' syntax in the print statement.
412               */
413               select @msg = description from master.dbo.sysmessages
414               where error = 18037
415                   and langid is NULL
416               print @msg
417           end
418       end
419   
420   
421       if (@baduse_cnt = 0)
422       begin
423           /*
424           ** 18038, " Found no reserved words used as database object names."
425           **
426           ** NOTE:  sp_getmessage is not used for retrieving message text
427           ** because this sproc must also run on 4.8 servers which cannot
428           ** support the '%1!' syntax in the print statement.
429           */
430           select @msg = description from master.dbo.sysmessages
431           where error = 18038
432               and langid is NULL
433           print @msg
434       end
435   
436       return (@baduse_cnt)
437   


exec sp_procxmode 'sp_checkreswords', 'AnyMode'
go

Grant Execute on sp_checkreswords to public
go
RESULT SETS
sp_checkreswords_rset_018
sp_checkreswords_rset_017
sp_checkreswords_rset_016
sp_checkreswords_rset_015
sp_checkreswords_rset_014
sp_checkreswords_rset_013
sp_checkreswords_rset_012
sp_checkreswords_rset_011
sp_checkreswords_rset_010
sp_checkreswords_rset_009
sp_checkreswords_rset_008
sp_checkreswords_rset_007
sp_checkreswords_rset_006
sp_checkreswords_rset_005
sp_checkreswords_rset_004
sp_checkreswords_rset_003
sp_checkreswords_rset_002
sp_checkreswords_rset_001

DEFECTS
 QJWI 5 Join or Sarg Without Index 100
 QJWI 5 Join or Sarg Without Index 110
 QJWI 5 Join or Sarg Without Index 142
 QJWI 5 Join or Sarg Without Index 151
 QJWI 5 Join or Sarg Without Index 193
 QJWI 5 Join or Sarg Without Index 208
 QJWI 5 Join or Sarg Without Index 286
 QJWI 5 Join or Sarg Without Index 291
 QJWI 5 Join or Sarg Without Index 393
 QJWI 5 Join or Sarg Without Index 397
 MEST 4 Empty String will be replaced by Single Space 51
 MEST 4 Empty String will be replaced by Single Space 74
 MINU 4 Unique Index with nullable columns master..syslanguages master..syslanguages
 MINU 4 Unique Index with nullable columns master..sysmessages master..sysmessages
 MINU 4 Unique Index with nullable columns master..sysremotelogins master..sysremotelogins
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
100
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
110
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysobjects.ncsysobjects unique
(name, uid)
Intersection: {uid}
112
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysindexes.csysindexes unique clustered
(id, indid)
Intersection: {indid}
113
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
120
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
128
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
142
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
151
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysindexes.csysindexes unique clustered
(id, indid)
Intersection: {indid}
153
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
160
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
167
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
193
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
208
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysobjects.ncsysobjects unique
(name, uid)
Intersection: {uid}
210
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysindexes.csysindexes unique clustered
(id, indid)
Intersection: {indid}
211
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
224
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
238
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
273
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
278
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
286
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
291
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
307
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
311
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
319
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
323
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
331
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
335
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
343
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
347
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
355
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
359
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use JOIN Candidate index: sysremotelogins.csysremotelogins unique clustered
(remoteserverid, remoteusername)
Intersection: {remoteusername}
Uncovered: [remoteserverid]
367
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
367
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use JOIN Candidate index: sysremotelogins.csysremotelogins unique clustered
(remoteserverid, remoteusername)
Intersection: {remoteusername}
Uncovered: [remoteserverid]
373
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
373
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
381
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
385
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
393
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
397
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 113
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 153
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 211
 TNOI 4 Table with no index sybsystemprocs..syssegments sybsystemprocs..syssegments
 TNOU 4 Table with no unique index master..spt_values master..spt_values
 MGTP 3 Grant to public master..spt_values  
 MGTP 3 Grant to public master..syscharsets  
 MGTP 3 Grant to public master..sysdatabases  
 MGTP 3 Grant to public master..sysdevices  
 MGTP 3 Grant to public master..syslanguages  
 MGTP 3 Grant to public master..syslogins  
 MGTP 3 Grant to public master..sysmessages  
 MGTP 3 Grant to public master..sysremotelogins  
 MGTP 3 Grant to public master..sysservers  
 MGTP 3 Grant to public sybsystemprocs..sp_checkreswords  
 MGTP 3 Grant to public sybsystemprocs..syscolumns  
 MGTP 3 Grant to public sybsystemprocs..sysindexes  
 MGTP 3 Grant to public sybsystemprocs..sysobjects  
 MGTP 3 Grant to public sybsystemprocs..syssegments  
 MGTP 3 Grant to public sybsystemprocs..systypes  
 MGTP 3 Grant to public sybsystemprocs..sysusers  
 MNER 3 No Error Check should check @@error after insert 97
 MNER 3 No Error Check should check @@error after insert 107
 MNER 3 No Error Check should check @@error after insert 117
 MNER 3 No Error Check should check @@error after insert 125
 MNER 3 No Error Check should check @@error after insert 139
 MNER 3 No Error Check should check @@error after insert 148
 MNER 3 No Error Check should check @@error after insert 157
 MNER 3 No Error Check should check @@error after insert 164
 MUCO 3 Useless Code Useless Brackets 61
 MUCO 3 Useless Code Useless Brackets 77
 MUCO 3 Useless Code Useless Brackets 80
 MUCO 3 Useless Code Useless Brackets 94
 MUCO 3 Useless Code Useless Brackets 178
 MUCO 3 Useless Code Useless Brackets 250
 MUCO 3 Useless Code Useless Brackets 257
 MUCO 3 Useless Code Useless Brackets 262
 MUCO 3 Useless Code Useless Brackets 299
 MUCO 3 Useless Code Useless Brackets 403
 MUCO 3 Useless Code Useless Brackets 421
 MUCO 3 Useless Code Useless Brackets 436
 MUIN 3 Column created using implicit nullability 55
 QAFM 3 Var Assignment from potentially many rows 46
 QAFM 3 Var Assignment from potentially many rows 70
 QAFM 3 Var Assignment from potentially many rows 90
 QAFM 3 Var Assignment from potentially many rows 413
 QAFM 3 Var Assignment from potentially many rows 430
 QCRS 3 Conditional Result Set 185
 QCRS 3 Conditional Result Set 190
 QCRS 3 Conditional Result Set 205
 QCRS 3 Conditional Result Set 220
 QCRS 3 Conditional Result Set 236
 QCRS 3 Conditional Result Set 252
 QCRS 3 Conditional Result Set 264
 QCRS 3 Conditional Result Set 266
 QCRS 3 Conditional Result Set 276
 QCRS 3 Conditional Result Set 289
 QCRS 3 Conditional Result Set 309
 QCRS 3 Conditional Result Set 321
 QCRS 3 Conditional Result Set 333
 QCRS 3 Conditional Result Set 345
 QCRS 3 Conditional Result Set 357
 QCRS 3 Conditional Result Set 369
 QCRS 3 Conditional Result Set 383
 QCRS 3 Conditional Result Set 395
 QNAJ 3 Not using ANSI Inner Join 99
 QNAJ 3 Not using ANSI Inner Join 109
 QNAJ 3 Not using ANSI Inner Join 119
 QNAJ 3 Not using ANSI Inner Join 127
 QNAJ 3 Not using ANSI Inner Join 141
 QNAJ 3 Not using ANSI Inner Join 150
 QNAJ 3 Not using ANSI Inner Join 159
 QNAJ 3 Not using ANSI Inner Join 166
 QNAJ 3 Not using ANSI Inner Join 192
 QNAJ 3 Not using ANSI Inner Join 207
 QNAJ 3 Not using ANSI Inner Join 222
 QNAJ 3 Not using ANSI Inner Join 237
 QNAJ 3 Not using ANSI Inner Join 272
 QNAJ 3 Not using ANSI Inner Join 277
 QNAJ 3 Not using ANSI Inner Join 285
 QNAJ 3 Not using ANSI Inner Join 290
 QNAJ 3 Not using ANSI Inner Join 305
 QNAJ 3 Not using ANSI Inner Join 310
 QNAJ 3 Not using ANSI Inner Join 317
 QNAJ 3 Not using ANSI Inner Join 322
 QNAJ 3 Not using ANSI Inner Join 329
 QNAJ 3 Not using ANSI Inner Join 334
 QNAJ 3 Not using ANSI Inner Join 341
 QNAJ 3 Not using ANSI Inner Join 346
 QNAJ 3 Not using ANSI Inner Join 353
 QNAJ 3 Not using ANSI Inner Join 358
 QNAJ 3 Not using ANSI Inner Join 365
 QNAJ 3 Not using ANSI Inner Join 371
 QNAJ 3 Not using ANSI Inner Join 379
 QNAJ 3 Not using ANSI Inner Join 384
 QNAJ 3 Not using ANSI Inner Join 391
 QNAJ 3 Not using ANSI Inner Join 396
 QNAM 3 Select expression has no name "-------------------------------------------------------------" 252
 QNAM 3 Select expression has no name "-------------------------------------------------------------" 264
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
47
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
71
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
91
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysobjects.ncsysobjects unique
(name, uid)
Intersection: {name}
Uncovered: [uid]
160
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
414
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
431
 MRST 2 Result Set Marker 185
 MRST 2 Result Set Marker 190
 MRST 2 Result Set Marker 205
 MRST 2 Result Set Marker 220
 MRST 2 Result Set Marker 236
 MRST 2 Result Set Marker 252
 MRST 2 Result Set Marker 264
 MRST 2 Result Set Marker 266
 MRST 2 Result Set Marker 276
 MRST 2 Result Set Marker 289
 MRST 2 Result Set Marker 309
 MRST 2 Result Set Marker 321
 MRST 2 Result Set Marker 333
 MRST 2 Result Set Marker 345
 MRST 2 Result Set Marker 357
 MRST 2 Result Set Marker 369
 MRST 2 Result Set Marker 383
 MRST 2 Result Set Marker 395
 MSUB 2 Subquery Marker 187
 MSUB 2 Subquery Marker 202
 MSUB 2 Subquery Marker 217
 MSUB 2 Subquery Marker 233
 MSUB 2 Subquery Marker 272
 MSUB 2 Subquery Marker 285
 MSUB 2 Subquery Marker 305
 MSUB 2 Subquery Marker 317
 MSUB 2 Subquery Marker 329
 MSUB 2 Subquery Marker 341
 MSUB 2 Subquery Marker 353
 MSUB 2 Subquery Marker 365
 MSUB 2 Subquery Marker 379
 MSUB 2 Subquery Marker 391
 MTR1 2 Metrics: Comments Ratio Comments: 22% 10
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 47 = 47dec - 2exi + 2 10
 MTR3 2 Metrics: Query Complexity Complexity: 329 10
 PRED_QUERY_COLLECTION 2 {c=sybsystemprocs..syscolumns, o=sybsystemprocs..sysobjects, sv=master..spt_values} 0 98
 PRED_QUERY_COLLECTION 2 {i=sybsystemprocs..sysindexes, o=sybsystemprocs..sysobjects, sv=master..spt_values} 0 108
 PRED_QUERY_COLLECTION 2 {o=sybsystemprocs..sysobjects, sv=master..spt_values} 0 118
 PRED_QUERY_COLLECTION 2 {sv=master..spt_values, t=sybsystemprocs..systypes} 0 126
 PRED_QUERY_COLLECTION 2 {c=sybsystemprocs..syscolumns, o=sybsystemprocs..sysobjects, sv=master..spt_values} 0 140
 PRED_QUERY_COLLECTION 2 {i=sybsystemprocs..sysindexes, o=sybsystemprocs..sysobjects, sv=master..spt_values} 0 149
 PRED_QUERY_COLLECTION 2 {o=sybsystemprocs..sysobjects, sv=master..spt_values} 0 158
 PRED_QUERY_COLLECTION 2 {sv=master..spt_values, t=sybsystemprocs..systypes} 0 165
 PRED_QUERY_COLLECTION 2 {c=sybsystemprocs..syscolumns, o=sybsystemprocs..sysobjects, sv=master..spt_values} 0 190
 PRED_QUERY_COLLECTION 2 {i=sybsystemprocs..sysindexes, o=sybsystemprocs..sysobjects, sv=master..spt_values} 0 205
 PRED_QUERY_COLLECTION 2 {o=sybsystemprocs..sysobjects, sv=master..spt_values, sv2=master..spt_values} 0 220
 PRED_QUERY_COLLECTION 2 {sv=master..spt_values, t=sybsystemprocs..systypes} 0 236
 PRED_QUERY_COLLECTION 2 {sv=master..spt_values, u=sybsystemprocs..sysusers} 0 272
 PRED_QUERY_COLLECTION 2 {sv=master..spt_values, u=sybsystemprocs..sysusers} 0 276
 PRED_QUERY_COLLECTION 2 {s=sybsystemprocs..syssegments, sv=master..spt_values} 0 285
 PRED_QUERY_COLLECTION 2 {s=sybsystemprocs..syssegments, sv=master..spt_values} 0 289
 PRED_QUERY_COLLECTION 2 {l=master..syslogins, sv=master..spt_values} 0 305
 PRED_QUERY_COLLECTION 2 {l=master..syslogins, sv=master..spt_values} 0 309
 PRED_QUERY_COLLECTION 2 {c=master..syscharsets, sv=master..spt_values} 0 317
 PRED_QUERY_COLLECTION 2 {c=master..syscharsets, sv=master..spt_values} 0 321
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, sv=master..spt_values} 0 329
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, sv=master..spt_values} 0 333
 PRED_QUERY_COLLECTION 2 {l=master..syslanguages, sv=master..spt_values} 0 341
 PRED_QUERY_COLLECTION 2 {l=master..syslanguages, sv=master..spt_values} 0 345
 PRED_QUERY_COLLECTION 2 {d=master..sysdevices, sv=master..spt_values} 0 353
 PRED_QUERY_COLLECTION 2 {d=master..sysdevices, sv=master..spt_values} 0 357
 PRED_QUERY_COLLECTION 2 {r=master..sysremotelogins, sv=master..spt_values} 0 365
 PRED_QUERY_COLLECTION 2 {r=master..sysremotelogins, sv=master..spt_values} 0 369
 PRED_QUERY_COLLECTION 2 {s=master..sysservers, sv=master..spt_values} 0 379
 PRED_QUERY_COLLECTION 2 {s=master..sysservers, sv=master..spt_values} 0 383
 PRED_QUERY_COLLECTION 2 {s=master..sysservers, sv=master..spt_values} 0 391
 PRED_QUERY_COLLECTION 2 {s=master..sysservers, sv=master..spt_values} 0 395

DEPENDENCIES
PROCS AND TABLES USED
reads table master..syslogins (1)  
reads table master..sysdevices (1)  
reads table sybsystemprocs..sysusers  
reads table master..sysmessages (1)  
reads table sybsystemprocs..sysobjects  
read_writes table tempdb..#uids (1) 
reads table sybsystemprocs..syssegments  
reads table master..syslanguages (1)  
reads table master..sysdatabases (1)  
reads table sybsystemprocs..syscolumns  
reads table master..sysservers (1)  
reads table master..spt_values (1)  
reads table master..syscharsets (1)  
reads table sybsystemprocs..systypes  
reads table sybsystemprocs..sysindexes  
reads table master..sysremotelogins (1)