DatabaseProcApplicationCreatedLinks
sybsystemprocssp_setrepcol  14 déc. 14Defects Propagation Dependencies

1     
2     /*
3     ** Generated by spgenmsgs.pl on Wed Feb  8 14:55:57 2006 
4     */
5     /*
6     ** raiserror Messages for setrepcol [Total 3]
7     **
8     ** 17756, "The execution of the stored procedure '%1!' in database '%2!' was aborted because there was an error in writing the replication log record."
9     ** 17966, "Due to system failure, the replication status for '%1!' has not been changed."
10    ** 18418, "Only the System Administrator (SA), the Database Owner (dbo) or a user with REPLICATION authorization may execute this stored procedure."
11    */
12    /*
13    ** sp_getmessage Messages for setrepcol [Total 15]
14    **
15    ** 17142, "You need to be able to set curwrite label to data_high. This script will continue in spite of failure to set curwrite. Please rerun after setting your labels correctly."
16    ** 17460, "Object must be in the current database."
17    ** 17964, "The replication status for '%1!' is set to %2!."
18    ** 18076, "Could not set curwrite to object level. Set your maxwrite label correctly."
19    ** 18109, "Usage: sp_setrepcol table_name, column_name, {do_not_replicate | always_replicate | replicate_if_changed}"
20    ** 18110, "The table '%1!' is not marked as replicated."
21    ** 18111, "do_not_replicate"
22    ** 18112, "always_replicate"
23    ** 18113, "replicate_if_changed"
24    ** 18114, "A table name must be provided."
25    ** 18115, "No Text/Image or off-row object columns in '%1!'."
26    ** 18116, "The replication status for all Text/Image and off-row object columns in '%1!' has been set to %2!."
27    ** 18117, "Column '%1!' does not exist in '%2!' or it is not a Text/Image or off-row object column."
28    ** 18118, "Object '%1!' does not exist in this database."
29    ** 18687, "Cannot set replication status for in-row objects, use sp_setreptable to set the table's replication status instead. The replication status for '%1!.%2!' is not changed."
30    */
31    /*
32    ** End spgenmsgs.pl output.
33    */
34    
35    create or replace procedure sp_setrepcol
36        @replicate_name varchar(767) = NULL, /* table for the column */
37        @column_name varchar(767) = NULL, /* column we want to mark */
38        @setflag varchar(22) = NULL, /* the replicate status. */
39        @use_index varchar(10) = NULL /* use index for text columns */
40    as
41    
42        declare @current_status int /* current sysstat value for the object. */
43        declare @new_status int /* new sysstat value for the object. */
44        declare @rep_constant smallint /* bit which indicates a replicated object. */
45        declare @db varchar(255) /* db of object. */
46        declare @owner varchar(255) /* owner of object. */
47        declare @object varchar(255) /* object's name. */
48        declare @msg varchar(1024) /* variable to get the error message */ declare @sptlang int
49        declare @procval int
50        declare @rnever smallint /* flag value for "do_not_replicate" */
51        declare @ralways smallint /* flag value for "always_replicate" */
52        declare @rifchanged smallint /* flag value for "replicate_if_changed" */
53        declare @rcolbitmask smallint /* mask for the above flags */
54        declare @repnever varchar(30) /* "do_not_replicate" */
55        declare @repalways varchar(30) /* "always_replicate" */
56        declare @repifchanged varchar(30) /* "replicate_if_changed" */
57        declare @colid smallint /* Column id of the column */
58        declare @objid int /* Id of the object */
59        declare @lsetflag varchar(22) /* lower case value of @setflag */
60        declare @texttype smallint /* SYB_TEXT type. */
61        declare @imagetype smallint /* IMAGE type. */
62        declare @xtype_type smallint /* XTYPE_TOKEN type. */
63        declare @unitexttype smallint /* UNITEXT type. */
64        declare @dbname varchar(255)
65        declare @xstatus int /* xstatus field. */
66        declare @offrow smallint /* Object stored OFFROW. */
67        declare @setrep_index int /* Bit which indicates if the replicated					** object will use internal indexes for
68        ** replication.
69        */
70        declare @tipsa_in_index smallint
71        declare @dummy int
72        declare @nullarg char(1)
73        declare @gp_enabled int
74        declare @status1 int
75        declare @status2 int
76        declare @status3 int
77    
78        select @status1 = 1
79        select @status2 = 1
80        select @status3 = 1
81    
82    
83        if @@trancount = 0
84        begin
85            set transaction isolation level 1
86            set chained off
87        end
88    
89        /*
90        ** Replication enabled flag is 8000H (which is -32768D)
91        */
92        select @rep_constant = - 32768,
93            @rnever = 0,
94            @ralways = 1,
95            @rifchanged = 2,
96            @rcolbitmask = 3,
97            @imagetype = 34,
98            @texttype = 35,
99            @xtype_type = 36,
100           @unitexttype = 174,
101           @offrow = 1,
102           @setrep_index = 0,
103           @tipsa_in_index = 2048
104   
105       /*
106       ** Initialize strings
107       */
108       /* 18111, "do_not_replicate" */
109       exec sp_getmessage 18111, @repnever out
110       /* 18112, "always_replicate" */
111       exec sp_getmessage 18112, @repalways out
112       /* 18113, "replicate_if_changed" */
113       exec sp_getmessage 18113, @repifchanged out
114   
115       /* Create a temp table for messages */
116       create table #setrepcol(val int, str varchar(255))
117       insert into #setrepcol values (@ralways, @repalways)
118       insert into #setrepcol values (@rnever, @repnever)
119       insert into #setrepcol values (@rifchanged, @repifchanged)
120   
121       /*
122       ** Set 'sptlang' for proper printing of object information.  Used mainly
123       ** for the 'select' statement which is executed when we are invoked with
124       ** no parameters.  Copied from similar code in 'sp_help'
125       */
126       select @sptlang = @@langid
127       if @@langid != 0
128       begin
129           if not exists (
130                   select * from master.dbo.sysmessages where error
131                       between 17100 and 17109
132                       and langid = @@langid)
133               select @sptlang = 0
134       end
135   
136       if (@replicate_name is NULL)
137       begin
138           /*
139           ** 18114, "A table name must be provided."
140           */
141           exec sp_getmessage 18114, @msg output
142           print @msg
143           return (1)
144       end
145       /*
146       ** Crack the name into its corresponding pieces.
147       */
148       execute sp_namecrack @replicate_name,
149           @db = @db output,
150           @owner = @owner output,
151           @object = @object output
152   
153       /*
154       ** Make sure that the object is in the current database.
155       */
156       if (@db is not NULL and @db != db_name())
157       begin
158           /*
159           ** 17460, "Object must be in the current database."
160           */
161           exec sp_getmessage 17460, @msg output
162           print @msg
163           return (1)
164       end
165   
166       /*
167       **  Make sure that the object actually exists.
168       */
169       if (object_id(@replicate_name) is NULL)
170       begin
171           /*
172           ** 18118, "Object '%1!' does not exist in this database."
173           */
174           exec sp_getmessage 18118, @msg output
175           print @msg, @replicate_name
176           return (1)
177       end
178   
179       /*
180       ** Check if the object is a table.
181       */
182       if not exists (
183               select id from sysobjects
184               where
185                   id = object_id(@replicate_name) and
186                   type = "U")
187       begin
188           /*
189           ** 18114, "A table name must be provided."
190           */
191           exec sp_getmessage 18114, @msg output
192           print @msg
193           return (1)
194       end
195       /*
196       ** Check if the table is marked for replication.
197       */
198       select @current_status = sysstat
199       from sysobjects
200       where id = object_id(@replicate_name)
201   
202       /*
203       ** Is the replicate status bit even set?
204       */
205       if (@current_status & @rep_constant) = 0
206       begin
207           /*
208           ** 18110, "The object '%1!' is not marked for replication."
209           */
210           exec sp_getmessage 18110, @msg output
211           print @msg, @replicate_name
212           return (1)
213       end
214   
215       if (@column_name is not NULL)
216       begin
217           if not exists (select colid from syscolumns
218                   where name = @column_name
219                       and id = object_id(@replicate_name)
220                       and type in (@imagetype, @texttype,
221                           @xtype_type, @unitexttype))
222           begin
223               /*
224               ** 18117 "Column '%1!' does not exist in '%2!' or is not
225               ** 	  a Text/Image or an off-row object column."
226               */
227               exec sp_getmessage 18117, @msg output
228               print @msg, @column_name, @replicate_name
229               return (1)
230           end
231   
232           /* If object column is specified, it must be an off-row object. */
233           if exists (select colid from syscolumns
234                   where name = @column_name
235                       and id = object_id(@replicate_name)
236                       and type = @xtype_type
237                       and (xstatus & @offrow) = 0)
238           begin
239               /*
240               ** 18687, "Cannot set replication status for in-row objects,
241               **	   use sp_setreptable to set the table's replication
242               **	   status instead. The replication status for '%1!.%2!'
243               **	   is not changed."
244               */
245               exec sp_getmessage 18687, @msg output
246               print @msg, @replicate_name, @column_name
247               return (1)
248           end
249   
250       end
251       else
252       begin
253           if not exists (select colid from syscolumns
254                   where id = object_id(@replicate_name)
255                       and (type in (@imagetype, @texttype, @unitexttype)
256                           or (type = @xtype_type
257                               and (xstatus & @offrow) = @offrow)))
258           begin
259               /*
260               ** 18115 "No Text/Image nor an off-row object columns in '%1!'."
261               */
262               exec sp_getmessage 18115, @msg output
263               print @msg, @replicate_name
264               return (1)
265           end
266       end
267   
268       /*
269       ** Currently, marking for TEXT/IMAGE replication user table columns in the
270       ** 'master' database is not allowed.
271       **
272       ** Therefore, if the current database is the 'master' database, reset the
273       ** '@setflag' to NULL so that the system procedure will report the current
274       ** status of the user table column.  A proper error message should be
275       ** implemented at a later date.
276       */
277       if (db_name() = "master")
278       begin
279           select @setflag = NULL
280       end
281   
282       /*
283       ** If we are invoked with two parameters, then just print out status
284       */
285       if (@setflag is NULL)
286       begin
287           if (@column_name is NULL)
288           begin
289               select
290                   Name = c.name,
291                   Type = t.name,
292                   Status = s.str,
293                   Mode = case
294                       when (c.status2 & @tipsa_in_index) = @tipsa_in_index
295                       then "using index"
296                       when (c.status2 & @tipsa_in_index) = 0
297                       then "no index"
298                       when c.status2 is null
299                       then "no index"
300                   end
301   
302               into #setrepcol1rs
303               from
304                   syscolumns c holdlock,
305                   systypes t,
306                   #setrepcol s
307               where
308                   c.id = object_id(@replicate_name)
309                   and (c.type in (@imagetype, @texttype, @unitexttype)
310                       or (c.type = @xtype_type
311                           and (c.xstatus & @offrow) = @offrow))
312                   and c.type = t.type
313                   and s.val = (c.status & @rcolbitmask)
314               exec sp_autoformat @fulltabname = #setrepcol1rs
315               drop table #setrepcol1rs
316           end
317           else
318           begin
319               select
320                   Name = c.name,
321                   Type = t.name,
322                   Status = s.str,
323                   Mode = case
324                       when (c.status2 & @tipsa_in_index) = @tipsa_in_index
325                       then "using index"
326                       when (c.status2 & @tipsa_in_index) = 0
327                       then "no index"
328                       when c.status2 is null
329                       then "no index"
330                   end
331   
332               into #setrepcol2rs
333               from
334                   syscolumns c holdlock,
335                   systypes t,
336                   #setrepcol s
337               where
338                   c.id = object_id(@replicate_name)
339                   and c.name = @column_name
340                   and (c.type in (@imagetype, @texttype, @unitexttype)
341                       or (c.type = @xtype_type
342                           and (c.xstatus & @offrow) = @offrow))
343                   and c.type = t.type
344                   and s.val = (c.status & @rcolbitmask)
345               exec sp_autoformat @fulltabname = #setrepcol2rs
346               drop table #setrepcol2rs
347           end
348           return (0)
349       end
350   
351       /*
352       ** Check for a valid setname parameter
353       */
354       if (lower(@setflag) not in ("do_not_replicate", "always_replicate",
355                   "replicate_if_changed", @repnever,
356                   @repalways, @repifchanged))
357       begin
358           /*
359           ** 18109, "Usage: sp_setrepcol table_name, column_name,	
360           **					{do_not_replicate |
361           **					 always_replicate |
362           **					 replicate_if_changed}
363           **					[, use_index ] "
364           */
365           exec sp_getmessage 18109, @msg output
366           print @msg
367           return (1)
368       end
369   
370       select @use_index = lower(@use_index)
371   
372       /* Check for valid use_index parameter */
373       if (@use_index is not null and @use_index != "use_index")
374       begin
375           /*
376           ** 18109, "Usage: sp_setrepcol table_name, column_name,
377           **                                      {do_not_replicate |
378           **                                       always_replicate |
379           **                                       replicate_if_changed}"
380           **					[, use_index ]
381           */
382           exec sp_getmessage 18109, @msg output
383           print @msg
384           return (1)
385       end
386   
387       if (@use_index in ("use_index"))
388       begin
389           /* Set LT_SETREP_TIPSA_INDEX */
390           select @setrep_index = 8
391       end
392       /*
393       ** If granular permissions is not enabled, 
394       ** you must be SA, dbo or have REPLICATION role to execute this
395       ** sproc.
396       **  If granular permissions is enabled then users with 
397       ** 'manage replication' permission can execute it.
398       */
399       select @dbname = db_name()
400       select @nullarg = NULL
401       execute @status1 = sp_aux_checkroleperm "dbo", "manage replication",
402           @dbname, @gp_enabled output
403   
404       if (@gp_enabled = 0)
405       begin
406           if (@status1 != 0)
407           begin
408               execute @status2 = sp_aux_checkroleperm "sa_role",
409                   @nullarg, @nullarg, @gp_enabled output
410   
411               if (@status2 != 0)
412                   execute @status3 = sp_aux_checkroleperm
413                       "replication_role", @nullarg, @nullarg,
414                       @gp_enabled output
415   
416               if (@status3 != 0)
417               begin
418                   /*
419                   ** 18418, "Only the System Administrator (SA), the
420                   **         Database Owner (dbo) or a user with
421                   **         REPLICATION authorization may execute this
422                   **         stored procedure."
423                   */
424                   raiserror 18418
425                   return (1)
426               end
427           end
428           if (@status2 = 0)
429               select @dummy = proc_role("sa_role")
430           if (@status3 = 0)
431               select @dummy = proc_role("replication_role")
432       end
433       else
434       begin
435           select @dummy = proc_auditperm("manage replication", @status1, @dbname)
436           if (@status1 != 0)
437               return 1
438       end
439   
440       /*
441       ** Perform the requested operation on the object.
442       */
443       select @objid = object_id(@replicate_name)
444       select @lsetflag = lower(@setflag)
445   
446   
447   
448       /* Start the transaction to log the execution of this procedure.
449       **
450       ** IMPORTANT: The name "rs_logexec is significant and is used by 
451       **            Replication Server
452       */
453       begin transaction rs_logexec
454   
455       if @lsetflag in ("always_replicate", @repalways)
456       begin
457           if (@column_name is NULL)
458           begin
459   
460               declare syscol_cursor cursor for
461               select colid from syscolumns
462               where
463                   id = @objid
464                   and (type in (@imagetype, @texttype, @unitexttype)
465                       or (type = @xtype_type
466                           and (xstatus & @offrow) = @offrow))
467               order by colid
468   
469               open syscol_cursor
470               fetch syscol_cursor into @colid
471               while (@@sqlstatus = 0)
472               begin
473                   dbcc replicate_txtcol(@objid, @colid, @lsetflag, @setrep_index)
474                   if @@error != 0
475                   begin
476                       /*
477                       ** 17966 "Due to system failure, the 
478                       **        replication status for '%1!' has
479                       **	  not been changed."
480                       */
481                       raiserror 17966, @replicate_name
482   
483                       /*
484                       ** The DBCC command may have already
485                       ** rolled back the transaction
486                       */
487                       if @@trancount > 0
488                           rollback transaction rs_logexec
489   
490                       return (1)
491                   end
492   
493                   fetch syscol_cursor into @colid
494               end
495               close syscol_cursor
496               deallocate cursor syscol_cursor
497           end
498           else
499           begin
500               /* A column name was provided */
501               select @colid = colid from syscolumns
502               where
503                   name = @column_name
504                   and id = @objid
505   
506               dbcc replicate_txtcol(@objid, @colid, @lsetflag, @setrep_index)
507               if @@error != 0
508               begin
509                   /*
510                   ** 17966 "Due to system failure, the 
511                   **        replication status for '%1!' has
512                   **	  not been changed."
513                   */
514                   raiserror 17966, @replicate_name
515   
516                   /*
517                   ** The DBCC command may have already rolled back
518                   ** the transaction
519                   */
520                   if @@trancount > 0
521                       rollback transaction rs_logexec
522   
523                   return (1)
524               end
525           end
526       end
527       else
528       /* flag is either repnever or repifchanged */
529       begin
530           if (@column_name is NULL)
531           begin
532               /*
533               ** Set the status for all
534               ** text, image, and off-row-object columns.
535               */
536               declare syscol_cursor cursor for
537               select colid from syscolumns
538               where
539                   id = @objid
540                   and (type in (@imagetype, @texttype, @unitexttype)
541                       or (type = @xtype_type
542                           and (xstatus & @offrow) = @offrow))
543               order by colid
544   
545               open syscol_cursor
546               fetch syscol_cursor into @colid
547               while (@@sqlstatus = 0)
548               begin
549                   dbcc replicate_txtcol(@objid, @colid, @lsetflag, @setrep_index)
550                   if @@error != 0
551                   begin
552                       /*
553                       ** 17966 "Due to system failure, the 
554                       **        replication status for '%1!' has
555                       **	  not been changed."
556                       */
557                       raiserror 17966, @replicate_name
558   
559                       /*
560                       ** The DBCC command may have already rolled
561                       ** back the transaction
562                       */
563                       if @@trancount > 0
564                           rollback transaction rs_logexec
565   
566                       return (1)
567                   end
568                   fetch syscol_cursor into @colid
569               end
570               close syscol_cursor
571               deallocate cursor syscol_cursor
572           end
573           else
574           begin
575               /* Set the status for the given column */
576               select @colid = colid from syscolumns
577               where
578                   id = @objid and
579                   name = @column_name
580   
581               dbcc replicate_txtcol(@objid, @colid, @lsetflag, @setrep_index)
582               if @@error != 0
583               begin
584                   /*
585                   ** 17966 "Due to system failure, the 
586                   **        replication status for '%1!' has
587                   **	  not been changed."
588                   */
589                   raiserror 17966, @replicate_name
590   
591                   /*
592                   ** The DBCC command may have already rolled back
593                   ** the transaction
594                   */
595                   if @@trancount > 0
596                       rollback transaction rs_logexec
597   
598                   return (1)
599               end
600           end
601       end
602   
603       /*
604       ** Write the log record to replicate this invocation 
605       ** of the stored procedure.
606       */
607       if (logexec() != 1)
608       begin
609           /*
610           ** 17756, "The execution of the stored procedure '%1!' in
611           **         database '%2!' was aborted because there was an
612           **         error in writing the replication log record."
613           */
614           select @dbname = db_name()
615           raiserror 17756, "sp_setrepcol", @dbname
616   
617           rollback transaction rs_logexec
618           return (1)
619       end
620   
621       commit transaction rs_logexec
622   
623       if (@column_name is NULL)
624       begin
625           /*
626           ** 18116, "The replication status for all Text/Image and off-row
627           **	   objectcolumns in '%1!' is set to %2!."
628           */
629           exec sp_getmessage 18116, @msg output
630           print @msg, @replicate_name, @setflag
631           return (0)
632       end
633       else
634       begin
635           /*
636           ** 17964 "The replication status for '%1!' is set to %2!."
637           */
638           exec sp_getmessage 17964, @msg output
639           print @msg, @column_name, @setflag
640           return (0)
641       end
642   


exec sp_procxmode 'sp_setrepcol', 'AnyMode'
go

Grant Execute on sp_setrepcol to public
go
DEFECTS
 QJWI 5 Join or Sarg Without Index 312
 QJWI 5 Join or Sarg Without Index 343
 MINU 4 Unique Index with nullable columns master..sysmessages master..sysmessages
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 314
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 345
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 132
 QTYP 4 Comparison type mismatch smallint = int 132
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs smallint 236
 QTYP 4 Comparison type mismatch tinyint = smallint 236
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs smallint 256
 QTYP 4 Comparison type mismatch tinyint = smallint 256
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs smallint 310
 QTYP 4 Comparison type mismatch tinyint = smallint 310
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 313
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs smallint 341
 QTYP 4 Comparison type mismatch tinyint = smallint 341
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 344
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs smallint 465
 QTYP 4 Comparison type mismatch tinyint = smallint 465
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs smallint 541
 QTYP 4 Comparison type mismatch tinyint = smallint 541
 CUNU 3 Cursor not updated: cursor should contain 'for read only' clause syscol_cursor 461
 CUNU 3 Cursor not updated: cursor should contain 'for read only' clause syscol_cursor 537
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 183
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 185
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 200
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 219
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 235
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 254
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 308
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 338
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 463
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 504
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 539
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 578
 MGTP 3 Grant to public master..sysmessages  
 MGTP 3 Grant to public sybsystemprocs..sp_setrepcol  
 MGTP 3 Grant to public sybsystemprocs..syscolumns  
 MGTP 3 Grant to public sybsystemprocs..sysobjects  
 MGTP 3 Grant to public sybsystemprocs..systypes  
 MNER 3 No Error Check should check return value of exec 109
 MNER 3 No Error Check should check return value of exec 111
 MNER 3 No Error Check should check return value of exec 113
 MNER 3 No Error Check should check @@error after insert 117
 MNER 3 No Error Check should check @@error after insert 118
 MNER 3 No Error Check should check @@error after insert 119
 MNER 3 No Error Check should check return value of exec 141
 MNER 3 No Error Check should check return value of exec 148
 MNER 3 No Error Check should check return value of exec 161
 MNER 3 No Error Check should check return value of exec 174
 MNER 3 No Error Check should check return value of exec 191
 MNER 3 No Error Check should check return value of exec 210
 MNER 3 No Error Check should check return value of exec 227
 MNER 3 No Error Check should check return value of exec 245
 MNER 3 No Error Check should check return value of exec 262
 MNER 3 No Error Check should check @@error after select into 289
 MNER 3 No Error Check should check return value of exec 314
 MNER 3 No Error Check should check @@error after select into 319
 MNER 3 No Error Check should check return value of exec 345
 MNER 3 No Error Check should check return value of exec 365
 MNER 3 No Error Check should check return value of exec 382
 MNER 3 No Error Check should check return value of exec 629
 MNER 3 No Error Check should check return value of exec 638
 MUCO 3 Useless Code Useless Brackets 136
 MUCO 3 Useless Code Useless Brackets 143
 MUCO 3 Useless Code Useless Brackets 156
 MUCO 3 Useless Code Useless Brackets 163
 MUCO 3 Useless Code Useless Brackets 169
 MUCO 3 Useless Code Useless Brackets 176
 MUCO 3 Useless Code Useless Brackets 193
 MUCO 3 Useless Code Useless Brackets 212
 MUCO 3 Useless Code Useless Brackets 215
 MUCO 3 Useless Code Useless Brackets 229
 MUCO 3 Useless Code Useless Brackets 247
 MUCO 3 Useless Code Useless Brackets 264
 MUCO 3 Useless Code Useless Brackets 277
 MUCO 3 Useless Code Useless Brackets 285
 MUCO 3 Useless Code Useless Brackets 287
 MUCO 3 Useless Code Useless Brackets 348
 MUCO 3 Useless Code Useless Brackets 354
 MUCO 3 Useless Code Useless Brackets 367
 MUCO 3 Useless Code Useless Brackets 373
 MUCO 3 Useless Code Useless Brackets 384
 MUCO 3 Useless Code Useless Brackets 387
 MUCO 3 Useless Code Useless Brackets 404
 MUCO 3 Useless Code Useless Brackets 406
 MUCO 3 Useless Code Useless Brackets 411
 MUCO 3 Useless Code Useless Brackets 416
 MUCO 3 Useless Code Useless Brackets 425
 MUCO 3 Useless Code Useless Brackets 428
 MUCO 3 Useless Code Useless Brackets 430
 MUCO 3 Useless Code Useless Brackets 436
 MUCO 3 Useless Code Useless Brackets 457
 MUCO 3 Useless Code Useless Brackets 471
 MUCO 3 Useless Code Useless Brackets 490
 MUCO 3 Useless Code Useless Brackets 523
 MUCO 3 Useless Code Useless Brackets 530
 MUCO 3 Useless Code Useless Brackets 547
 MUCO 3 Useless Code Useless Brackets 566
 MUCO 3 Useless Code Useless Brackets 598
 MUCO 3 Useless Code Useless Brackets 607
 MUCO 3 Useless Code Useless Brackets 618
 MUCO 3 Useless Code Useless Brackets 623
 MUCO 3 Useless Code Useless Brackets 631
 MUCO 3 Useless Code Useless Brackets 640
 MUIN 3 Column created using implicit nullability 116
 QAFM 3 Var Assignment from potentially many rows 501
 QAFM 3 Var Assignment from potentially many rows 576
 QCTC 3 Conditional Table Creation 289
 QCTC 3 Conditional Table Creation 319
 QISO 3 Set isolation level 85
 QJWT 3 Join or Sarg Without Index on temp table 313
 QJWT 3 Join or Sarg Without Index on temp table 344
 QNAJ 3 Not using ANSI Inner Join 303
 QNAJ 3 Not using ANSI Inner Join 333
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
130
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
218
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
234
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
254
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
308
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
338
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
463
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
503
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
539
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
578
 VNRD 3 Variable is not read @sptlang 133
 VNRD 3 Variable is not read @owner 150
 VNRD 3 Variable is not read @object 151
 VNRD 3 Variable is not read @gp_enabled 414
 VNRD 3 Variable is not read @dummy 435
 VUNU 3 Variable is not used @new_status 43
 VUNU 3 Variable is not used @procval 49
 VUNU 3 Variable is not used @xstatus 65
 CRDO 2 Read Only Cursor Marker (has an 'order by' clause) 461
 CRDO 2 Read Only Cursor Marker (has an 'order by' clause) 537
 MSUB 2 Subquery Marker 129
 MSUB 2 Subquery Marker 182
 MSUB 2 Subquery Marker 217
 MSUB 2 Subquery Marker 233
 MSUB 2 Subquery Marker 253
 MTR1 2 Metrics: Comments Ratio Comments: 42% 35
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 54 = 73dec - 21exi + 2 35
 MTR3 2 Metrics: Query Complexity Complexity: 298 35

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_autoformat  
   writes table sybsystemprocs..sp_autoformat_rset_002 
   reads table master..systypes (1)  
   writes table sybsystemprocs..sp_autoformat_rset_004 
   calls proc sybsystemprocs..sp_autoformat  
   reads table master..syscolumns (1)  
   read_writes table tempdb..#colinfo_af (1) 
   reads table tempdb..systypes (1)  
   writes table sybsystemprocs..sp_autoformat_rset_001 
   reads table tempdb..syscolumns (1)  
   writes table sybsystemprocs..sp_autoformat_rset_003 
   calls proc sybsystemprocs..sp_namecrack  
   writes table sybsystemprocs..sp_autoformat_rset_005 
writes table tempdb..#setrepcol2rs (1) 
writes table tempdb..#setrepcol1rs (1) 
calls proc sybsystemprocs..sp_getmessage  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..syslanguages (1)  
   reads table sybsystemprocs..sysusermessages  
   reads table master..sysmessages (1)  
calls proc sybsystemprocs..sp_namecrack  
reads table master..sysmessages (1)  
read_writes table tempdb..#setrepcol (1) 
reads table sybsystemprocs..sysobjects  
reads table sybsystemprocs..syscolumns  
reads table sybsystemprocs..systypes  
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..syscurconfigs (1)  
   reads table master..sysconfigures (1)