S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e   I D   N  _  K n o w l e d g e   h-Nvc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 1   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e S e l e c t 
 
 
 
 @ K n o w l e d g e I t e m   I N T 	 	 	 	 - - K n o w l e d g e   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 n o w . D e d i c a t e d T o   A S   D e d i c a t e d T o , 
 
 	 n o w . C o m m e n t s P e r m i s s i o n   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 n o w . A u t h o r   A S   A u t h o r 
 
 
 
 F R O M   d b o . K n o w l e d g e   n o w 
 
 
 
 W H E R E   n o w . [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S t o r e d P r o c e d u r e P a r a m e t e r s B u i l d         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S t o r e d P r o c e d u r e P a r a m e t e r s B u i l d ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S t o r e d P r o c e d u r e P a r a m e t e r s B u i l d ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Sg*NS t o r e d   P r o c e d u r e   vSpeRhO  B L   D a t a A c c e s s   -NvN(u
 
 - - = = eQSpe  @ S t o r e d P r o c e d u r e N a m e   v a r c h a r ( 1 2 8 )   
 
 - - = = Q~g^zvSpeRh
 
 - - = = S P   SgqNS Q L   S e r v e r   2 0 0 0 @b&^v  P A R A M E T E R S   V i e w 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S t o r e d P r o c e d u r e P a r a m e t e r s B u i l d 
 
 
 
   @ S t o r e d P r o c e d u r e N a m e   n v a r c h a r ( 1 2 8 ) 	 	 - - S P   
T
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 S E L E C T   
 
 
 
         P A R A M E T E R _ N A M E   A S   P a r a m e t e r N a m e ,   
 
         D A T A _ T Y P E   A S   P a r a m e t e r D a t a T y p e ,   
 
         C A S E   U P P E R ( P A R A M E T E R _ M O D E )   W H E N   N ' I N '   T H E N   N ' I n p u t '   W H E N   N ' O U T '   T H E N   N ' O u t p u t '   W H E N   N ' I N O U T '   T H E N   N ' O u t p u t '   E L S E   N ' R e t u r n V a l u e '   E N D   A S   P a r a m e t e r D i r e c t i o n ,   
 
         C H A R A C T E R _ M A X I M U M _ L E N G T H   A S   P a r a m e t e r S i z e , 
 
         N U M E R I C _ P R E C I S I O N   A S   P a r a m e t e r P r e c i s i o n ,   
 
         N U M E R I C _ S C A L E   A S   P a r a m e t e r S c a l e 
 
 
 
 F R O M   I N F O R M A T I O N _ S C H E M A . P A R A M E T E R S 
 
 
 
 W H E R E   S P E C I F I C _ N A M E = @ S t o r e d P r o c e d u r e N a m e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S t o r e d P r o c e d u r e P a r a m e t e r s B u i l d ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r A u t h e n t i c a t i o n         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r A u t h e n t i c a t i o n ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r A u t h e n t i c a t i o n ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - ,g|~[(u7bvSt
 
 - - h  U s e r s   -NOX[N(u7bv@b	g  P r o f i l e   Sb  N a m e ,   P a s s w o r d ,   U s e r R o l e 
 
 - - (u7b NqQ	gNR  U s e r R o l e   - -   1 . A d m i n ,   2 . C h i e f   E d i t o r ,   3 . C o l u m n   E d i t o r ,   2 . C o m m u n i t y 
 
 - - vePwNRagN  - -   1 .   N a m e   P a s s w o r d   &{T  labN
NQ   U s e r R o l e    Nُ*NagNV:NS  U s e r s   h-NS+Tg*N(u7bN  N a m e ,   P a s s w o r d    N1\h:y(u7bSNۏegNN
NۏeQg*N!jWW  T e m p l a t e B a s e   -Nv  C h e c k L o g i n   OۏL	
 
 - - Q  o P a s s   c:y/f&TbR
 
 - - Q  o U s e r R o l e s   ԏV(u7bSNvv@b	g҉r(u7b\TeꁨR{veQُN҉r  ԏV[N/f:NN(W  B L   -N:NNNR^ޏcW[&{2N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r A u t h e n t i c a t i o n 
 
 
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - (u7b
TeQ	
 
 @ P a s s w o r d   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - [x]~~ǏR[YteQ	
 
 @ o P a s s   i n t   O U T , 	 	 	 	 - - /f&TǏQ	
 
 @ o U s e r R o l e s   n v a r c h a r ( 4 0 0 0 )   O U T , 	 	 - - ԏVv(u7bSNvv҉r
TyRh  N      R _vRh	
 
 @ o U s e r A d m i n   I N T   O U T , 	 	 	 	 - - ԏVv(u7b/f&T  A m i n   (u7b  (W  M e n u   T NN+Rv:WT|~_wS_MR(u7b/f  A d m i n O  R e n d e r   |~{tv^Rc	
 
 @ o U s e r A d m i n E d i t o r   I N T   O U T , 	 	 	 - - ԏVv(u7b/f&T  A m i n E d i t o r   (u7b  (W  M e n u   T NN+Rv:WT|~_wS_MR(u7b/f  A d m i n E d i t o r O  R e n d e r   v^Rc	
 
 @ o M o d e r a t o r F o r u m s   n v a r c h a r ( 4 0 0 0 )   O U T 	 - - ԏVv(u7bQNezv  F o r u m   I D   RhN  R _vRh	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgeQSpe^lRS_6q
NǏ
 
 - - = = YgeQSpeTlRKN
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( R T R i m ( L T R i m ( @ N a m e ) ) = N ' ' )   o r   ( R T R i m ( L T R i m ( @ P a s s w o r d ) ) = N ' ' ) 
 
 
 
 	 B E G I N   
 
 	 	 S E L E C T   @ o P a s s = 0 
 
 	 	 R A I S E R R O R ( N ' (u7b
TT[x
NSN:Nzz0' , 1 6 , 1 ) 
 
 	 	 R E T U R N 
 
 	 E N D 	 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg(u7b
TW[[x&{Tv^N  U s e r R o l e   _N&{T
 
 	 	 - - = = U s e r R o l e   &{T/fǏhg~[v  @ U s e r R o l e   /f&TQs(W(u7bSNvv҉rRh-Neg[sv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - I F   E x i s t s   ( S E L E C T   u s . [ I D ]   F R O M   d b o . U s e r s   u s   I N N E R   J O I N   d b o . U s e r R o l e   u r   O N   u r . [ I D ] = u s . U s e r R o l e   W H E R E   ( u s . [ N a m e ] = @ N a m e )   A N D   ( u s . [ P a s s w o r d ] = @ P a s s w o r d )   A N D   u r . [ N a m e ] = @ U s e r R o l e ) 
 
 
 
 	 	 I F   E x i s t s   ( S E L E C T   u s . [ I D ]   F R O M   d b o . U s e r s   u s   W H E R E   ( u s . [ N a m e ] = @ N a m e )   A N D   ( u s . [ P a s s w o r d ] = @ P a s s w o r d ) )     
 
 
 
 	 	 	 B E G I N   
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = ǏԏV  1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 S E L E C T   @ o P a s s = 1 
 
 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = U_(WHh(u7b{vU_U_0 - {vU_T a r g e t I D   ُ̑l	gaINvc(u  0   1\SNN	
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 E X E C   d b o . S i t e L o g S a v e   @ N a m e ,   0 ,   0 
 
 	 	 	 E N D     
 
 	 	 E l s e 
 
 	 	 	 B E G I N   
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = l	gǏԏV  0 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 S E L E C T   @ o P a s s = 0   	 
 
 	 	 	 E N D     
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ԏV(u7bvv҉rRh
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ o U s e r R o l e s = C O A L E S C E ( @ o U s e r R o l e s + N ' , ' , N ' ' )   +   u r . [ N a m e ]   F R O M   d b o . U s e r s   u s   I N N E R   J O I N   d b o . U s e r R o l e   u r   O N   u r . [ I D ] = u s . U s e r R o l e   W H E R E   u s . [ N a m e ] = @ N a m e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ԏV(u7bQNezv  F o r u m   Rh
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ o M o d e r a t o r F o r u m s = C O A L E S C E ( @ o M o d e r a t o r F o r u m s + N ' , ' , N ' ' )   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , [ I D ] )   F R O M   d b o . F o r u m   W H E R E   d b o . U D F _ U s e r M o d e r a t o r ( @ N a m e , [ I D ] ) = 1 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ԏV(u7b/f&T  A m i n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ o U s e r A d m i n = d b o . U D F _ U s e r A d m i n ( @ N a m e ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ԏV(u7b/f&T  A m i n E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ o U s e r A d m i n E d i t o r = d b o . U D F _ U s e r A d m i n E d i t o r ( @ N a m e ) 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r A u t h e n t i c a t i o n ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c Q u e r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c Q u e r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c Q u e r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ُ*N  S P   v\O(u9hnc~[~"}g  T o p i c   Rh
 
 - - = = Spe@b	gh"}~"}\O:NSpeYgSpe:NN U L L ,   Ry
NSNh"}
 
 - - = = ^zRu:g6RHQ\ck8^g~gX[eQ N*N~g N7hFOYN N*NP a g i n g I D vhSϑ	9hncP a g i n g I D @ P a g e S i z e @ C u r r e n t P a g e 	SS_MRuvU_v^\;`upe\O:N N*NRhMOQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c Q u e r y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C u l t u r e   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MRy  :NNSv^yNv  T o p i c S t a t u s C u s t o m i z a t i o n < x x x >   	
 
 
 
 @ F o r u m I D   i n t , 	 	 	 	 - - F o r u m   v  I D     >y:Sd"}/fc[  F o r u m   Q萄vd"}sSSd"},g  F o r u m   QvQ[	
 
 @ K e y w o r d   n v a r c h a r ( 4 0 0 0 ) , 	 	 - - d"}sQ.͋
 
 @ K e y w o r d F l a g   i n t , 	 	 	 - - c[d"}v/f;Nh؏/fߍ^Q[؏/fvS0( 1 .   ;Nh,     2 . ;NQ[Sߍ^,     3 . vS) 
 
 @ U s e r N a m e   n v a r c h a r ( 5 0 ) , 	 	 - - ;Nbߍ^(u7b
T
 
 @ O n l i n e   i n t , 	 	 	 	 - - ;Nbߍ4(u7b/f&T(W~  1 . (W~    0 .   
N(W	
 
 @ U s e r F l a g   i n t , 	 	 	 	 - - c[d"}v/f;N(u7b؏/fߍ^(u7b؏/fvS0  ( 1 .   ;N(u7b,     2 . ߍ^(u7b,     3 . vS) 
 
 @ P o s t T i m e F r o m   d a t e t i m e , 	 	 - - g;NS^wYe
 
 @ P o s t T i m e T o   d a t e t i m e , 	 	 	 - - g;NS^~_ge
 
 @ T o p i c S t a t u s   I N T , 	 	 	 - - ;Nr`1 0zz;N2 0[;N3 0p;N4 0|NS;N5 0ݏy;N6 0nv;N	
 
 
 
 @ P a g e S i z e   I N T , 	 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T , 	 	 	 - - ux:g6RS_MRu
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) 	 	 - - c^e_  A S C ,   D E S C 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spev8YtN(WX[(WR`Sv0WeO(u	  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ C u l t u r e = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ C u l t u r e ) 
 
 S E T   @ K e y w o r d = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ K e y w o r d ) 
 
 S E T   @ U s e r N a m e = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ U s e r N a m e ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = (u7bCgPhg    >y:Sg[/fc[  F o r u m   Qvg1\/f`OۏeQ N*N  F o r u m   (W  F o r u m   VQg0bNS [c[  F o r u m   ۏLCgPhgTbvwQSOg-N1\
N_mSCgPN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 D E C L A R E   @ o P a s s   I N T     
 
 E X E C   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e l e c t   @ U s e r , @ F o r u m I D , @ o P a s s   O U T     
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D     
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (uegg^W h e r e NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 )         
 
 D E C L A R E   @ D y n W h e r e   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  T a s k L i s t   Tnfg$Ny`b_Yt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ T o p i c S t a t u s = - 1 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_  @ T o p i c S t a t u s   I{N  - 1   vePbN~[g  T a s k L i s t 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = R^Ruh  
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ D y n S Q L = N '   S E T   N O C O U N T   O N       ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ P a g i n g   t a b l e   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ I D ]   i n t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c U s e r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,     ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   O n l i n e   i n t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T i t l e   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   H i t   i n t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A t t a c h m e n t N a m e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s   i n t ,     ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s I c o n N a m e   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s D e s c r i p t i o n   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   U p d a t e T i m e   d a t e t i m e ,     ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F o l l o w U p   i n t   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQkXEQnv4
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   d i s t i n c t       '     
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ I D ]   a s   [ I D ] ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ U s e r ]   a s   T o p i c U s e r ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ P u b l i c L o g i n O n l i n e ( t p . [ U s e r ] )   a s   O n l i n e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . T i t l e   a s   T i t l e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . H i t   a s   H i t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . A t t a c h m e n t N a m e   a s   A t t a c h m e n t N a m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . [ I D ]   a s   T o p i c S t a t u s ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . I c o n N a m e   a s   T o p i c S t a t u s I c o n N a m e ,   ' 
 
 	 	 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . D e s c r i p t i o n   a s   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ T o p i c S t a t u s D e s c r i p t i o n ( '   +     c o n v e r t ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   ' , N ' ' '     +   @ C u l t u r e   +     ' ' ' , t s . [ I D ] )   a s   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   M A X ( I S N U L L ( f u . P o s t T i m e , t p . P o s t T i m e ) )   a s   U p d a t e T i m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C O U N T ( f u . [ I D ] )   a s   F o l l o w U p   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . T o p i c   t p   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . F o l l o w U p   f u   O N   f u . T o p i c I D = t p . [ I D ]   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n n e r   J o i n   d b o . T o p i c S t a t u s   t s   O N   t s . [ I D ] = t p . T o p i c S t a t u s   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W h e r e   t p . F o r u m I D =   '   +   C O N V E R T ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   N '   A n d   t p . T o p i c S t a t u s = 6   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   g r o u p   b y   t p . [ I D ] ,   t p . [ U s e r ] ,   t p . T i t l e ,   t p . H i t ,   t p . A t t a c h m e n t N a m e ,   t s . [ I D ] ,   t s . I c o n N a m e ,   t s . [ D e s c r i p t i o n ]   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   U p d a t e T i m e   D E S C   ' 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = YgX[(Wnv^RR N*NL(WNR;̑bNN N*N  R o w H i g h l i g h t C r i t e r i a   :g6RSNnv N*NW[k
TNSW[kvS<PS_W[kvU_<PI{NS<PveP*NU_@b(WvLRN>f:y  	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . T o p i c   W h e r e   F o r u m I D = @ F o r u m I D   A n d   T o p i c S t a t u s = 6 ) 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 	 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ I D ] ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c U s e r ,     ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   O n l i n e ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T i t l e ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   H i t ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A t t a c h m e n t N a m e ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s ,     ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s I c o n N a m e ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   U p d a t e T i m e ,     ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F o l l o w U p   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 	 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   V a l u e s   ' 
 
 	 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   0 ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = kXEQRuh  ^nv4	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   d i s t i n c t       '     
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ I D ]   a s   [ I D ] ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ U s e r ]   a s   T o p i c U s e r ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ P u b l i c L o g i n O n l i n e ( t p . [ U s e r ] )   a s   O n l i n e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . T i t l e   a s   T i t l e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . H i t   a s   H i t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . A t t a c h m e n t N a m e   a s   A t t a c h m e n t N a m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . [ I D ]   a s   T o p i c S t a t u s ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . I c o n N a m e   a s   T o p i c S t a t u s I c o n N a m e ,   ' 
 
 	 	 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . D e s c r i p t i o n   a s   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ T o p i c S t a t u s D e s c r i p t i o n ( '   +     c o n v e r t ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   ' , N ' ' '     +   @ C u l t u r e   +     ' ' ' , t s . [ I D ] )   a s   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   M A X ( I S N U L L ( f u . P o s t T i m e , t p . P o s t T i m e ) )   a s   U p d a t e T i m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C O U N T ( f u . [ I D ] )   a s   F o l l o w U p   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . T o p i c   t p   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . F o l l o w U p   f u   O N   f u . T o p i c I D = t p . [ I D ]   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n n e r   J o i n   d b o . T o p i c S t a t u s   t s   O N   t s . [ I D ] = t p . T o p i c S t a t u s   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W h e r e   t p . F o r u m I D =   '   +   C O N V E R T ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   N '   A n d   t p . T o p i c S t a t u s < > 6   ' 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = |~{tXTTezSNw0R@b	gr`v;NSbݏy;N	  nf(u7b
Nw0Rݏy;N2 0 1 0 - 1 1 - 2 1 :g6Rf
NO(u	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1   A N D   d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m I D ) < > 1 
 
 	 	 - - B E G I N 
 
 	 	 - - 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A n d   t p . T o p i c S t a t u s < > 5   ' 
 
 	 	 - - E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = MRbv  S Q L   S gTR    G R O U P   B Y 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   g r o u p   b y   t p . [ I D ] ,   t p . [ U s e r ] ,   t p . T i t l e ,   t p . H i t ,   t p . A t t a c h m e n t N a m e ,   t s . [ I D ] ,   t s . I c o n N a m e ,   t s . [ D e s c r i p t i o n ]   ' 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   
 
 	 	 - - = = R
N  O r d e r   B y   NS
 
 	 	 - - = = Yg  O r d e r B y = ' '   RO(u:w  o r d e r   b y   U p d a t e T i m e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   
 
 	 	 S E T   @ O r d e r B y = L T R I M ( R T R I M ( @ O r d e r B y ) ) 
 
 	 	 S E T   @ O r d e r B y O r d e r = L T R I M ( R T R I M ( @ O r d e r B y O r d e r ) ) 
 
 	 	 
 
 	 	 I F   L E N ( @ O r d e r B y ) = 0   O R     L E N ( @ O r d e r B y O r d e r ) = 0 
 
 	 	 	 B E G I N 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   U p d a t e T i m e   D E S C   ' 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ '   +   @ O r d e r B y   +   N ' ]   '   +   @ O r d e r B y O r d e r 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = [Nnfg`b_bN9hnccOvgagN Nag Nag0Weg
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = R^Ruh  
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ D y n S Q L = N '   S E T   N O C O U N T   O N       ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ P a g i n g   t a b l e   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ I D ]   i n t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c U s e r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,     ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   O n l i n e   i n t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T i t l e   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   H i t   i n t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A t t a c h m e n t N a m e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s   i n t ,     ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s I c o n N a m e   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s D e s c r i p t i o n   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   U p d a t e T i m e   d a t e t i m e ,     ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F o l l o w U p   i n t   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQkXEQnv4
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   d i s t i n c t       '     
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ I D ]   a s   [ I D ] ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ U s e r ]   a s   T o p i c U s e r ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ P u b l i c L o g i n O n l i n e ( t p . [ U s e r ] )   a s   O n l i n e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . T i t l e   a s   T i t l e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . H i t   a s   H i t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . A t t a c h m e n t N a m e   a s   A t t a c h m e n t N a m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . [ I D ]   a s   T o p i c S t a t u s ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . I c o n N a m e   a s   T o p i c S t a t u s I c o n N a m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ T o p i c S t a t u s D e s c r i p t i o n ( '   +     c o n v e r t ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   ' , N ' ' '     +   @ C u l t u r e   +     ' ' ' , t s . [ I D ] )   a s   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . D e s c r i p t i o n   a s   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   M A X ( I S N U L L ( f u . P o s t T i m e , t p . P o s t T i m e ) )   a s   U p d a t e T i m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C O U N T ( f u . [ I D ] )   a s   F o l l o w U p   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . T o p i c   t p   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . F o l l o w U p   f u   O N   f u . T o p i c I D = t p . [ I D ]   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n n e r   J o i n   d b o . T o p i c S t a t u s   t s   O N   t s . [ I D ] = t p . T o p i c S t a t u s   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W h e r e   t p . F o r u m I D =   '   +   C O N V E R T ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   N '   A n d   t p . T o p i c S t a t u s = 6   ' 	 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   g r o u p   b y   t p . [ I D ] ,   t p . [ U s e r ] ,   t p . T i t l e ,   t p . H i t ,   t p . A t t a c h m e n t N a m e ,   t s . [ I D ] ,   t s . I c o n N a m e ,   t s . D e s c r i p t i o n   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   U p d a t e T i m e   D E S C   ' 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = YgX[(Wnv^RR N*NL(WNR;̑bNN N*N  R o w H i g h l i g h t C r i t e r i a   :g6RSNnv N*NW[k
TNSW[kvS<PS_W[kvU_<PI{NS<PveP*NU_@b(WvLRN>f:y  	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . T o p i c   W h e r e   F o r u m I D = @ F o r u m I D   A n d   T o p i c S t a t u s = 6 ) 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 	 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ I D ] ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c U s e r ,     ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   O n l i n e ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T i t l e ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   H i t ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A t t a c h m e n t N a m e ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s ,     ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s I c o n N a m e ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   U p d a t e T i m e ,     ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F o l l o w U p   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 	 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   V a l u e s   ' 
 
 	 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   0 ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l ,   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n u l l   ' 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = kXEQRuh  ^nv4	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   d i s t i n c t       '     
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ I D ]   a s   [ I D ] ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ U s e r ]   a s   T o p i c U s e r ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ P u b l i c L o g i n O n l i n e ( t p . [ U s e r ] )   a s   O n l i n e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . T i t l e   a s   T i t l e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . H i t   a s   H i t ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . A t t a c h m e n t N a m e   a s   A t t a c h m e n t N a m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . [ I D ]   a s   T o p i c S t a t u s ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . I c o n N a m e   a s   T o p i c S t a t u s I c o n N a m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ T o p i c S t a t u s D e s c r i p t i o n ( '   +     c o n v e r t ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   ' , N ' ' '     +   @ C u l t u r e   +     ' ' ' , t s . [ I D ] )   a s   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . D e s c r i p t i o n   a s   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   M A X ( I S N U L L ( f u . P o s t T i m e , t p . P o s t T i m e ) )   a s   U p d a t e T i m e ,   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C O U N T ( f u . [ I D ] )   a s   F o l l o w U p   ' 
 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . T o p i c   t p   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . F o l l o w U p   f u   O N   f u . T o p i c I D = t p . [ I D ]   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n n e r   J o i n   d b o . T o p i c S t a t u s   t s   O N   t s . [ I D ] = t p . T o p i c S t a t u s   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W h e r e   t p . F o r u m I D =   '   +   C O N V E R T ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   N '   A n d   t p . T o p i c S t a t u s < > 6   ' 	 
 
 
 
 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = vQ[R`  W H E R E   NS
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ D y n W h e r e = N ' ' 
 
 	 	 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = @ K e y w o r d   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 	 	 - - = = 9hnc  @ K e y w o r d F l a g   Q[/fN  t p . T i t l e ,   t p . C o n t e n t ,   f u . C o n t e n t   ؏/fhQ-Nd"}
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ K e y w o r d   I S   N O T   N U L L     
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = nczz<h  ( V:N  @ K e y w o r d   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 S E T   @ K e y w o r d = R T R I M ( L T R I M ( @ K e y w o r d ) )   
 
 	 	 
 
 	 	 	 I F   @ K e y w o r d < > N ' '   
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = [  @ K e y w o r d F l a g   R	Ny`b_Yt
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   @ K e y w o r d F l a g = 1 
 
 	 	 
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 - - = = N  T i t l e   -Ng
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 S E T   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   t p . T i t l e   l i k e   N ' ' % '   +   @ K e y w o r d   +   N ' % ' '   '   
 
 	 	 	 	 	 E N D 
 
 	 	 
 
 	 	 	 	 E L S E   I F   @ K e y w o r d F l a g = 2 
 
 	 	 
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 - - = = N  t p . C o n t e n t   b  f u . C o n t e n t   -Ng
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 S E T   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   ( t p . C o n t e n t   l i k e   N ' ' % '   +   @ K e y w o r d   +   N ' % ' '   o r   f u . C o n t e n t   l i k e   N ' ' % '   +   @ K e y w o r d   +   N ' % ' ' )   '   
 
 	 	 	 	 	 E N D 
 
 	 	 
 
 	 	 	 	 E L S E 
 
 	 	 
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 - - = = Nt p . T i t l e   b  t p . C o n t e n t   b  f u . C o n t e n t   -Ng
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 S E T   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   ( t p . T i t l e   l i k e   N ' ' % '   +   @ K e y w o r d   +   N ' % ' '   o r   t p . C o n t e n t   l i k e   N ' ' % '   +   @ K e y w o r d   +   N ' % ' '   o r   f u . C o n t e n t   l i k e   N ' ' % '   +   @ K e y w o r d   +   N ' % ' ' )   '   
 
 	 	 	 	 	 E N D 
 
 	 	 	 E N D 
 
 	 	 E N D 
 
 	 	 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = @ U s e r N a m e   ~~"}I{N0 bzzW[&{h:y
NSN~P6R	
 
 	 	 - - = = 9hnc  @ U s e r F l a g   Q[/fN  T o p i c ,   F o l l o w U p   ؏/fN-Nd"}
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ U s e r N a m e   I S   N O T   N U L L     
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = nczz<h  ( V:N  @ U s e r   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 S E T   @ U s e r N a m e = R T R I M ( L T R I M ( @ U s e r N a m e ) )   
 
 	 	 
 
 	 	 	 I F   @ U s e r N a m e < > N ' '   
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = [  @ U s e r F l a g   R	Ny`b_Yt
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   @ U s e r F l a g = 1 
 
 	 	 
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 - - = = N  T o p i c   -Ng
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 S E T   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   t p . [ U s e r ]   =   N ' ' '   +   @ U s e r N a m e   +   N ' ' '   '   
 
 	 	 	 	 	 E N D 
 
 	 	 
 
 	 	 	 	 E L S E   I F   @ U s e r F l a g = 2 
 
 	 	 
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 - - = = N  F o l l o w U p   -Ng
 
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 S E T   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   f u . [ U s e r ]   =   N ' ' '   +   @ U s e r N a m e   +   N ' ' '   '   
 
 	 	 	 	 	 E N D 
 
 	 	 
 
 	 	 	 	 E L S E 
 
 	 	 
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 - - = = NT o p i c   b  F o l l o w U p   -Ng
 
 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 S E T   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   ( t p . [ U s e r ]   =   N ' ' '   +   @ U s e r N a m e   +   N ' ' '   o r   f u . [ U s e r ]   =   N ' ' '   +   @ U s e r N a m e   +   N ' ' ' )   '   
 
 	 	 	 	 	 E N D 
 
 	 	 	 E N D 
 
 	 	 E N D 
 
 	 	 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = @ P o s t T i m e F r o m ,   @ P o s t T i m e T o     ~~"}I{N0 bN U L L h:y
NSN~P6R	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ P o s t T i m e F r o m   I S   N O T   N U L L   A N D   @ P o s t T i m e T o   I S   N O T   N U L L 
 
 	 	 B E G I N 
 
 	 	 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   t p . P o s t T i m e > = N ' ' '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ P o s t T i m e F r o m )   +   N ' ' '   a n d   t p . P o s t T i m e < = N ' ' '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ P o s t T i m e T o )   +   ' ' '   ' 
 
 	 	 E N D 
 
 	 	 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = @ T o p i c S t a t u s   ~~"}I{N0 bN U L L h:y
NSN~P6R	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ T o p i c S t a t u s   I S   N O T   N U L L   A N D   @ T o p i c S t a t u s < > 0 
 
 	 	 B E G I N 
 
 	 	 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   t p . T o p i c S t a t u s = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ T o p i c S t a t u s )   
 	 	 	 	 
 
 	 	 E N D 
 
 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = |~{tXTTezSNw0R@b	gr`v;NSbݏy;N	  nf(u7b
Nw0Rݏy;N2 0 1 0 - 1 1 - 2 1 :g6Rf
NO(u	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1   A N D   d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m I D ) < > 1 
 
 	 	 - - B E G I N 
 
 	 	 - - 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A n d   t p . T o p i c S t a t u s < > 5   ' 
 
 	 	 - - E N D 
 
 	 	 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = MRbv  S Q L   S gTR  vQ[R`  W H E R E   NS  @ D y n S Q L   -N]~S+T  W H E R E   1 = 1 	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   @ D y n W h e r e 
 
 	 	 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = MRbv  S Q L   S gTR    G R O U P   B Y 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   g r o u p   b y   t p . [ I D ] ,   t p . [ U s e r ] ,   t p . T i t l e ,   t p . H i t ,   t p . A t t a c h m e n t N a m e ,   t s . [ I D ] ,   t s . I c o n N a m e ,   t s . D e s c r i p t i o n   ' 
 
 	 	 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = R
N  O r d e r   B y   NS
 
 	 	 - - = = Yg  O r d e r B y = ' '   RO(u:w  o r d e r   b y   U p d a t e T i m e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ O r d e r B y = L T R I M ( R T R I M ( @ O r d e r B y ) ) 
 
 	 	 S E T   @ O r d e r B y O r d e r = L T R I M ( R T R I M ( @ O r d e r B y O r d e r ) ) 
 
 	 	 
 
 	 	 I F   L E N ( @ O r d e r B y ) = 0   O R     L E N ( @ O r d e r B y O r d e r ) = 0 
 
 	 	 	 B E G I N 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   U p d a t e T i m e   D E S C   ' 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ '   +   @ O r d e r B y   +   N ' ]   '   +   @ O r d e r B y O r d e r 
 
 	 	 	 E N D 
 
 	 	 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e t   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   * , P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ P a g e S i z e )   +   N ' ) )   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ F i r s t R e c o r d )   +   N '   a n d   P a g i n g I D < '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgR`Sv^
NSNǏ|~
NP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s D y n S Q L   I N T 
 
 E X E C   d b o . P u b l i c D y n S Q L L e n g t h C h e c k   @ D y n S Q L , @ o P a s s D y n S Q L   O U T 
 
 I F   @ o P a s s D y n S Q L = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLR`  S Q L   S   _Y~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c Q u e r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c D y n S Q L L e n g t h C h e c k         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c D y n S Q L L e n g t h C h e c k ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c D y n S Q L L e n g t h C h e c k ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (WgbLR`  S Q L   SKNMRhgvQ^Yg0R gP^  N V A R C H A R ( 4 0 0 0 )   RbJT
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c D y n S Q L L e n g t h C h e c k 
 
 
 
 @ D y n S Q L   N V A R C H A R ( 4 0 0 0 ) , 	 	 	 - - R`  S Q L   S
 
 @ o P a s s   I N T   O U T 	 	 	 	 - - QSpe^l	gǏԏV  1   &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ^Ǐ|~
NPbJT
 
 - - = = laQpe  L E N ( )   (W{W[&{2N^vePO\~>\vzz<hcd(WY(WgN`QN hgvW[&{2NS+T~>\vzz<hYg\ُNzz<h{(WQRW[&{2N^0R  4 0 0 0 6q(u  L E N ( )   {tS
NY  4 0 0 0 :NN㉳Qُ*NbNO(u  D A T A L E N G T H ( )   QpeNf
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   D A T A L E N G T H ( @ D y n S Q L ) > = 8 0 0 0 
 
 
 
 	 B E G I N 
 
 	 	 S E T   @ o P a s s = 0 
 
 	 	 R A I S E R R O R ( N ' RMbvNRǏN^'YǏN|~v
NP0Yg`ckgbLNNd\O< l i > d"}`SeQNǏvd"}~"}0< / l i > < l i > vQNd\OT||~{tXT0< / l i > ' , 1 6 , 1 ) 
 
 	 	 R E T U R N 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c D y n S Q L L e n g t h C h e c k ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v  T o p i c I D   	S  T o p i c   Te\  T o p i c     v  H i t   <P+ + 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c S e l e c t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   I N T 	 	 - - c[v  T o p i c   I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  T o p i c   I D   _    F o r u m   I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m I D   I N T 
 
 S E T   @ F o r u m I D = d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( @ T o p i c I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 D E C L A R E   @ o P a s s   I N T     
 
 E X E C   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e l e c t   @ U s e r , @ F o r u m I D , @ o P a s s   O U T     
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D     
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Nb\(u0Rv NNSϑ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 D E C L A R E   @ C u r r e n t U s e r   N V A R C H A R ( 5 0 ) 
 
 S E T   @ C u r r e n t U s e r = d b o . U D F _ U s e r C u r r e n t ( ) 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =   T o p i c   H i t   <P+ + 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . T o p i c   S E T   H i t = H i t + 1   W H E R E   [ I D ] = @ T o p i c I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	Sc[v  T o p i c   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 
 
 	 f r m . [ I D ]   a s   F o r u m I D , 
 
 	 t p s . N a m e C   a s   T o p i c S t a t u s , 
 
 	 t p s . [ I D ]   a s   T o p i c S t a t u s I D , 
 
 	 t p s . I c o n N a m e   a s   I c o n N a m e , 
 
 	 t p s . D e s c r i p t i o n C   a s   D e s c r i p t i o n C , 
 
 	 t p . [ I D ]   a s   [ I D ] , 
 
 	 t p . [ U s e r ]   a s   [ U s e r ] , 
 
 	 d b o . U D F _ P u b l i c L o g i n O n l i n e ( t p . [ U s e r ] )   a s   O n l i n e , 
 
 	 t p . P o s t T i m e   a s   P o s t T i m e , 
 
 	 t p . T i t l e   a s   T i t l e , 
 
 	 t p . C o n t e n t   a s   C o n t e n t , 
 
 	 t p . A t t a c h m e n t N a m e   a s   A t t a c h m e n t N a m e , 
 
 	 t p . H i t   a s   H i t , 
 
 
 
 	 C a n M o d i f y = 
 
 	 C A S E   
 
 	 	 W H E N   L O W E R ( R T R I M ( L T R I M ( t p . [ U s e r ] ) ) ) = L O W E R ( R T R I M ( L T R I M ( @ U s e r ) ) )   T H E N   1 
 
 	 	 W H E N   d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m I D ) = 1   T H E N   1 
 
 	 	 W H E N   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1   T H E N   1 
 
 	 	 E L S E   0 
 
 	 E N D , 
 
 
 
 	 C a n S e t S t a t u s = 
 
 	 C A S E 
 
 	 	 W H E N   d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m I D ) = 1   T H E N   1 
 
 	 	 W H E N   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1   T H E N   1 
 
 	 	 E L S E   0 
 
 	 E N D , 
 
 
 
 	 C a n M o v e R e s o u r c e = 
 
 	 C A S E 
 
 	 	 W H E N   d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1   T H E N   1 
 
 	 	 E L S E   0 	 	 
 
 	 E N D 
 
 	 
 
 
 
 F R O M   	 d b o . T o p i c   t p   
 
 I N N E R   J O I N   d b o . F o r u m   f r m   O N   f r m . [ I D ] = t p . F o r u m I D 
 
 I N N E R   J O I N   d b o . T o p i c S t a t u s   t p s   O N   t p s . [ I D ] = t p . T o p i c S t a t u s 
 
 
 
 W H E R E   t p . [ I D ] = @ T o p i c I D 
 
 
 
 O R D E R   B Y   t p . P o s t T i m e   D E S C 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  T o p i c 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o r u m I D   i n t , 	 	 	 	 	 - - F o r u m   v  I D 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 - - ;Nh
 
 @ C o n t e n t   n t e x t , 	 	 	 	 	 - - ;NQ[  
NPe,g	
 
 @ A t t a c h m e n t N a m e   n v a r c h a r ( 2 0 0 0 ) , 	 	 - - ;NSDN
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . T o p i c U s e r A u t h e n t i c a t i o n S a v e   @ U s e r , @ F o r u m I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MR(u7bS_MRe
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r r e n t U s e r   n v a r c h a r ( 5 0 ) 
 
 D E C L A R E   @ C u r r e n t T i m e   n v a r c h a r ( 5 0 ) 
 
 
 
 S E T   @ C u r r e n t U s e r = @ U s e r 
 
 S E T   @ C u r r e n t T i m e = G E T D A T E ( ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . T o p i c ( F o r u m I D , [ U s e r ] , P o s t T i m e , T i t l e , C o n t e n t , A t t a c h m e n t N a m e )   V A L U E S ( @ F o r u m I D , @ C u r r e n t U s e r , @ C u r r e n t T i m e , @ T i t l e , @ C o n t e n t , @ A t t a c h m e n t N a m e ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHheXN^P[	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   8 ,   @ o N e w I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o l l o w U p S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o l l o w U p S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o l l o w U p S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v  T o p i c I D   	S  T o p i c   yNvߍ^
 
 - - = = Yg  @ T o p i c I D   /fckpeR	S  T o p i c I D   N@b	gߍ^Yg/fpeRSvQ~[<P:N  F o l l o w U p . I D   (u	SUSrv  F o l l o w U p   U_
 
 - - = = TeԏVS_MR  F o l l o w U p   /f&TSNS_MR(u7bO9eO9e Rd	(u7b]SNO9e]vߍ4Hr;NSNO9e@b	gߍ4A d m i n   (u7bSNO9e@b	gߍ4
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o l l o w U p S e l e c t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   I N T 	 	 - - c[v  T o p i c   I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n S e l e c t   @ U s e r , @ T o p i c I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 I F   @ T o p i c I D > = 0 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 	Sc[v  T o p i c   U_Nv@b	g  F o l l o w U p 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T 
 
 	 	 	 
 
 	 	 	 f u . T o p i c I D   a s   T o p i c I D , 
 
 	 	 	 f u . [ I D ]   a s   [ I D ] , 
 
 	 	 	 f u . [ U s e r ]   a s   [ U s e r ] , 
 
 	 	 	 d b o . U D F _ P u b l i c L o g i n O n l i n e ( f u . [ U s e r ] )   a s   O n l i n e , 
 
 	 	 	 f u . P o s t T i m e   a s   P o s t T i m e , 
 
 	 	 	 f u . C o n t e n t   a s   C o n t e n t , 
 
 	 	 	 f u . A t t a c h m e n t N a m e   a s   A t t a c h m e n t N a m e , 
 
 
 
 	 	 	 C a n M o d i f y = 
 
 	 	 	 C A S E   
 
 	 	 	 	 W H E N   L O W E R ( R T R I M ( L T R I M ( f u . [ U s e r ] ) ) ) = L O W E R ( R T R I M ( L T R I M ( @ U s e r ) ) )   T H E N   1 
 
 	 	 	 	 W H E N   d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( f u . T o p i c I D ) ) = 1   T H E N   1 
 
 	 	 	 	 W H E N   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1   T H E N   1 
 
 	 	 	 	 E L S E   0 
 
 	 	 	 E N D 
 
 	 	 
 
 	 	 F R O M   	 d b o . F o l l o w U p   f u 
 
 	 	 
 
 	 	 W H E R E   f u . T o p i c I D = @ T o p i c I D 
 
 
 
 	 	 O R D E R   B Y   f u . P o s t T i m e   A S C 
 
 	 E N D 
 
 
 
 E L S E 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \  T o p i c I D   v~[<PS_\O  F o l l o w U p I D   w_	SUS*N  F o l l o w U p   U_
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T 
 
 	 	 
 
 	 	 	 f u . T o p i c I D   a s   T o p i c I D , 
 
 	 	 	 f u . [ I D ]   a s   [ I D ] , 
 
 	 	 	 f u . [ U s e r ]   a s   [ U s e r ] , 
 
 	 	 	 d b o . U D F _ P u b l i c L o g i n O n l i n e ( f u . [ U s e r ] )   a s   O n l i n e , 
 
 	 	 	 f u . P o s t T i m e   a s   P o s t T i m e , 
 
 	 	 	 f u . C o n t e n t   a s   C o n t e n t , 
 
 	 	 	 f u . A t t a c h m e n t N a m e   a s   A t t a c h m e n t N a m e , 
 
 
 
 	 	 	 C a n M o d i f y = 
 
 	 	 	 C A S E   
 
 	 	 	 	 W H E N   L O W E R ( R T R I M ( L T R I M ( f u . [ U s e r ] ) ) ) = L O W E R ( R T R I M ( L T R I M ( @ U s e r ) ) )   T H E N   1 
 
 	 	 	 	 W H E N   d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( f u . T o p i c I D ) ) = 1   T H E N   1 
 
 	 	 	 	 W H E N   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1   T H E N   1 
 
 	 	 	 	 E L S E   0 
 
 	 	 	 E N D 	 
 
 	 
 
 	 	 
 
 	 	 F R O M   	 d b o . F o l l o w U p   f u 
 
 	 	 
 
 	 	 W H E R E   f u . [ I D ] = A B S ( @ T o p i c I D ) 
 
 
 
 	 	 O R D E R   B Y   f u . P o s t T i m e   A S C 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o l l o w U p S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o l l o w U p S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o l l o w U p S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o l l o w U p S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  F o l l o w U p 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o l l o w U p S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   i n t , 	 	 	 	 	 - - ;Nv  I D 
 
 @ C o n t e n t   n t e x t , 	 	 	 	 	 - - ߍ^Q[
 
 @ A t t a c h m e n t N a m e   n v a r c h a r ( 2 0 0 0 ) 	 	 - - ߍ4vDN
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e   @ U s e r , @ T o p i c I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MR(u7bS_MRe
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r r e n t U s e r   n v a r c h a r ( 5 0 ) 
 
 D E C L A R E   @ C u r r e n t T i m e   n v a r c h a r ( 5 0 ) 
 
 
 
 S E T   @ C u r r e n t U s e r = @ U s e r 
 
 S E T   @ C u r r e n t T i m e = G E T D A T E ( ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . F o l l o w U p ( T o p i c I D , [ U s e r ] , P o s t T i m e , C o n t e n t , A t t a c h m e n t N a m e )   V A L U E S ( @ T o p i c I D , @ C u r r e n t U s e r , @ C u r r e n t T i m e , @ C o n t e n t , @ A t t a c h m e n t N a m e ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  RdNߍ^ThgS_MR  T o p i c   Nvߍ^;`pev9hncߍ^;`pevn;Nr`  zz;N[;Np;N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . T o p i c S t a t u s S e t   @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHh(W  @ T o p i c I D   NmRNߍ^	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   9 ,   @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o l l o w U p S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o l l o w U p M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o l l o w U p M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o l l o w U p M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  F o l l o w U p 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o l l o w U p M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o l l o w U p I D   i n t , 	 	 	 	 - - ߍ^v  I D 
 
 @ C o n t e n t   n t e x t , 	 	 	 	 	 - - ߍ^Q[
 
 @ A t t a c h m e n t N a m e   n v a r c h a r ( 2 0 0 0 ) 	 	 - - ߍ4vDN
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n M o d i f y   @ U s e r , @ F o l l o w U p I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . F o l l o w U p   S E T 
 
 
 
 	 C o n t e n t = @ C o n t e n t ,   
 
 	 A t t a c h m e n t N a m e = @ A t t a c h m e n t N a m e 
 
 
 
 W H E R E   [ I D ] = @ F o l l o w U p I D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  F o l l o w U p   I D   _  T o p i c I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ T o p i c I D   I N T 
 
 S E T   @ T o p i c I D = d b o . U D F _ G e t T o p i c I D F r o m F o l l o w U p I D ( @ F o l l o w U p I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9e  @ T o p i c I D   Nvߍ^	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 5 ,   @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o l l o w U p M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b[O9ec[ߍ^vCgP
 
 - - = = ߍ4S\OHr;N|~{tXTb	gCgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o l l o w U p I D   I N T , 	 	 - - c[v  F o l l o w U p   v  I D 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MR(u7bTc[  F o l l o w U p   v  (u7b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r r e n t U s e r   N V A R C H A R ( 5 0 ) 
 
 D E C L A R E   @ T h i s U s e r   N V A R C H A R ( 5 0 ) 
 
 
 
 S E T   @ C u r r e n t U s e r = @ U s e r 
 
 S E T   @ T h i s U s e r = ( S e l e c t   [ U s e r ]   F r o m   d b o . F o l l o w U p   W h e r e   [ I D ] = @ F o l l o w U p I D ) 
 
 
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 - - x x [NO9ed\ONUO(u7b S   O9e]vpenc|~{tXTTezdY	
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 I F   @ C u r r e n t U s e r < > @ T h i s U s e r   A N D   d b o . U D F _ U s e r A d m i n ( @ C u r r e n t U s e r ) < > 1   A N D   d b o . U D F _ U s e r M o d e r a t o r ( @ C u r r e n t U s e r , d b o . U D F _ G e t F o r u m I D F r o m F o l l o w U p I D ( @ F o l l o w U p I D ) ) < > 1 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' ߍ4v\O:N  % s   (u7b  % s   eCg Rd0' , 1 6 , 1 , @ T h i s U s e r , @ C u r r e n t U s e r ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c U s e r A u t h e n t i c a t i o n M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b[O9ec[;NvCgP
 
 - - = = S^\O|~{tXTTHr;N	gCg[^P[ۏLO9e
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c U s e r A u t h e n t i c a t i o n M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   I N T , 	 	 	 - - c[v  T o p i c   v  I D 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MR(u7bTc[  T o p i c   v  (u7b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r r e n t U s e r   N V A R C H A R ( 5 0 ) 
 
 D E C L A R E   @ T h i s U s e r   N V A R C H A R ( 5 0 ) 
 
 
 
 S E T   @ C u r r e n t U s e r = @ U s e r 
 
 S E T   @ T h i s U s e r = ( S e l e c t   [ U s e r ]   F r o m   d b o . T o p i c   W h e r e   [ I D ] = @ T o p i c I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ T o p i c I D   _  F o r u m I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m I D   I N T 
 
 S E L E C T   @ F o r u m I D = d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( @ T o p i c I D ) 
 
 
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 - - x x [NO9ed\ONUO(u7b S   O9e]vpenc|~{tXTTezdY	
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 I F   @ C u r r e n t U s e r < > @ T h i s U s e r   A N D   d b o . U D F _ U s e r A d m i n ( @ C u r r e n t U s e r ) < > 1   A N D   d b o . U D F _ U s e r M o d e r a t o r ( @ C u r r e n t U s e r , @ F o r u m I D ) < > 1 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' ^vS\O:N  % s   `*gcCgۏLO9e0S	gS^\O|~{tXTTHr;NMb	gCgO9e0' , 1 6 , 1 , @ T h i s U s e r ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  T o p i c 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   i n t , 	 	 	 	 	 - - ;Nv  I D 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 - - ;Nh
 
 @ C o n t e n t   n t e x t , 	 	 	 	 	 - - ;NQ[
 
 @ A t t a c h m e n t N a m e   n v a r c h a r ( 2 0 0 0 ) 	 	 - - ;NvDN
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . T o p i c U s e r A u t h e n t i c a t i o n M o d i f y   @ U s e r , @ T o p i c I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . T o p i c 
 
 
 
 S E T   
 
 	 T i t l e = @ T i t l e , 
 
 	 C o n t e n t = @ C o n t e n t , 
 
 	 A t t a c h m e n t N a m e = @ A t t a c h m e n t N a m e 
 
 
 
 W H E R E   [ I D ] = @ T o p i c I D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9eN^P[	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 4 ,   @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  T o p i c 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   i n t 	 	 	 - - ;Nv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . T o p i c U s e r A u t h e n t i c a t i o n D e l e t e   @ U s e r , @ T o p i c I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . T o p i c   W H E R E   [ I D ] = @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHh RdN^P[	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   2 1 ,   @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o l l o w U p D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o l l o w U p D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o l l o w U p D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  F o l l o w U p 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o l l o w U p D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o l l o w U p I D   i n t 	 	 	 - - ߍ^v  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n D e l e t e   @ U s e r , @ F o l l o w U p I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . F o l l o w U p   W H E R E   [ I D ] = @ F o l l o w U p I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  F o l l o w U p   I D   _  T o p i c I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ T o p i c I D   I N T 
 
 S E T   @ T o p i c I D = d b o . U D F _ G e t T o p i c I D F r o m F o l l o w U p I D ( @ F o l l o w U p I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  RdNߍ^ThgS_MR  T o p i c   Nvߍ^;`pev9hncߍ^;`pevn;Nr`  zz;N[;Np;N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . T o p i c S t a t u s S e t   @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTbN\S_MRv  A c t i v i t y   U_(WHh   Rd  @ T o p i c I D   Nvߍ^	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r , 2 2 , @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o l l o w U p D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c S t a t u s S e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c S t a t u s S e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c S t a t u s S e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 1u|~9hncߍ^peϑꁨRn  T o p i c   S t a t u s 
 
 - - = = T o p i c S t a t u s   -NMR	N*N  S t a t u s   \eߍ^]	gߍ^p;N	1u|~9hncߍ^peϑꁨRn gT	N*N  S t a t u s   |NS;Ny_;Nnv;N	N]n
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c S t a t u s S e t 
 
 
 
 @ T o p i c I D   i n t 	 	 	 - - ;Nv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgV:N  S P   @bvn  T o p i c S t a t u s   /f NN[hQvkeOeaQ[vn1\/fn^P[v   zz;N    ^zz;N    p;N   ُ7h NN^;N  S t a t u s   6q
N CgPhg  T o p i c S t a t u s S e t E l i t e ,   T o p i c S t a t u s S e t T a b o o ,   T o p i c S t a t u s S e t S t i c k y ,   T o p i c S t a t u s R e v o k e     R 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ_S_MR  T o p i c   Nvߍ^peϑ9hncُ*NpeϑQ[  T o p i c   v    S t a t u s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ T o p i c S t a t u s   I N T 
 
 
 
 S E T   @ T o p i c S t a t u s = 
 
 ( 
 
 	 S e l e c t   
 
 	 	 C a s e   
 
 	 	 	 W h e n   C o u n t ( [ I D ] )   I S   N U L L   T h e n   1   	 	 	 - - zz;N
 
 	 	 	 W h e n   C o u n t ( [ I D ] ) < 1   T h e n   1 	 	 	 	 - - zz;N
 
 	 	 	 W h e n   C o u n t ( [ I D ] ) > = 1   A n d   C o u n t ( [ I D ] ) < 1 0   T h e n   2 	 	 - - ^zz;N
 
 	 	 	 W h e n   C o u n t ( [ I D ] ) > = 1 0   T h e n   3 	 	 	 	 - - p;N
 
 	 	   E n d   
 
 
 
 	 	 F r o m   d b o . F o l l o w U p   W h e r e   T o p i c I D = @ T o p i c I D 
 
 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = nlacd  T o p i c S t a t u s = 4 / 5 / 6   	Ny`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . T o p i c   S E T   T o p i c S t a t u s = @ T o p i c S t a t u s   W H E R E   [ I D ] = @ T o p i c I D   A N D   T o p i c S t a t u s   N O T   I N   ( 4 , 5 , 6 ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c S t a t u s S e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e t S t a t u s         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S e t S t a t u s ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S e t S t a t u s ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b[O9ec[;N  S t a t u s   vCgP
 
 - - = = ;Nv\OezT|~{tXTSNO9eg*N;N6qS	gezT|~{tXTMbSN\g*N^P[n:N  E l i t e   b  T a b o o ;Nv\O_Nl	gُ*NCgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e t S t a t u s 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   I N T , 	 	 	 - - c[v  T o p i c   v  I D 
 
 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ T o p i c I D   _  F o r u m I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m I D   I N T 
 
 S E L E C T   @ F o r u m I D = d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( @ T o p i c I D ) 
 
 
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 - - x x [N  S e t E l i t e ,   S e t T a b o o   d\O\  T o p i c   v  S t a t u s   n:N|NSbݏy;N	S	g|~{tXTTezMb	gCgP
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1   A N D   d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m I D ) < > 1 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' _bIk`
N/f|~{tXTbHr;N
Nn^P[r`0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S e t S t a t u s ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c U s e r A u t h e n t i c a t i o n D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b[ Rdc[;NvCgP
 
 - - = =  N*N;Nv\OSN Rd]v;NMRc/f;N؏l	gߍ^ Ne	gNߍ^;NS1u|~{tXTTez Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c U s e r A u t h e n t i c a t i o n D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   I N T , 	 	 	 - - c[v  T o p i c   v  I D 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MR(u7bTc[  T o p i c   v  (u7b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r r e n t U s e r   N V A R C H A R ( 5 0 ) 
 
 D E C L A R E   @ T h i s U s e r   N V A R C H A R ( 5 0 ) 
 
 
 
 S E T   @ C u r r e n t U s e r = @ U s e r 
 
 S E T   @ T h i s U s e r = ( S e l e c t   [ U s e r ]   F r o m   d b o . T o p i c   W h e r e   [ I D ] = @ T o p i c I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ T o p i c I D   _  F o r u m I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m I D   I N T 
 
 S E L E C T   @ F o r u m I D = d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( @ T o p i c I D ) 
 
 
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 - - x x HQ[NO9ed\ONUO(u7b S   O9e]vpenc|~{tXTTezdY	
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 I F   @ C u r r e n t U s e r < > @ T h i s U s e r   A N D   d b o . U D F _ U s e r A d m i n ( @ C u r r e n t U s e r ) < > 1   A N D   d b o . U D F _ U s e r M o d e r a t o r ( @ C u r r e n t U s e r , @ F o r u m I D ) < > 1 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' ^8^bIk`*gcCg[,g^ۏL Rdd\O0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 - - = = vQ!khg;NNb/f&T]~	gߍ^Yg	gR\O,gN
N RdFO|~{tXTSN Rd
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . F o l l o w U p   W h e r e   T o p i c I D = @ T o p i c I D ) 
 
 
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = hgS_MR(u7b҉rYg
N/f|~{tXTbezR
NSN Rd
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F   d b o . U D F _ U s e r A d m i n ( @ C u r r e n t U s e r ) < > 1   A N D   d b o . U D F _ U s e r M o d e r a t o r ( @ C u r r e n t U s e r , @ F o r u m I D ) < > 1 
 
 
 
 	 B E G I N 
 
 	 	 S E T   @ o P a s s = 0 
 
 	 	 R A I S E R R O R ( N ' ^8^bIk=\{`/f,g^v\OFO,g^]~	gߍ4(Wُy`QN`
NSNۏL Rdd\O0< b r / > T||~{tXTbHr;NYt0< b r / > ""0' , 1 6 , 1 ) 
 
 	 	 R E T U R N 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b[ Rdc[ߍ^vCgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o l l o w U p I D   I N T , 	 	 - - c[v  F o l l o w U p   v  I D 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MR(u7bTc[  F o l l o w U p   v  (u7b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r r e n t U s e r   N V A R C H A R ( 5 0 ) 
 
 D E C L A R E   @ T h i s U s e r   N V A R C H A R ( 5 0 ) 
 
 
 
 S E T   @ C u r r e n t U s e r = @ U s e r 
 
 S E T   @ T h i s U s e r = ( S e l e c t   [ U s e r ]   F r o m   d b o . F o l l o w U p   W h e r e   [ I D ] = @ F o l l o w U p I D ) 
 
 
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 - - x x [NO9ed\ONUO(u7b S    Rd]vpenc|~{tXTTezdY	
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 I F   @ C u r r e n t U s e r < > @ T h i s U s e r   A N D   d b o . U D F _ U s e r A d m i n ( @ C u r r e n t U s e r ) < > 1   A N D   d b o . U D F _ U s e r M o d e r a t o r ( @ C u r r e n t U s e r , d b o . U D F _ G e t F o r u m I D F r o m F o l l o w U p I D ( @ F o l l o w U p I D ) ) < > 1 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' ߍ4v\O/f  % s   (u7b  % s   eCg Rd0' , 1 6 , 1 , @ T h i s U s e r , @ C u r r e n t U s e r ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c D i c t i o n a r y I t e m L i s t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c D i c t i o n a r y I t e m L i s t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c D i c t i o n a r y I t e m L i s t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (uN  B L   -Nv  P o p u l a t e S e l e c t B o x ( )   
 
 - - = = Ng*NW[xQ-NcS@b	gagv
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c D i c t i o n a r y I t e m L i s t 
 
 
 
 @ D i c t i o n a r y T y p e   n v a r c h a r ( 5 0 ) , 	 	 - - W[xQ{|+R
 
 @ C o l u m n N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 - - \(ueg\O:NS l e c t B o x v  O p t i o n   vR    ( R
T gY1 0 0 W[&{) 
 
 @ V a l u e C o l u m n N a m e   n v a r c h a r ( 1 0 0 ) 	 - - \(ueg\O:NS e l e c t B o x -N  O p t i o n   V a l u e   vR
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = md[~gvq_T
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   N O C O U N T   O N 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R`S Q L S
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  _Y
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L   =   N '   S E T   N O C O U N T   O N   ' 
 
 S E T   @ D y n S Q L   =   @ D y n S Q L   +   N '   S E L E C T   D I S T I N C T   ' 
 
 S E T   @ D y n S Q L   =   @ D y n S Q L   +   N '   d t . '   +   @ V a l u e C o l u m n N a m e   +   N '   A S   '   +   @ V a l u e C o l u m n N a m e   +   N ' ,   '   
 
 S E T   @ D y n S Q L   =   @ D y n S Q L   +   N '   d t . '   +   @ C o l u m n N a m e   +   N '   A S   '   +   @ C o l u m n N a m e   +   N '   ' 
 
 
 
 S E T   @ D y n S Q L   =   @ D y n S Q L   +   N '   F R O M   d b o . '   +   @ D i c t i o n a r y T y p e   +   N '   d t   ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  _YgbLR`S
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c D i c t i o n a r y I t e m L i s t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c D i c t i o n a r y I t e m L i s t B y P a r e n t F i l t e r         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c D i c t i o n a r y I t e m L i s t B y P a r e n t F i l t e r ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c D i c t i o n a r y I t e m L i s t B y P a r e n t F i l t e r ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (uN  B L   -NvP o p u l a t e H i e r a r c h i c a l S e l e c t B o x ( ) 
 
 - - = = \W[xQ-Nvyv	cgq~Qv6rW[xQǏn[INԏV&{TagNvagv
 
 - - = = 6rW[xQǏn[INSpe  vcg   W H E R E   S
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c D i c t i o n a r y I t e m L i s t B y P a r e n t F i l t e r 
 
 
 
 @ D i c t i o n a r y T y p e   n v a r c h a r ( 5 0 ) , 	 	 - - W[xQ{|+R  C o l o r , G o o d s I{I{I{	
 
 @ C o l u m n N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 - - \(ueg\O:NS l e c t B o x v  O p t i o n   vR    ( R
T gY1 0 0 W[&{) 
 
 @ V a l u e C o l u m n N a m e   n v a r c h a r ( 1 0 0 ) , 	 - - \(ueg\O:NS e l e c t B o x -N  O p t i o n   V a l u e vR
 
 @ P a r e n t F i l t e r   n v a r c h a r ( 1 0 0 ) 	 	 - - OY  w h e r e   G o o d s C o l o r S i z e . G o o d s I D = 1 2 3   
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = md[~gvq_T
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   N O C O U N T   O N 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R`S Q L S
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  _Y
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L   =   N '   S E T   N O C O U N T   O N   ' 
 
 S E T   @ D y n S Q L   =   @ D y n S Q L   +   N '   S E L E C T   D I S T I N C T   '   
 
 S E T   @ D y n S Q L   =   @ D y n S Q L   +   N '   d t . '   +   @ V a l u e C o l u m n N a m e   +   N '   A S   '   +   @ V a l u e C o l u m n N a m e   +   N ' , '   
 
 S E T   @ D y n S Q L   =   @ D y n S Q L   +   N '   d t . '   +   @ C o l u m n N a m e   +   N '   A S   '   +   @ C o l u m n N a m e   +   N '   '   
 
 
 
 S E T   @ D y n S Q L   =   @ D y n S Q L   +   N '   F R O M   d b o . '   +   @ D i c t i o n a r y T y p e   +   N '   d t   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 6rW[xQP[
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   R T R I M ( L T R I M ( @ P a r e n t F i l t e r ) ) < > N ' ' 
 
 B E G I N 
 
 	 S E T   @ D y n S Q L   =   @ D y n S Q L   +   N '   W H E R E   '   +   @ P a r e n t F i l t e r   +   N '   ' 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  _YgbLR`S
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c D i c t i o n a r y I t e m L i s t B y P a r e n t F i l t e r ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c S t a t u s S e t T a b o o         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c S t a t u s S e t T a b o o ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c S t a t u s S e t T a b o o ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \g*N;Nn:Nݏy;N
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c S t a t u s S e t T a b o o 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   i n t 	 	 	 - - ;Nv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgS	g|~{tXTTezMb	gCgP\ N*N;N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e t S t a t u s   @ U s e r , @ T o p i c I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = n
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . T o p i c   S E T   T o p i c S t a t u s = 5   W H E R E   [ I D ] = @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9eN^P[	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 4 ,   @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c S t a t u s S e t T a b o o ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c S t a t u s S e t E l i t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c S t a t u s S e t E l i t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c S t a t u s S e t E l i t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \g*N;Nn:N|NS;N
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c S t a t u s S e t E l i t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   i n t 	 	 	 - - ;Nv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgS	g|~{tXTTezMb	gCgPn N*N;N:N|NS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e t S t a t u s   @ U s e r , @ T o p i c I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = n
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . T o p i c   S E T   T o p i c S t a t u s = 4   W H E R E   [ I D ] = @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9eN^P[	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 4 ,   @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c S t a t u s S e t E l i t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r R o l e S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r R o l e S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r R o l e S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV@b	g  U s e r R o l e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 5   C o m S h a r p 
 
 - - = =  geO9e  2 0 0 5 - 0 2 - 1 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r R o l e S e l e c t 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 S E L E C T   
 
 	 [ I D ] , 
 
 	 [ N a m e ] , 
 
 	 N a m e C 
 
 
 
 F R O M   d b o . U s e r R o l e   O R D E R   B Y   [ I D ] 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r R o l e S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r A c c o u n t S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r A c c o u n t S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r A c c o u n t S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  U s e r s   h_(u7bvW,gDe
 
 - - = = (u(W  U I . A d m i n . A c c o u n t . U s e r A c c o u n t U I . c s 
 
 - - = = YgcONTlv(u7b
TSpeRS	b(u7bv^NۏLCgPhg
 
 - - = = YgcOv(u7b
TSpe:NzzR	bhQ(u7bN
N(uۏLCgPhgُy`b_N(uN|~penc^b`
Ye(Wُ*NePbNO(uv/f  B u i l t I n C o n n e c t i o n S t r i n g   @bO(uv(u7b^SgbLd\O
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r A c c o u n t S e l e c t   
 
 
 
   @ N a m e   n v a r c h a r ( 5 0 ) 	 	 	 - - (u7b
T
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg~Qv(u7b
TTl^zz	R_(u7bv  P r o f i l e   [shgCgP	
 
 - - = = Yg~Qv(u7b
T^lzz	R_@b	g(u7bv  P r o f i l e   
N_ۏLCgPhg	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   L E N ( L T R I M ( R T R I M ( @ N a m e ) ) ) > 0 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 	 	 S E L E C T   T O P   1 
 
 	 	 	 [ N a m e ] , 
 
 	 	 	 [ P a s s w o r d ] , 
 
 	 	 	 I S N U L L ( F i r s t N a m e , N ' ' )   A S   F i r s t N a m e , 
 
 	 	 	 I S N U L L ( L a s t N a m e , N ' ' )   A S   L a s t N a m e , 
 
 	 	 	 I S N U L L ( T e l , N ' ' )   A S   T e l , 
 
 	 	 	 I S N U L L ( E m a i l , N ' ' )   A S   E m a i l , 
 
 	 	 	 I S N U L L ( M o b i l e , N ' ' )   A S   M o b i l e , 
 
 	 	 	 I S N U L L ( F a x , N ' ' )   A S   F a x , 
 
 	 	 	 I S N U L L ( M S N , N ' ' )   A S   M S N , 
 
 	 	 	 I S N U L L ( S k y p e , N ' ' )   A S   S k y p e , 
 
 	 	 	 I S N U L L ( T w i t t e r , N ' ' )   A S   T w i t t e r , 
 
 	 	 	 I S N U L L ( Q Q , N ' ' )   A S   Q Q , 
 
 	 	 	 I S N U L L ( A d d r e s s , N ' ' )   A S   A d d r e s s , 
 
 	 	 	 S e x , 
 
 	 	 	 I S N U L L ( O r g a n i z a t i o n , N ' ' )   A S   O r g a n i z a t i o n , 
 
 	 	 	 I S N U L L ( [ P o s i t i o n ] , N ' ' )   A S   [ P o s i t i o n ] , 
 
 	 	 	 I S N U L L ( R a n k , 1 0 0 0 0 0 0 )   A S   R a n k , 
 
 	 	 	 I S N U L L ( P o r t r a i t N a m e , N ' ' )   A S   P o r t r a i t N a m e , 
 
 	 	 	 I S N U L L ( R e m a r k , N ' ' )   A S   R e m a r k , 
 
 	 	 	 R e g i s t e r D a t e   A S   R e g i s t e r D a t e , 
 
 	 	 	 d b o . U D F _ U s e r R o l e J o i n ( [ N a m e ] )   A S   U s e r R o l e s , 
 
 	 	 	 - - I s C l i e n t   A S   I s C l i e n t , 	 / / C A N C E L 
 
 	 	 	 d b o . U D F _ P u b l i c L o g i n O n l i n e ( [ N a m e ] )   A S   O n l i n e 
 
 
 
 	 	 F R O M   d b o . U s e r s 
 
 
 
 	 	 W H E R E   [ N a m e ] = @ N a m e 
 
 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 E N D 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 	 	 S E L E C T   D I S T I N C T 
 
 	 	 	 [ N a m e ] , 
 
 	 	 	 [ P a s s w o r d ] , 
 
 	 	 	 I S N U L L ( F i r s t N a m e , N ' ' )   A S   F i r s t N a m e , 
 
 	 	 	 I S N U L L ( L a s t N a m e , N ' ' )   A S   L a s t N a m e , 
 
 	 	 	 I S N U L L ( T e l , N ' ' )   A S   T e l , 
 
 	 	 	 I S N U L L ( E m a i l , N ' ' )   A S   E m a i l , 
 
 	 	 	 I S N U L L ( M o b i l e , N ' ' )   A S   M o b i l e , 
 
 	 	 	 I S N U L L ( F a x , N ' ' )   A S   F a x , 
 
 	 	 	 I S N U L L ( M S N , N ' ' )   A S   M S N , 
 
 	 	 	 I S N U L L ( S k y p e , N ' ' )   A S   S k y p e , 
 
 	 	 	 I S N U L L ( T w i t t e r , N ' ' )   A S   T w i t t e r , 
 
 	 	 	 I S N U L L ( Q Q , N ' ' )   A S   Q Q , 
 
 	 	 	 I S N U L L ( A d d r e s s , N ' ' )   A S   A d d r e s s , 
 
 	 	 	 S e x , 
 
 	 	 	 I S N U L L ( O r g a n i z a t i o n , N ' ' )   A S   O r g a n i z a t i o n , 
 
 	 	 	 I S N U L L ( [ P o s i t i o n ] , N ' ' )   A S   [ P o s i t i o n ] , 
 
 	 	 	 I S N U L L ( R a n k , 1 0 0 0 0 0 0 )   A S   R a n k , 
 
 	 	 	 I S N U L L ( P o r t r a i t N a m e , N ' ' )   A S   P o r t r a i t N a m e , 
 
 	 	 	 I S N U L L ( R e m a r k , N ' ' )   A S   R e m a r k , 
 
 	 	 	 R e g i s t e r D a t e   A S   R e g i s t e r D a t e , 
 
 	 	 	 d b o . U D F _ U s e r R o l e J o i n ( [ N a m e ] )   A S   U s e r R o l e s , 
 
 	 	 	 - - I s C l i e n t   A S   I s C l i e n t , 	 / / C A N C E L 
 
 	 	 	 d b o . U D F _ P u b l i c L o g i n O n l i n e ( [ N a m e ] )   A S   O n l i n e 
 
 
 
 	 	 F R O M   d b o . U s e r s 
 
 
 
 	 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 E N D 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r A c c o u n t S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r A c c o u n t S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r A c c o u n t S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r A c c o u n t S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[(u7b&S
 
 - - = = HQhgS_MR(u7b/f&T]~X[(WYgX[(WRHQ RdQR^  L o g i n ,   U s e r 
 
 - - = = \R^(u7bvDeQeQ  U s e r s   h
 
 - - = = Yg  @ S i l e n t = 1   h:ysS\ۏLv/fte*Npenc^b`
Y ͑e^zte*N(u7b|~ُy`b_NbNO(uv/f  B u i l t I n C o n n e c t i o n S t r i n g   -Nv(u7b&SbN
N hgُ*N(u7bvCgP  ( C A N C E L ) 
 
 - - = = (W[Y!j_  O v e r W r i t e   [I{N  1   1\/fmR(u7b
NS/f[Y!j_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r A c c o u n t S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - (u7b
T
 
 @ P a s s w o r d   n v a r c h a r ( 2 0 ) , 	 	 	 	 - - [xSeS(ueg.^R$Re[x/f&T:NzzV:NsSOzz[xubv  @ E n c r y p t e d P a s s w o r d   ^_N'YN0     	   g'Y^  2 0 	
 
 @ E n c r y p t e d P a s s w o r d   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - [xvR[b__ُ*N[x\OX[(W  U s e r s   h(W  L o g i n   veP\(uegT{vU_[x[gq   g'Y^  2 0 0 	
 
 @ I g n o r e P a s s w o r d   i n t , 	 	 	 	 	 - - (WO9e!j_bNO(uN N*N  c h e c k b o x JTɋ|~_eu[x	gePv^
N`9e[x	1 / 2 	
 
 @ F i r s t N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - Y
 
 @ L a s t N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - 
T
 
 @ T e l   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - 5u݋
 
 @ E m a i l   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - 5uP[N
 
 @ M o b i l e   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - yR5u݋
 
 @ F a x   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - -  Ow
 
 @ M S N   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - M S N 
 
 @ S k y p e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - S k y p e 
 
 @ T w i t t e r   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - T w i t t e r 
 
 @ Q Q   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - Q Q 
 
 @ A d d r e s s   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 - - A d d r e s s 
 
 @ S e x   i n t , 	 	 	 	 	 	 - - '`+R
 
 @ O r g a n i z a t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 - - ~T
 
 @ P o s i t i o n   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - LMO
 
 @ R a n k   i n t , 	 	 	 	 	 	 - - I{~
 
 @ P o r t r a i t N a m e   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 	 - - 4YP;_  / W r i t a b l e / U s e r A c c o u n t P o r t r a i t / < G U I D > / P o r t r a i t N a m e 	
 
 @ R e m a r k   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 	 - - Yl
 
 @ U s e r G r o u p s   n v a r c h a r ( 4 0 0 0 ) , 	 	 	 	 - - (u7b@b^\~Rh  la(WOX[~bXTvePbNlbeO(uRhW[&{2NV:N N*N~Qv(u7b/}wegSǏ4 0 0 0 W[&{ N*N(u7b@b^\~/}weg
N*YSǏ4 0 0 0 W[&{	
 
 @ U s e r R o l e s   n v a r c h a r ( 4 0 0 0 ) , 	 	 	 	 - - 1 , 2 ,   . . .   <h_
 
 
 
 @ O v e r W r i t e   I N T 	 	 	 	 	 - - I{N  1     v݋R(u7bX[(W1\v(uNO9er`	  I{N  0   v݋Yg(u7bX[(W>N(uNmRr`	
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 
 
 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' `vCgP
NAQۏL^SO9eTR^d\O0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spenm
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ N a m e = L T R I M ( R T R I M ( @ N a m e ) ) 
 
 S E T   @ P a s s w o r d = L T R I M ( R T R I M ( @ P a s s w o r d ) ) 
 
 S E T   @ E n c r y p t e d P a s s w o r d = L T R I M ( R T R I M ( @ E n c r y p t e d P a s s w o r d ) ) 
 
 S E T   @ U s e r R o l e s = L T R I M ( R T R I M ( @ U s e r R o l e s ) ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spehg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( ( @ N a m e = N ' ' )   O R   ( @ N a m e   I S   N U L L )   O R   ( @ P a s s w o r d = N ' ' )   O R   ( @ P a s s w o r d   I S   N U L L )   O R   ( @ E n c r y p t e d P a s s w o r d = N ' ' )   O R   ( @ E n c r y p t e d P a s s w o r d   I S   N U L L )   O R   ( @ U s e r R o l e s = N ' ' )   O R   ( @ U s e r R o l e s   I S   N U L L ) )   A N D   @ I g n o r e P a s s w o r d < > 1 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' (u7b
T[x
N:NzzTe(u7b^\	g N*N҉r0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg(u7b]~X[(WNS_MR/fmR!j_@ O v e r W r i t e = 0 	R>N
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( d b o . U D F _ P u b l i c P r o f i l e E x i s t s ( @ N a m e ) = 1 )   A N D   ( @ O v e r W r i t e = 0 ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' (u7b]~X[(W0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg_eu[x@ I g n o r e P a s s w o r d = 1 	RfNO9eLub̑v^l	g  P a s s w o r d    OǏegbN HQN  U s e r s   hS(u7bv  P a s s w o r d 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     @ I g n o r e P a s s w o r d = 1 
 
 B E G I N 
 
 	 S E L E C T   @ E n c r y p t e d P a s s w o r d = [ P a s s w o r d ]   F R O M   d b o . U s e r s   W H E R E   [ N a m e ] = @ N a m e 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ Rd(u7bNMR(W  U s e r s     h-Nv;X[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . U s e r s   W H E R E   [ N a m e ] = @ N a m e 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/fO9e!j_bNHQ\  U s e r F o r u m s   -N(u7bvX[(WU_ Rd  2 0 1 0 - 1 1 - 2 4 U s e r F o r u m s   :g6R]~\P(u	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 I F   @ O v e r W r i t e = 1 
 
 B E G I N 
 
 	 D E L E T E   F R O M   d b o . U s e r F o r u m s   W H E R E   [ U s e r ] = @ N a m e 
 
 E N D 
 
 * / 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = :NNQeQ  u s e r s   h(u7bv@b	g  I n s t a n c e s     b	g NvebNُ̑~ NX[S_MRe&TRT N  u s e r s   h-NT N(u7bv
NT  I n s t a n c e   vlQeS	gky~]+R[  U s e r A c c o u n t Q u e r y   	bQ͑
Yv  U s e r   U_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ R e g i s t e r D a t e   d a t e t i m e 
 
 S E T   @ R e g i s t e r D a t e = G E T D A T E ( ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ,g0WSϑ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ U s e r R o l e   I N T   	 	 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  N*N  C u r s o r   MS1u  d b o . U D F _ P u b l i c S p l i t (   @ U s e r R o l e s , ' , ' )   _Nh  U s e r R o l e   vW[&{2NUSCQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   C u r s o r U s e r R o l e   C U R S O R   F O R   S E L E C T   E l e m e n t   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ U s e r R o l e s , N ' , ' )   F O R   R E A D   O N L Y 
 
 O P E N   C u r s o r U s e r R o l e 
 
 
 
 F E T C H   N E X T   F R O M   C u r s o r U s e r R o l e   I N T O   @ U s e r R o l e 
 
 W H I L E   @ @ F E T C H _ S T A T U S = 0 
 
 B E G I N 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = OX[0R  U s e r s   h
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I N S E R T   I N T O   d b o . U s e r s   ( [ N a m e ] , [ P a s s w o r d ] , F i r s t N a m e , L a s t N a m e , T e l , E m a i l , M o b i l e , F a x , M S N , S k y p e , T w i t t e r , Q Q , A d d r e s s , S e x , O r g a n i z a t i o n , [ P o s i t i o n ] , R a n k , P o r t r a i t N a m e , R e m a r k , R e g i s t e r D a t e , U s e r R o l e )   v a l u e s   ( @ N a m e , @ E n c r y p t e d P a s s w o r d , @ F i r s t N a m e , @ L a s t N a m e , @ T e l , @ E m a i l , @ M o b i l e , @ F a x , @ M S N , @ S k y p e , @ T w i t t e r , @ Q Q , @ A d d r e s s , @ S e x , @ O r g a n i z a t i o n , @ P o s i t i o n , @ R a n k , @ P o r t r a i t N a m e , @ R e m a r k , @ R e g i s t e r D a t e , @ U s e r R o l e ) 
 
 	 F E T C H   N E X T   F R O M   C u r s o r U s e r R o l e   I N T O   @ U s e r R o l e 
 
 E N D 
 
 
 
 C L O S E   C u r s o r U s e r R o l e 
 
 D E A L L O C A T E   C u r s o r U s e r R o l e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  @ U s e r G r o u p s   -Nv(u7bRh㉐gbUS*N  U s e r G r o u p   OX[0R  U s e r G r o u p s S_6qHQN  U s e r G r o u p s   h\ǏSv(u7b@b^\~vU_ Rd	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . U s e r G r o u p s   W H E R E   [ U s e r ] = @ N a m e 
 
 I N S E R T   d b o . U s e r G r o u p s   ( U s e r G r o u p I D , [ U s e r ] )   S E L E C T   [ E l e m e n t ] , @ N a m e   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ U s e r G r o u p s , N ' , ' ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r A c c o u n t S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r A c c o u n t D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r A c c o u n t D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r A c c o u n t D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \penc^-Nvg*N(u7b Rd Rd	N*N[SO  l o g i n , u s e r , p r o f i l e 	
 
 - - = = 0RvHegS~[v(u7b
T(W  l o g i n , u s e r , p r o f i l e   -NNUO0WeQs\[Nndr^Qُ7hSNnd  o r p h a n   (u7b
 
 - - = = 
N Rd(W~(u7b
 
 - - = = 2 0 0 8 / 1 1 / 1 1   -   s(W
N_QtO  l o g i n ,   u s e r S Rd  p r o f i l e   sSS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r A c c o u n t D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 - - (u7b
TeQ	
 
 - - @ S i l e n t   I N T , 	 	 	 - - [Y!j_(u(Wpenc^b`
Y͑^te*N(u7b|~`b_ُebNO(u  B u i l t I n C o n n e c t i o n S t r i n g   &S^g~ǏCgPhg  @ S i l e n t = 0   hgCgP    @ S i l e n t = 1   ~ǏCgPhg	
 
 @ o S u c c e s s   I N T   O U T 	 	 - - Q/f&TbRV:N  S P   \  U s e r A c c o u n t S a v e   (ue Rd1Y%	cSt^S_zsS\Pbk(uSTbv@b	gNRFO[E
NS P   (uvS N*N  S P   ЏL1Y%v^
Nq_T  S P   v~~ۏLS	g9hncԏVvbRN&Th_:_L-Ne
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGPЏL/fbRv
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o S u c c e s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 
 
 
 
 B E G I N 
 
 	 S E T   @ o S u c c e s s = 0 
 
 	 R A I S E R R O R ( N ' `vCgP
NAQۏL^S Rdd\O0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgeQSpe
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ N a m e = R T R I M ( L T R I M ( @ N a m e ) ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7b
T
N:Nzz
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ N a m e = N ' ' )   O R   ( @ N a m e   I S   N U L L ) 
 
 	 
 
 B E G I N 
 
 	 S E T   @ o S u c c e s s = 0 
 
 	 R A I S E R R O R ( N ' ~[v(u7b
T
N:Nzz0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7b
NX[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ P u b l i c P r o f i l e E x i s t s ( @ N a m e ) = 0 
 
 
 
 B E G I N 
 
 	 S E T   @ o S u c c e s s = 0 
 	 R A I S E R R O R ( N ' (u7b  % s   
NX[(W0' , 1 6 , 1 , @ N a m e ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd(u7b(W  U s e r F o r u m s   -N[INvCgP  2 0 1 0 - 1 1 - 2 4 U s e r F o r u m s   :g6R]~\P(u	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 I F   @ N a m e   I N   ( S e l e c t   [ U s e r ]   F r o m   d b o . U s e r F o r u m s ) 
 
 
 
 B E G I N 
 
 	 D E L E T E   F R O M   d b o . U s e r F o r u m s   W H E R E   [ U s e r ] = @ N a m e 
 
 E N D 
 
 * / 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd(u7b(W  U s e r G r o u p s   -NvU_~bXT	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ N a m e   I N   ( S e l e c t   [ U s e r ]   F r o m   d b o . U s e r G r o u p s ) 
 
 
 
 B E G I N 
 
 	 D E L E T E   F R O M   d b o . U s e r G r o u p s   W H E R E   [ U s e r ] = @ N a m e 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd(u7bv  p r o f i l e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ N a m e   I N   ( S e l e c t   [ N a m e ]   F r o m   d b o . U s e r s ) 
 
 
 
 B E G I N 
 
 	 D E L E T E   F R O M   d b o . U s e r s   W H E R E   [ N a m e ] = @ N a m e 
 
 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 
 
 
 
 / * 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7b
N(W  s y s a d m i n   ُ*N  S e r v e r R o l e   R
NAQ~~ۏLS	g  s y s a d m i n   S e r v e r   R o l e   Nv(u7bMb	gCgPO9eR^ Rd(u7b0ُ*N`Q N,
NOSuV:NR^  A d m i n   (u7bvePOꁨR\KNReQ  s y s a d m i n   S e r v e r   R o l e 	
 
 - - = = (Wpenc^b`
Y`b_ ͑^te*N(u7b|~ُebNO(u  B u i l t I n C o n n e c t i o n S t r i n g   (u7bُ*N(u7b^\N  s y s a d m i n   CgP@bNNRhg
NOYxُy`b_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   I S _ S R V R O L E M E M B E R ( ' s y s a d m i n ' ) = 0 
 
 	 B E G I N 
 
 	 	 S E T   @ o S u c c e s s = 0 
 
 	 	 R A I S E R R O R ( N ' `vCgP
NЏLۏL^S Rdd\O0' , 1 6 , 1 ) 
 
 	 	 R E T U R N 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7b
T:Nzz
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ N a m e = N ' ' )   O R   ( @ N a m e   I S   N U L L ) 
 
 	 B E G I N 
 
 	 	 S E T   @ o S u c c e s s = 0 
 
 	 	 R A I S E R R O R ( N ' ~[v(u7b
T
N:Nzz0' , 1 6 , 1 ) 
 
 	 	 R E T U R N 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7b
NX[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( d b o . U D F _ P u b l i c L o g i n E x i s t s ( @ N a m e ) = 0 )   A N D   ( d b o . U D F _ P u b l i c U s e r E x i s t s ( @ N a m e ) = 0 )   A N D   ( d b o . U D F _ P u b l i c P r o f i l e E x i s t s ( @ N a m e ) = 0 ) 
 
 	 B E G I N 
 
 	 	 S E T   @ o S u c c e s s = 0 
 	 	 R A I S E R R O R ( N ' (u7b  % s   
NX[(W0' , 1 6 , 1 , @ N a m e ) 
 
 	 	 R E T U R N 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7b(W~  R  @ S i l e n t = 0 / 1   $Ny`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ P u b l i c L o g i n O n l i n e ( @ N a m e ) = 1 
 
 B E G I N 
 
 
 
 	 I F   @ S i l e n t = 0 
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = 8^ĉ  @ S i l e n t = 0   >N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 S E T   @ o S u c c e s s = 0 
 	 	 	 R A I S E R R O R ( N ' (u7b  % s   (W~vMR
N RdbO9e0' , 1 6 , 1 , @ N a m e ) 
 
 	 	 	 R E T U R N 
 
 	 	 E N D 
 
 	 E L S E 
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = (W  @ S i l e n t = 1   `b_  bNb`
Ypenc^ۏL(u7b|~͑^ [Y!j_Yg(u7b(W~"NNS1\/fN
 
 	 	 	 - - = = HQ~b0R(u7b@b	g  S P I D   \ُN  S P I D   *N@gc
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 D E C L A R E   @ S p i d   S M A L L I N T 
 
 
 
 	 	 	 D E C L A R E   S p i d C u r s o r   C U R S O R   F O R   S E L E C T   S P I D   F R O M   d b o . U D F _ P u b l i c L o g i n S p i d ( @ N a m e )   F O R   R E A D   O N L Y 
 
 	 	 	 O P E N   S p i d C u r s o r 
 
 	 	 	 F E T C H   N E X T   F R O M   S p i d C u r s o r   I N T O   @ S p i d 
 
 
 
 	 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 	 	 	 B E G I N 
 
 	 	 	 	 D E C L A R E   @ D y n S q l   n v a r c h a r ( 4 0 0 0 ) 
 
 	 	 	 	 S E T   @ D y n S q l = '   K I L L   ' +   c o n v e r t ( n v a r c h a r ( 2 0 ) , @ S p i d ) 
 
 	 	 	 	 E X E C U T E ( @ D y n S q l ) 
 
 	 	 	 	 F E T C H   N E X T   F R O M   S p i d C u r s o r   I N T O   @ S p i d 
 
 	 	 	 E N D 
 
 
 
 	 	 	 C L O S E   S p i d C u r s o r 
 
 	 	 	 D E A L L O C A T E   S p i d C u r s o r 
 
 	 	 E N D 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  _Y Rd(u7b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E L S E 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  Rd(u7b(W  U s e r F o r u m s   -N[INvCgP
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ N a m e   I N   ( S e l e c t   [ U s e r ]   F r o m   d b o . U s e r F o r u m s ) 
 
 	 	 B E G I N 
 
 	 	 	 D E L E T E   F R O M   d b o . U s e r F o r u m s   W H E R E   [ U s e r ] = @ N a m e 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  Rd(u7bv  p r o f i l e 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ N a m e   I N   ( S e l e c t   [ N a m e ]   F r o m   d b o . U s e r s ) 
 
 	 	 B E G I N 
 
 	 	 	 D E L E T E   F R O M   d b o . U s e r s   W H E R E   [ N a m e ] = @ N a m e 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = YgbR Rd(u7b  P r o f i l e   Rc@wdm(u7b[penc^vCg
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   ( @ @ E r r o r = 0 )   A N D   ( @ N a m e   N O T   I N   ( S e l e c t   [ N a m e ]   F r o m   d b o . U s e r s ) ) 
 
 	 	 B E G I N 
 
 	 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = O(u7b'N1Y,gpenc^vCg)R
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I F   d b o . U D F _ P u b l i c U s e r E x i s t s ( @ N a m e ) = 1 
 
 	 	 	 B E G I N     
 
 	 	 	 	 E X E C   s p _ r e v o k e d b a c c e s s   @ N a m e   
 
 	 	 	 E N D 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Yg   O(u7b'N1Y,gpenc^vCg)R   bRRc@w Rd(u7bv  l o g i n 
 
 	 	 	 - - = = laُ̑v  @ @ E r r o r   SsQNN
Nb*N  E X E C   SN  s p _ r e v o k e d b a c c e s s   /f&TbRgw  U D F _ P u b l i c U s e r E x i s t s ( ) 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I F   ( @ @ E r r o r = 0 )   A N D   ( d b o . U D F _ P u b l i c U s e r E x i s t s ( @ N a m e ) = 0 ) 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \(u7bNL o g i n -NSc
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   d b o . U D F _ P u b l i c L o g i n E x i s t s ( @ N a m e ) = 1 
 
 	 	 	 	 B E G I N     
 
 	 	 	 	 	 E X E C   m a s t e r . . s p _ d r o p l o g i n     @ N a m e 
 
 	 	 	 	 E N D 
 
 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = Yg   \(u7bNL o g i n -NSc   bR
 
 	 	 	 	 - - = = ُ̑v  @ @ E r r o r   /fsQNN
Nbv*N  E X E C   Sgw  s p _ d r o p l o g i n   /f&TgbLbR hg  U D F _ P u b l i c L o g i n E x i s t s ( ) 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   ( @ @ E r r o r = 0 )   A N D   ( d b o . U D F _ P u b l i c L o g i n E x i s t s ( @ N a m e ) = 0 ) 
 
 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg   \(u7bNL o g i n -NSc   bRRԏVbRh_
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 S E T   @ o S u c c e s s = 1 
 
 	 	 	 	 	 	 R E T U R N 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 	 E L S E   
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg   \(u7bNL o g i n -NSc   1Y%RԏV1Y%h_Te>N
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 S E T   @ o S u c c e s s = 0 
 
 	 	 	 	 	 	 R A I S E R R O R ( N ' (u7b  % s   elNpenc^|~-N Rd0' , 1 6 , 1 , @ N a m e ) 
 
 	 	 	 	 	 	 R E T U R N 
 
 	 	 	 	 	 E N D 
 
 	 	 	 E N D 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Yg   O(u7b'N1Y,gpenc^vCg)R   1Y%
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E T   @ o S u c c e s s = 0 
 
 	 	 	 	 R A I S E R R O R ( N ' (u7b  %   [S_MRpenc^vCgeldm0' , 1 6 , 1 , @ N a m e ) 
 
 	 	 	 	 R E T U R N 
 
 	 	 	 E N D 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg Rd(u7b  P r o f i l e 1Y%
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E L S E 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ o S u c c e s s = 0 
 
 	 	 	 R A I S E R R O R ( N ' (u7b  % s   v  P r o f i l e   U_el Rd  0' , 1 6 , 1 , @ N a m e ) 
 
 	 	 	 R E T U R N 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 
 
 * / 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r A c c o u n t D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c G e t C o m m u n i t y I D F r o m F o r u m I D         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c G e t C o m m u n i t y I D F r o m F o r u m I D ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c G e t C o m m u n i t y I D F r o m F o r u m I D ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u  U D F _ G e t C o m m u n i t y I D F r o m F o r u m I D   N  F o r u m I D   _    C o m m u n i t y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c G e t C o m m u n i t y I D F r o m F o r u m I D 
 
 
 
 @ F o r u m I D   i n t , 	 	 	 - - F o r u m   v  I D 
 
 @ C o m m u n i t y I D   i n t   O U T 	 	 - - ԏVSpe,   [^v  C o m m u n i t y   v  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ C o m m u n i t y I D = d b o . U D F _ G e t C o m m u n i t y I D F r o m F o r u m I D ( @ F o r u m I D ) 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c G e t C o m m u n i t y I D F r o m F o r u m I D ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r A c c o u n t Q u e r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r A c c o u n t Q u e r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r A c c o u n t Q u e r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ُ*N  S P   v\O(u9hncfYv~"}g(u7b&S  ( QNNeQv@b	g(u7b&SDeSN~TwegSNh"}) 
 
 - - = = Spe@b	gh"}~"}\O:NSpeYgSpe:NN U L L ,   Ry
NSNh"}
 
 - - = = ^zRu:g6RHQ\ck8^g~gX[eQ N*N~g N7hFOYN N*NP a g i n g I D vhSϑ	9hncP a g i n g I D @ P a g e S i z e @ C u r r e n t P a g e 	SS_MRuvU_v^\;`upe\O:N N*NRhMOQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 1 - 0 6 - 2 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r A c c o u n t Q u e r y 
 
 
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 - - &S
T
 
 @ F i r s t N a m e   n v a r c h a r ( 5 0 ) , 	 - - Y
 
 @ L a s t N a m e   n v a r c h a r ( 5 0 ) , 	 - - 
T
 
 @ T e l   n v a r c h a r ( 5 0 ) , 	 	 - - 5u݋
 
 @ E m a i l   n v a r c h a r ( 1 0 0 ) , 	 	 - - 5uP[N
 
 
 
 @ M o b i l e   n v a r c h a r ( 5 0 ) , 	 	 - - yR5u݋
 
 @ F a x   n v a r c h a r ( 5 0 ) , 	 	 - -  Ow
 
 @ M S N   n v a r c h a r ( 1 0 0 ) , 	 	 - - M S N 
 
 @ S k y p e   n v a r c h a r ( 1 0 0 ) , 	 	 - - S k y p e 
 
 @ T w i t t e r   n v a r c h a r ( 1 0 0 ) , 	 	 - - T w i t t e r 
 
 @ Q Q   n v a r c h a r ( 1 0 0 ) , 	 	 - - Q Q 
 
 @ A d d r e s s   n v a r c h a r ( 2 0 0 ) , 	 - - A d d r e s s 
 
 
 
 @ S e x   i n t , 	 	 	 - - '`+R
 
 @ O r g a n i z a t i o n   n v a r c h a r ( 2 0 0 ) , 	 - - ~T
 
 @ P o s i t i o n   n v a r c h a r ( 1 0 0 ) , 	 - - LMO
 
 @ R a n k   i n t , 	 	 	 - - I{~
 
 @ R e m a r k   n v a r c h a r ( 2 0 0 0 ) , 	 - - Yl
 
 
 
 @ R e g i s t e r D a t e Y e a r   I N T , 	 	 - - (u7blQt^N
 
 @ R e g i s t e r D a t e M o n t h   I N T , 	 - - (u7blQgN
 
 @ R e g i s t e r D a t e D a y   I N T , 	 	 - - (u7blQeP[
 
 
 
 @ U s e r R o l e   i n t , 	 	 	 - - (u7b҉r
 
 - - @ I s C l i e n t   i n t , 	 	 	 - - /f&T[7b  1 / 2 	  ( C A N C E L ) 
 
 
 
 @ P a g e S i z e   I N T , 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T , 	 	 - - ux:g6RS_MRu
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) 	 - - c^e_  A S C ,   D E S C 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spev8YtN(WX[(WR`Sv0WeO(u	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ N a m e = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ N a m e ) 
 
 S E T   @ F i r s t N a m e = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ F i r s t N a m e ) 
 
 S E T   @ L a s t N a m e = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ L a s t N a m e ) 
 
 S E T   @ T e l = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ T e l ) 
 
 S E T   @ E m a i l = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ E m a i l ) 
 
 
 
 S E T   @ M o b i l e = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ M o b i l e ) 
 
 S E T   @ F a x = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ F a x ) 
 
 S E T   @ M S N = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ M S N ) 
 
 S E T   @ S k y p e = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ S k y p e ) 
 
 S E T   @ T w i t t e r = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ T w i t t e r ) 
 
 S E T   @ Q Q = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ Q Q ) 
 
 S E T   @ A d d r e s s = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ A d d r e s s ) 
 
 
 
 S E T   @ O r g a n i z a t i o n = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ O r g a n i z a t i o n ) 
 
 S E T   @ P o s i t i o n = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ P o s i t i o n ) 
 
 S E T   @ R e m a r k = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ R e m a r k ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = CgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R`gS-NSQs  U n i c o d e   W[&{kYF i r s t N a m e = ' R' 	n v a r c h a r ( ) 
NǏ4 0 0 0 Nb$N*NR`S gT؏ޏc0R Nw@bN[IN:N  n v a r c h a r ( 4 0 0 0 ) 
 
 - - = = (uR`S Q L Seg[b~( laR
NS e t   N o c o u n t   o n   md[ g~QU_Ɩvq_T) 
 
 - - = = (uegg^W h e r e NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 )             
 
 D E C L A R E   @ D y n W h e r e   N V A R C H A R ( 4 0 0 0 )   
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^Ruh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = N '   S E T   N O C O U N T   O N       ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ P a g i n g   t a b l e   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ N a m e ]   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,     ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F i r s t N a m e   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,     ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L a s t N a m e   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e x   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T e l   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   E m a i l   v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 	 - - U D F _ P u b l i c L o g i n O n l i n e 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   M o b i l e   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F a x   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   M S N   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S k y p e   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T w i t t e r   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   Q Q   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A d d r e s s   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   O r g a n i z a t i o n   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ P o s i t i o n ]   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   R a n k   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   R e m a r k   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   R e g i s t e r D a t e   d a t e t i m e ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I s C l i e n t   I N T ,   ' 	 	 	 	 	 - - C A N C E L 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   O n L i n e   I N T   ' 	 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = kXEQRuh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   d i s t i n c t       '     
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . [ N a m e ]   a s   [ N a m e ] ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . F i r s t N a m e   a s   F i r s t N a m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . L a s t N a m e   a s   L a s t N a m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   s e x . N a m e C   a s   S e x ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . T e l   a s   T e l ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . E m a i l   a s   E m a i l ,   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . M o b i l e   a s   M o b i l e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . F a x   a s   F a x ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . M S N   a s   M S N ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . S k y p e   a s   S k y p e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . T w i t t e r   a s   T w i t t e r ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . Q Q   a s   Q Q ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . A d d r e s s   a s   A d d r e s s ,   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . O r g a n i z a t i o n   a s   O r g a n i z a t i o n ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . [ P o s i t i o n ]   a s   [ P o s i t i o n ] ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . R a n k   a s   R a n k ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . R e m a r k   a s   R e m a r k ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . R e g i s t e r D a t e   a s   R e g i s t e r D a t e ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u s . I s C l i e n t   a s   I s C l i e n t ,   ' 	 	 	 	 - - C A N C E L 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ P u b l i c L o g i n O n l i n e ( u s . [ N a m e ] )   a s   O n L i n e   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . U s e r s   u s   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   i n n e r   j o i n   d b o . S e x   s e x   o n   s e x . [ I D ] = u s . S e x   ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = W H E R E   1 = 1   ]Y0WMQNNbR`  W H E R E   NS-Nv   A N D    
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W H E R E   1 = 1   ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = vQ[R`  W H E R E   NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n W h e r e = N ' ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ N a m e   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ N a m e   I S   N O T   N U L L       
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ N a m e   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ N a m e = R T R I M ( L T R I M ( @ N a m e ) )   
 
 	 I F   @ N a m e < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ N a m e )   > = 1 
 
 	 	 B e g i n       s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . [ N a m e ] ) )   l i k e   ' ' '   +   R E P L A C E ( @ N a m e , N ' * ' , N ' % ' )   +   N ' ' ' '   E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n       s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . [ N a m e ] ) ) = ' ' '   +   @ N a m e   +   N ' ' ' '   E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ F i r s t N a m e   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ F i r s t N a m e   I S   N O T   N U L L   
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ F i r s t N a m e   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ F i r s t N a m e = R T R I M ( L T R I M ( @ F i r s t N a m e ) )     
 
 	 I F   @ F i r s t N a m e < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ F i r s t N a m e )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . F i r s t N a m e ) )   l i k e   ' ' '   +   R E P L A C E ( @ F i r s t N a m e , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . F i r s t N a m e ) ) = ' ' '   +   @ F i r s t N a m e   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ L a s t N a m e   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ L a s t N a m e   I S   N O T   N U L L   
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ L a s t N a m e   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ L a s t N a m e = R T R I M ( L T R I M ( @ L a s t N a m e ) )   
 
 	 I F   @ L a s t N a m e < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ L a s t N a m e )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . L a s t N a m e ) )   l i k e   ' ' '   +   R E P L A C E ( @ L a s t N a m e , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . L a s t N a m e ) ) = ' ' '   +   @ L a s t N a m e   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ T e l   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ T e l   I S   N O T   N U L L   
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ T e l   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ T e l = R T R I M ( L T R I M ( @ T e l ) )   
 
 	 I F   @ T e l < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ T e l )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . T e l ) )   l i k e   ' ' '   +   R E P L A C E ( @ T e l , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . T e l ) ) = ' ' '   +   @ T e l   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ E m a i l   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ E m a i l   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ E m a i l   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ E m a i l = R T R I M ( L T R I M ( @ E m a i l ) )   
 
 	 I F   @ E m a i l < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ E m a i l )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . E m a i l ) )   l i k e   ' ' '   +   R E P L A C E ( @ E m a i l , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . E m a i l ) ) = ' ' '   +   @ E m a i l   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ M o b i l e   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ M o b i l e   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ M o b i l e   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ M o b i l e = R T R I M ( L T R I M ( @ M o b i l e ) )   
 
 	 I F   @ M o b i l e < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ M o b i l e )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . M o b i l e ) )   l i k e   ' ' '   +   R E P L A C E ( @ M o b i l e , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . M o b i l e ) ) = ' ' '   +   @ M o b i l e   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ F a x   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ F a x   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ F a x   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ F a x = R T R I M ( L T R I M ( @ F a x ) )   
 
 	 I F   @ F a x < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ F a x )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . F a x ) )   l i k e   ' ' '   +   R E P L A C E ( @ F a x , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . F a x ) ) = ' ' '   +   @ F a x   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ M S N   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ M S N   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ M S N   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ M S N = R T R I M ( L T R I M ( @ M S N ) )   
 
 	 I F   @ M S N < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ M S N )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . M S N ) )   l i k e   ' ' '   +   R E P L A C E ( @ M S N , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . M S N ) ) = ' ' '   +   @ M S N   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ S k y p e   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ S k y p e   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ S k y p e   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ S k y p e = R T R I M ( L T R I M ( @ S k y p e ) )   
 
 	 I F   @ S k y p e < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ S k y p e )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . S k y p e ) )   l i k e   ' ' '   +   R E P L A C E ( @ S k y p e , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . S k y p e ) ) = ' ' '   +   @ S k y p e   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ T w i t t e r   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ T w i t t e r   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ T w i t t e r   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ T w i t t e r = R T R I M ( L T R I M ( @ T w i t t e r ) )   
 
 	 I F   @ T w i t t e r < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ T w i t t e r )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . T w i t t e r ) )   l i k e   ' ' '   +   R E P L A C E ( @ T w i t t e r , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . T w i t t e r ) ) = ' ' '   +   @ T w i t t e r   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ Q Q   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ Q Q   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ Q Q   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ Q Q = R T R I M ( L T R I M ( @ Q Q ) )   
 
 	 I F   @ Q Q < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ Q Q )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . Q Q ) )   l i k e   ' ' '   +   R E P L A C E ( @ Q Q , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . Q Q ) ) = ' ' '   +   @ Q Q   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ A d d r e s s   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ A d d r e s s   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ A d d r e s s   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ A d d r e s s = R T R I M ( L T R I M ( @ A d d r e s s ) )   
 
 	 I F   @ A d d r e s s < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ A d d r e s s )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . A d d r e s s ) )   l i k e   ' ' '   +   R E P L A C E ( @ A d d r e s s , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . A d d r e s s ) ) = ' ' '   +   @ A d d r e s s   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ S e x   ~~"}I{N0 bN U L L h:y
NSN~P6R	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ S e x   I S   N O T   N U L L   A N D   @ S e x < > 0   
 
 B E G I N 
 
 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   u s . S e x = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ S e x ) 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ O r g a n i z a t i o n   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ O r g a n i z a t i o n   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ O r g a n i z a t i o n   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ O r g a n i z a t i o n = R T R I M ( L T R I M ( @ O r g a n i z a t i o n ) )   
 
 	 I F   @ O r g a n i z a t i o n < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ O r g a n i z a t i o n )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . O r g a n i z a t i o n ) )   l i k e   ' ' '   +   R E P L A C E ( @ O r g a n i z a t i o n , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . O r g a n i z a t i o n ) ) = ' ' '   +   @ O r g a n i z a t i o n   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ P o s i t i o n   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ P o s i t i o n   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ P o s i t i o n   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ P o s i t i o n = R T R I M ( L T R I M ( @ P o s i t i o n ) )   
 
 	 I F   @ P o s i t i o n < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ P o s i t i o n )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . [ P o s i t i o n ] ) )   l i k e   ' ' '   +   R E P L A C E ( @ P o s i t i o n , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . [ P o s i t i o n ] ) ) = ' ' '   +   @ P o s i t i o n   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ R a n k   ~~"}I{N0 bN U L L h:y
NSN~P6R	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ R a n k   I S   N O T   N U L L     A N D   @ R a n k < > 0   
 
 B E G I N 
 
 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   u s . R a n k = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ R a n k ) 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ R e m a r k   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ R e m a r k   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ R e m a r k   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ R e m a r k = R T R I M ( L T R I M ( @ R e m a r k ) )   
 
 	 I F   @ R e m a r k < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ R e m a r k )   > = 1 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . R e m a r k ) )   l i k e   ' ' '   +   R E P L A C E ( @ R e m a r k , N ' * ' , N ' % ' )   +   N ' ' ' '   	 E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u s . R e m a r k ) ) = ' ' '   +   @ R e m a r k   +   N ' ' ' ' 	 E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ R e g i s t e r D a t e ( Y / M / D ) ~~"}I{N0 bN U L L h:y
NSN~P6R	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ R e g i s t e r D a t e Y e a r   I S   N O T   N U L L   A N D   @ R e g i s t e r D a t e M o n t h   I S   N O T   N U L L   A N D   @ R e g i s t e r D a t e D a y   I S   N O T   N U L L     
 
 B E G I N 
 
 	 I f   @ R e g i s t e r D a t e Y e a r < > 0   B e g i n   s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   Y e a r ( u s . R e g i s t e r D a t e ) = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ R e g i s t e r D a t e Y e a r )   E n d 
 
 	 I f   @ R e g i s t e r D a t e M o n t h < > 0   B e g i n   s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   M o n t h ( u s . R e g i s t e r D a t e ) = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ R e g i s t e r D a t e M o n t h )   E n d 
 
 	 I f   @ R e g i s t e r D a t e D a y < > 0   B e g i n   s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   D a y ( u s . R e g i s t e r D a t e ) = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ R e g i s t e r D a t e D a y )   E n d 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ U s e r R o l e   ~~"}I{N0 bN U L L h:y
NSN~P6R	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ U s e r R o l e   I S   N O T   N U L L   A N D   @ U s e r R o l e < > 0   
 
 B E G I N 
 
 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   u s . U s e r R o l e = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ U s e r R o l e ) 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ I s C l i e n t   ~~"}I{N0 bN U L L h:y
NSN~P6R	
 
 - - = = 2 0 0 9 - 0 4 - 1 2   :   C A N C E L 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 I F   @ I s C l i e n t   I S   N O T   N U L L   A N D   @ I s C l i e n t < > 0   
 
 B E G I N 
 
 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   u s . I s C l i e n t = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ I s C l i e n t ) 
 
 E N D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = MRbv  S Q L   S gTR  vQ[R`  W H E R E   NS  @ D y n S Q L   -N]~S+T  W H E R E   1 = 1 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   @ D y n W h e r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R
N  O r d e r   B y   NS
 
 - - = = Yg  O r d e r B y = ' '   RO(u:w  o r d e r   b y   N a m e   A S C 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ O r d e r B y = L T R I M ( R T R I M ( @ O r d e r B y ) ) 
 
 S E T   @ O r d e r B y O r d e r = L T R I M ( R T R I M ( @ O r d e r B y O r d e r ) ) 
 
 
 
 I F   L E N ( @ O r d e r B y ) = 0   O R     L E N ( @ O r d e r B y O r d e r ) = 0 
 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ N a m e ]   A S C   ' 
 
 	 E N D 
 
 E L S E 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ '   +   @ O r d e r B y   +   N ' ]   '   +   @ O r d e r B y O r d e r 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e t   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   * , P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ P a g e S i z e )   +   N ' ) )   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ F i r s t R e c o r d )   +   N '   a n d   P a g i n g I D < '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgR`Sv^
NSNǏ|~
NP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s D y n S Q L   I N T 
 
 E X E C   d b o . P u b l i c D y n S Q L L e n g t h C h e c k   @ D y n S Q L , @ o P a s s D y n S Q L   O U T 
 
 I F   @ o P a s s D y n S Q L = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLR`  S Q L   S   _Y~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r A c c o u n t Q u e r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c F o l l o w U p S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c F o l l o w U p S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c F o l l o w U p S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v  T o p i c I D   	S  T o p i c   NSvQNv@b	g  F o l l o w U p   R+R(u  S P   T o p i c S e l e c t   T  S P   F o l l o w U p S e l e c t 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c F o l l o w U p S e l e c t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C u l t u r e   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MRy
 
 
 
 @ T o p i c I D   I N T 	 	 	 - - c[v  T o p i c   I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg]~Ɩb0R  T o p i c S e l e c t   T  F o l l o w U p S e l e c t   -NN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	S  T o p i c I D   @b[^v  F o r u m   -Nv  T o p i c C o m m a n d < x x x >   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   
 
 
 
 	 f u c . T o p i c C o m m a n d S e t E l i t e T o p i c   A S     T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 f u c . T o p i c C o m m a n d S e t T a b o o T o p i c   A S   T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 f u c . T o p i c C o m m a n d S e t S t i c k y T o p i c   A S   T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 
 
 F R O M   d b o . V i e w _ F o r u m U i C u s t o m i z a t i o n   f u c 
 
 
 
 W H E R E   f u c . F o r u m I D = d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( @ T o p i c I D )   A N D   f u c . C u l t u r e = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	S  T o p i c I D   Nv  T o p i c   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . T o p i c S e l e c t   @ U s e r , @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	S  T o p i c I D   Nv  F o l l o w U p   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . F o l l o w U p S e l e c t   @ U s e r , @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHh(W  @ T o p i c I D   NmRNߍ^	
 
 - - = = la_{hg  @ U s e r   /f&T:Nzzcd*g{vU_(u7b_NOmȉv`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ U s e r < > N ' ' )   A N D   ( @ U s e r   I S   N O T   N U L L ) 
 
 B E G I N 
 
 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   2 ,   @ T o p i c I D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c F o l l o w U p S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M o d e r a t o r L i s t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M o d e r a t o r L i s t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M o d e r a t o r L i s t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v  F o r u m I D   	SS_MR  F o r u m   vezRh
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = =   S P   N  T o p i c Q u e r y . c s . M o d e r a t o r L i s t ( )   (uFO勹elfe*g/T(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M o d e r a t o r L i s t 
 
 
 
 @ F o r u m I D   I N T 	 	 - - c[v  F o r u m   I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ_~[  F o r u m   v  M o d e r a t o r   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ M o d e r a t o r   N V A R C H A R ( 4 0 0 0 ) 
 
 S E L E C T   @ M o d e r a t o r = f p . M o d e r a t o r   F R O M   d b o . V i e w _ F o r u m P e r m i s s i o n   f p   W H E R E   f p . F o r u m I D = @ F o r u m I D 
 
 
 
 - - S E T   @ M o d e r a t o r = ( S e l e c t   T o p   1   M o d e r a t o r   F r o m   d b o . F o r u m   W h e r e   [ I D ] = @ F o r u m I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   D I S T I N C T 
 
 
 
 	 E l e m e n t   a s   [ N a m e ] 
 
 
 
 F R O M   d b o . U D F _ P u b l i c S p l i t ( @ M o d e r a t o r , N ' , ' ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M o d e r a t o r L i s t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c G e t T o p i c I D F r o m F o l l o w U p I D         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c G e t T o p i c I D F r o m F o l l o w U p I D ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c G e t T o p i c I D F r o m F o l l o w U p I D ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u  U D F _ G e t T o p i c I D F r o m F o l l o w U p I D   N  F o l l o w U p I D   _    T o p i c I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c G e t T o p i c I D F r o m F o l l o w U p I D 
 
 
 
 @ F o l l o w U p I D   i n t , 	 	 	 - - F o l l o w U p   v  I D 
 
 @ T o p i c I D   i n t   O U T 	 	 	 - - ԏVSpe,   [^v  T o p i c   v  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ T o p i c I D = d b o . U D F _ G e t T o p i c I D F r o m F o l l o w U p I D ( @ F o l l o w U p I D ) 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c G e t T o p i c I D F r o m F o l l o w U p I D ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e T r e e S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e T r e e S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e T r e e S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  V i e w _ K n o w l e d g e T r e e   -NShQbc[vU_
 
 - - = = YgSpe  K n o w l e d g e D i r e c t o r y   T  K n o w l e d g e I t e m   /f  N U L L RԏVhQ萰U_  &TRԏVc[vU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e T r e e S e l e c t 
 
 
 
 @ K n o w l e d g e D i r e c t o r y   N V A R C H A R ( 4 0 0 0 ) , 	 	 - - K n o w l e d g e   vU_Rh	
 
 @ K n o w l e d g e I t e m   I N T , 	 	 	 	 	 - - K n o w l e d g e   I D 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 	 - - c[eS
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg  @ K n o w l e d g e D i r e c t o r y   T  @ K n o w l e d g e I t e m   /f  N U L L 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ K n o w l e d g e D i r e c t o r y   I S   N U L L   A N D   @ K n o w l e d g e I t e m   I S   N U L L 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ԏVte*N  V i e w _ K n o w l e d g e T r e e 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 	 	 S E L E C T   *   F R O M   d b o . V i e w _ K n o w l e d g e T r e e   W H E R E   C u l t u r e = @ C u l t u r e   O R D E R   B Y   S e r i a l 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = Yg  @ K n o w l e d g e D i r e c t o r y   T  @ K n o w l e d g e I t e m   
N/f  N U L L 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F   @ K n o w l e d g e D i r e c t o r y   I S   N O T   N U L L   A N D   @ K n o w l e d g e I t e m   I S   N O T   N U L L 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ԏVc[v  @ K n o w l e d g e D i r e c t o r y   Nvc[  I t e m 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   *   F R O M   d b o . V i e w _ K n o w l e d g e T r e e   W H E R E   D i r e c t o r y   I N   ( S e l e c t   E l e m e n t   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ K n o w l e d g e D i r e c t o r y , N ' , ' ) )   A N D   [ I D ] = @ K n o w l e d g e I t e m   A N D   C u l t u r e = @ C u l t u r e   O R D E R   B Y   S e r i a l 
 
 	 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ԏVc[v  @ K n o w l e d g e D i r e c t o r y   Nv@b	g  I t e m 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   *   F R O M   d b o . V i e w _ K n o w l e d g e T r e e   W H E R E   D i r e c t o r y   I N   ( S e l e c t   E l e m e n t   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ K n o w l e d g e D i r e c t o r y , N ' , ' ) )   A N D   C u l t u r e = @ C u l t u r e   O R D E R   B Y   S e r i a l 
 
 	 	 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e T r e e S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e I t e m   ( P a g e D i r e c t o r y   I D )   _  P a g e D i r e c t o r y   h-Nvc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 0 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y S e l e c t 
 
 
 
 @ K n o w l e d g e I t e m   I N T 	 	 	 	 - - P a g e D i r e c t o r y   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 p d . [ I D ]   A S   [ I D ] , 
 
 	 p d . S u b D i r e c t o r y I D   A S   S u b D i r e c t o r y I D , 
 
 	 p d . S e r i a l   A S   S e r i a l , 
 
 	 p d . [ N a m e ]   A S   [ N a m e ] , 
 
 	 p d . P a g e S i z e   A S   P a g e S i z e , 
 
 	 I S N U L L ( p d . N e w W i n d o w , 0 )   A S   N e w W i n d o w , 
 
 	 I S N U L L ( p d . O v e r v i e w , 0 )   A S   O v e r v i e w , 
 
 	 I S N U L L ( p d . F a s t A c c e s s , 0 )   A S   F a s t A c c e s s , 
 
 	 I S N U L L ( p d . H o m e , 0 )   A S   H o m e , 
 
 
 
 	 I S N U L L ( p d . R i g h t I n d e n t , 0 )   A S   R i g h t I n d e n t , 
 
 
 
 	 I S N U L L ( p d . j Q u e r y , 0 )   A S   j Q u e r y , 
 
 
 
 	 I S N U L L ( p d . L o g o H i d e , 0 )   A S   L o g o H i d e , 
 
 	 I S N U L L ( p d . M a i n M e n u H i d e , 0 )   A S   M a i n M e n u H i d e , 
 
 	 I S N U L L ( p d . B a n n e r H i d e , 0 )   A S   B a n n e r H i d e , 
 
 	 I S N U L L ( p d . B r e a d c r u m b H i d e , 0 )   A S   B r e a d c r u m b H i d e , 
 
 	 I S N U L L ( p d . P a g e M e n u H i d e , 0 )   A S   P a g e M e n u H i d e , 
 
 	 I S N U L L ( p d . P a g e B a r H i d e , 0 )   A S   P a g e B a r H i d e , 
 
 	 I S N U L L ( p d . C o p y r i g h t H i d e , 0 )   A S   C o p y r i g h t H i d e , 
 
 
 
 	 p d . T y p e   A S   T y p e , 
 
 	 p d . P r e s e n t a t i o n   A S   P r e s e n t a t i o n , 
 
 	 p d . J u m p T o C o n t e n t   A S   J u m p T o C o n t e n t , 
 
 
 
 	 p d . S h o w T i t l e   A S   S h o w T i t l e , 
 
 	 p d . S h o w A u t h o r   A S   S h o w A u t h o r , 
 
 	 p d . S h o w U p d a t e T i m e   A S   S h o w U p d a t e T i m e , 
 
 	 p d . S h o w H i t C o u n t   A S   S h o w H i t C o u n t , 
 
 	 p d . S h o w C o m m e n t s   A S   S h o w C o m m e n t s , 
 
 	 p d . S h o w S t a t i c U r l   A S   S h o w S t a t i c U r l , 
 
 	 p d . S h o w K n o w l e d g e H t m l   A S   S h o w K n o w l e d g e H t m l , 
 
 	 p d . S h o w R e l a t i v e   A S   S h o w R e l a t i v e , 
 
 
 
 	 p d . E d i t o r   A S   E d i t o r , 
 
 	 p d . D e d i c a t e d T o   A S   D e d i c a t e d T o , 
 
 	 p d . C o m m e n t s P e r m i s s i o n   A S   C o m m e n t s P e r m i s s i o n 
 
 
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y   p d 
 
 
 
 W H E R E   p d . [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e I t e m   ( S u b D i r e c t o r y   I D )   _  S u b D i r e c t o r y   h-Nvc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 0 4   ,g!kO9e*gmSwQSONxvO9e	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y S e l e c t 
 
 
 
 @ K n o w l e d g e I t e m   I N T 	 	 	 	 - - S u b D i r e c t o r y   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 s d . [ I D ]   A S   [ I D ] , 
 
 	 s d . M a i n D i r e c t o r y I D   A S   M a i n D i r e c t o r y I D , 
 
 	 s d . S e r i a l   A S   S e r i a l , 
 
 	 s d . [ N a m e ]   A S   [ N a m e ] , 
 
 	 d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' S u b D i r e c t o r y ' , s d . [ I D ] )   A S   O v e r v i e w P a g e D i r e c t o r y I t e m , 
 
 	 d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y N a m e ( N ' S u b D i r e c t o r y ' , s d . [ I D ] )   A S   O v e r v i e w P a g e D i r e c t o r y N a m e , 
 
 	 I S N U L L ( s d . N e w W i n d o w , 0 )   A S   N e w W i n d o w , 
 
 	 I S N U L L ( s d . O v e r v i e w , 0 )   A S   O v e r v i e w , 
 
 	 I S N U L L ( s d . W i z a r d , 0 )   A S   W i z a r d , 
 
 
 
 	 s d . E d i t o r   A S   E d i t o r , 
 
 	 s d . D e d i c a t e d T o   A S   D e d i c a t e d T o , 
 
 	 s d . C o m m e n t s P e r m i s s i o n   A S   C o m m e n t s P e r m i s s i o n 
 
 
 
 F R O M   d b o . S u b D i r e c t o r y   s d 
 
 
 
 W H E R E   s d . [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M a i n D i r e c t o r y S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M a i n D i r e c t o r y S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M a i n D i r e c t o r y S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e I t e m   ( M a i n D i r e c t o r y   I D )   _  M a i n D i r e c t o r y   h-Nvc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 0 4   ,g!kO9e*gmSwQSONxvO9e	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M a i n D i r e c t o r y S e l e c t 
 
 
 
 @ K n o w l e d g e I t e m   I N T 	 	 	 	 - - M a i n D i r e c t o r y   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 m d . [ I D ]   A S   [ I D ] , 
 
 	 m d . S e r i a l   A S   S e r i a l , 
 
 	 m d . [ N a m e ]   A S   [ N a m e ] , 
 
 	 d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' M a i n D i r e c t o r y ' , m d . [ I D ] )   A S   O v e r v i e w P a g e D i r e c t o r y I t e m , 
 
 	 d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y N a m e ( N ' M a i n D i r e c t o r y ' , m d . [ I D ] )   A S   O v e r v i e w P a g e D i r e c t o r y N a m e , 
 
 	 I S N U L L ( m d . N e w W i n d o w , 0 )   A S   N e w W i n d o w , 
 
 	 I S N U L L ( m d . [ S y s t e m ] , 0 )   A S   [ S y s t e m ] , 
 
 	 m d . I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 m d . A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 m d . B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 m d . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 	 m d . E d i t o r   A S   E d i t o r , 
 
 	 m d . D e d i c a t e d T o   A S   D e d i c a t e d T o , 
 
 	 m d . C o m m e n t s P e r m i s s i o n   A S   C o m m e n t s P e r m i s s i o n 
 
 
 
 F R O M   d b o . M a i n D i r e c t o r y   m d 
 
 
 
 W H E R E   m d . [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M a i n D i r e c t o r y S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . A d m i n U s e r A u t h e n t i c a t i o n         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ A d m i n U s e r A u t h e n t i c a t i o n ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ A d m i n U s e r A u t h e n t i c a t i o n ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b/f&TSN[  K n o w l e d g e   T  L e v e l 	ۏLOX[O9e
 
 - - = = h  U s e r s   -Nv(u7b҉rYg
N/f  A d m i n   R
NۏLOX[O9e
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . A d m i n U s e r A u t h e n t i c a t i o n 
 
 
 
 @ U s e r   N V A R C H A R ( 5 0 ) , 	 	 - - Spec[(u7b
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 / * 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 4NeSϑ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r r e n t U s e r   N V A R C H A R ( 5 0 ) 
 
 S E T   @ C u r r e n t U s e r = d b o . U D F _ U s e r C u r r e n t ( ) 
 
 * / 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7b
N/f|~{tXT( 
N/fMON  A d m i n   ҉r) R>Nv^ Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' _bIk`
N/fQz{tXT
NAQۏLd\O0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ A d m i n U s e r A u t h e n t i c a t i o n ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  K n o w l e d g e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 2 - 3 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y I D   i n t , 	 	 	 - - S_MR  K n o w l e d g e   [^v  P a g e D i r e c t o r y   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 - - S_MR  K n o w l e d g e   v^RSkag  K n o w l e d g e   v>f:y!k^1u  S e r i a l   Q[^RS\HQ>f:y	
 
 @ U p d a t e T i m e   d a t e t i m e , 	 	 	 - - S_MR  K n o w l e d g e   vS^eAQ(u7bLte	
 
 @ E d i t o r   n t e x t , 	 	 	 	 - - S_MR  K n o w l e d g e   vCgP  Yg:NzzW[&{b  N U L L RS	g  A d m i n ,   C h i e f E d i t o r ,   NSS_MR  K n o w l e d g e   ~bv
N~  D i r e c t o r y   vMbSNYgeQwQSO
TW[RُNSN	
 
 @ D e d i c a t e d T o   n t e x t , 	 	 	 - - uCgPRM~TN(u7b  Yg/fzzW[&{b  N U L L RNUONSNYg/f  " * "   RS	g[7bMbSN  Yg/f   a b c , e f g , . . .  Rc[(u7bSN	
 
 @ C o m m e n t s P e r m i s s i o n   n t e x t , 	 	 - - u/f&TAQċ  YgzzW[&{b  N U L L RNUONSNċYg/f  " * "   RNUO[7bSNċ  Yg/f   a b c , e f g , . . .    R~[[7bSNċYg/f  " n o n e "   RNUON
NQċ	
 
 
 
 @ K n o w l e d g e T y p e   i n t , 	 	 	 - - S_MRQ[{|WO r d i n a r y C o n t e n t ,   M u l t i M e d i a ,   M a p ,   F r e e C o d e 	
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' P a g e D i r e c t o r y ' , @ P a g e D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z     
 
     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = S_MR(u7bS_MRe    
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - D E C L A R E   @ C u r r e n t T i m e   n v a r c h a r ( 5 0 )     
 
 D E C L A R E   @ C u r r e n t U s e r   n v a r c h a r ( 5 0 )     
 
   
 
 - - S E T   @ C u r r e n t T i m e = G E T D A T E ( )     
 
 S E T   @ C u r r e n t U s e r = @ U s e r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  K n o w l e d g e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . K n o w l e d g e ( P a g e D i r e c t o r y I D , S e r i a l , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n , U p d a t e T i m e , A u t h o r , K n o w l e d g e T y p e )   V A L U E S ( @ P a g e D i r e c t o r y I D , @ S e r i a l , @ E d i t o r , @ D e d i c a t e d T o , @ C o m m e n t s P e r m i s s i o n , @ U p d a t e T i m e , @ C u r r e n t U s e r , @ K n o w l e d g e T y p e ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhmRN  K n o w l e d g e C o n t e n t   -     K n o w l e d g e C o n t e n t I D   =   @ o N e w I D 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   6 ,   @ o N e w I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  K n o w l e d g e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 2 - 3 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e I D   i n t , 	 	 	 - - S_MR  K n o w l e d g e   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 - - S_MR  K n o w l e d g e   v^RSkag  K n o w l e d g e   v>f:y!k^1u  S e r i a l   Q[^RS\HQ>f:y	
 
 @ U p d a t e T i m e   d a t e t i m e , 	 	 	 - - S_MR  K n o w l e d g e   vS^eAQ(u7bLte	
 
 @ E d i t o r   n t e x t , 	 	 	 	 - - S_MR  K n o w l e d g e     vCgP  Yg/fzzW[&{b  N U L L RS	g  A d m i n ,   C h i e f E d i t o r ,   S_MR  K n o w l e d g e     ~bv
N~vU_v	gCgPYgeQNwQSO
TSNY*N	RُN	gCgP	
 
 @ D e d i c a t e d T o   n t e x t , 	 	 	 - - uCgPRM~TN(u7b  Yg/fzzW[&{b  N U L L RNUONSNYg/f  " * "   RS	g[7bMbSN  Yg/f   a b c , e f g , . . .  Rc[(u7bSN	
 
 @ C o m m e n t s P e r m i s s i o n   n t e x t 	 	 - - u/f&TAQċ  Yg/fzzW[&{b  N U L L RNUONSNċYg/f  " * " RNUO[7bSNċ  Yg/f  " a b c , e f g , . . . " Rc[[7bSNċYg/f  " n o n e "   RNUON
NSċ	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' K n o w l e d g e ' , @ K n o w l e d g e I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  K n o w l e d g e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . K n o w l e d g e   S E T   
 
 
 
 	 S e r i a l = @ S e r i a l , 
 
 	 U p d a t e T i m e = @ U p d a t e T i m e , 
 
 	 E d i t o r = @ E d i t o r , 
 
 	 D e d i c a t e d T o = @ D e d i c a t e d T o , 
 
 	 C o m m e n t s P e r m i s s i o n = @ C o m m e n t s P e r m i s s i o n 
 
 
 
 W H E R E   [ I D ] = @ K n o w l e d g e I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhmRN  K n o w l e d g e C o n t e n t   -     K n o w l e d g e C o n t e n t I D   =   @ o N e w I D 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 3 ,   @ K n o w l e d g e I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  P a g e D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 2 - 3 1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S u b D i r e c t o r y I D   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   [^v  S u b D i r e c t o r y   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   v^RSkag  K n o w l e d g e   v>f:y!k^1u  S e r i a l   Q[^RS\HQ>f:y	
 
 @ N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v
TW[
 
 @ P a g e S i z e   i n t , 	 	 	 	 - - S_MRu(WRu:g6R-NvRu'Y\
 
 @ N e w W i n d o w   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  N e w W i n d o w   F l a g 
 
 @ O v e r v i e w   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   /f&TS_MRyb  P a g e D i r e c t o r i e s   vi
 
 @ F a s t A c c e s s   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  F a s t A c c e s s   F l a g 
 
 @ H o m e   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  H o m e   F l a g 
 
 
 
 @ R i g h t I n d e n t   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  R i g h t I n d e n t 
 
 
 
 @ j Q u e r y   b i t , 	 	 	 	 - - /f&TR}  j Q u e r y   ^
 
 
 
 @ L o g o H i d e   b i t , 	 	 	 	 - - /f&Tυ  L o g o   :S  	 	 	 	 
 
 @ M a i n M e n u H i d e   b i t , 	 	 	 - - /f&Tυ;N܃USag  
 
 @ B a n n e r H i d e   b i t , 	 	 	 - - /f&Tυ  B a n n e r   
 
 @ B r e a d c r u m b H i d e   b i t , 	 	 	 - - /f&TυbSQ\
 
 @ P a g e M e n u H i d e   b i t , 	 	 	 - - /f&TυS_MRubv  P a g e   M e n u   Oag   N,(WuǏُ*Nib'Yuv[E]\Oby	
 
 @ P a g e B a r H i d e   b i t , 	 	 	 - - /f&Tυ  P a g e B a r   
 
 @ C o p y r i g h t H i d e   b i t , 	 	 	 - - /f&TυHrCgT|:S
 
 
 
 @ T y p e   i n t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   NvwƋv{|W  1   -   nfwƋ            2   -   WNevwƋ            3   -   R+R{|vwƋ	
 
 @ P r e s e n t a t i o n   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   NvwƋvU\:ye_  1   -   ck8^>f:y          2   -   >f:yh  pQۏeQwQSOQ[	          3   -   >f:yXd  pQۏeQ~Q[		
 
 @ J u m p T o C o n t e n t   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   u(W>f:yveP/f&Tvc0RQ[  # B o o k m a r k 
 
 
 
 @ S h o w T i t l e   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w T i t l e   F l a g 
 
 @ S h o w A u t h o r   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w A u t h o r   F l a g 
 
 @ S h o w U p d a t e T i m e   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w U p d a t e T i m e   F l a g 
 
 @ S h o w H i t C o u n t   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w H i t C o u n t   F l a g 
 
 @ S h o w C o m m e n t s   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w C o m m e n t s   F l a g 
 
 @ S h o w S t a t i c U r l   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w S t a t i c U r l   F l a g 
 
 @ S h o w K n o w l e d g e H t m l   b i t , 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w K n o w l e d g e H t m l   F l a g 
 
 @ S h o w R e l a t i v e   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w R e l a t i v e   F l a g 
 
 
 
 @ E d i t o r   n t e x t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   vCgP  eQzzW[&{b  N U L L RS	g  A d m i n   T  C h i e f E d i t o r NS,gN~bv
N~  D i r e c t o r y     v  SNYgeQNwQSO
TSNY*N	Rc[SN	
 
 @ D e d i c a t e d T o   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   vCgP  Yg:NzzW[&{b  N U L L RNNSYg/fc[(u7bT~Rc[(u7bTc[~Nv(u7bS	
 
 @ C o m m e n t s P e r m i s s i o n   n t e x t , 	 	 - - S_MR  P a g e D i r e c t o r y   vċCgP  Yg/fzzW[&{b  N U L L RNNSċYg/fc[(u7bT~Rc[(u7bT~Nv(u7bSċ	
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg vQ
N~CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg  @ N a m e   Speww/f
N/f]~(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' uvU_v
TW[  % s   ]`S(u' , 1 6 , 1 , @ N a m e ) 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (WmR  P a g e D i r e c t o r y   U_KNMRHQww,gU_v  @ H o m e   ^\'`/f
N/f:N  " t r u e " Yg/fR\penc^-NvQN:N   t r u e    vU_9e:N  ' f a l s e '   V:NS	g N*N  t r u e 1\/f|~-NTeS	g N*Nu/f  H o m e   P a g e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ H o m e = 1 
 
 B E G I N 
 
 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   H o m e = 0   W H E R E   H o m e = 1 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  P a g e D i r e c t o r y   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . P a g e D i r e c t o r y ( S u b D i r e c t o r y I D , S e r i a l , [ N a m e ] , P a g e S i z e , N e w W i n d o w , O v e r v i e w , F a s t A c c e s s , H o m e , R i g h t I n d e n t , j Q u e r y , L o g o H i d e , M a i n M e n u H i d e , B a n n e r H i d e , B r e a d c r u m b H i d e , P a g e M e n u H i d e , P a g e B a r H i d e , C o p y r i g h t H i d e , T y p e , P r e s e n t a t i o n , J u m p T o C o n t e n t , S h o w T i t l e , S h o w A u t h o r , S h o w U p d a t e T i m e , S h o w H i t C o u n t , S h o w C o m m e n t s , S h o w S t a t i c U r l , S h o w K n o w l e d g e H t m l , S h o w R e l a t i v e , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n )   V A L U E S ( @ S u b D i r e c t o r y I D , @ S e r i a l , @ N a m e , @ P a g e S i z e , @ N e w W i n d o w , @ O v e r v i e w , @ F a s t A c c e s s , @ H o m e , @ R i g h t I n d e n t , @ j Q u e r y , @ L o g o H i d e , @ M a i n M e n u H i d e , @ B a n n e r H i d e , @ B r e a d c r u m b H i d e , @ P a g e M e n u H i d e , @ P a g e B a r H i d e , @ C o p y r i g h t H i d e , @ T y p e , @ P r e s e n t a t i o n , @ J u m p T o C o n t e n t , @ S h o w T i t l e , @ S h o w A u t h o r , @ S h o w U p d a t e T i m e , @ S h o w H i t C o u n t , @ S h o w C o m m e n t s , @ S h o w S t a t i c U r l , @ S h o w K n o w l e d g e H t m l , @ S h o w R e l a t i v e , @ E d i t o r , @ D e d i c a t e d T o , @ C o m m e n t s P e r m i s s i o n ) 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  @ O v e r v i e w   Spe:N  t r u e R(u  S P   P a g e D i r e c t o r y S e t O v e r v i e w   \S_MR  P a g e D i r e c t o r y   n:N  O v e r v i e w   r`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ O v e r v i e w = 1 
 
 
 
 B E G I N 
 
 	 E X E C   d b o . P a g e D i r e c t o r y S e t O v e r v i e w   @ U s e r , @ o N e w I D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  P a g e D i r e c t o r y   cOv  S e r i a l   \NI{N  O v e r v i e w   yvv  S e r i a l RꁨR\  O v e r v i e w   yvv  S e r i a l   n:NkS_MR  S e r i a l   \  1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   A n d   O v e r v i e w = 1 ) 
 
 B E G I N 
 
 	 D E C L A R E   @ O v e r v i e w I D   I N T ,   @ O v e r v i e w S e r i a l   I N T 
 
 	 S E L E C T   @ O v e r v i e w I D = [ I D ] ,   @ O v e r v i e w S e r i a l = S e r i a l   F R O M   d b o . P a g e D i r e c t o r y   W h e r e   S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   A n d   O v e r v i e w = 1 
 
 
 
 	 I F   ( @ S e r i a l < = @ O v e r v i e w S e r i a l ) 
 
 	 B E G I N 
 
 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = @ S e r i a l - 1   W H E R E   [ I D ] = @ O v e r v i e w I D 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhmRNuvU_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   5 ,   @ o N e w I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  P a g e D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 2 - 3 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y I D   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   v^RSkag  K n o w l e d g e   v>f:y!k^1u  S e r i a l   Q[^RS\HQ>f:y	
 
 @ N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v
TW[
 
 @ P a g e S i z e   i n t , 	 	 	 	 - - S_MRu(Wux:g6R-NRu'Y\
 
 @ N e w W i n d o w   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  N e w W i n d o w   F l a g 
 
 @ O v e r v i e w   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   /f&T,gyb  P a g e D i r e c t o r i e s   vi
 
 @ F a s t A c c e s s   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  F a s t A c c e s s   F l a g 
 
 @ H o m e   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  H o m e   F l a g 
 
 
 
 @ R i g h t I n d e n t   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  R i g h t I n d e n t 
 
 
 
 @ j Q u e r y   b i t , 	 	 	 	 - - /f&TR}  j Q u e r y   ^
 
 
 
 @ L o g o H i d e   b i t , 	 	 	 	 - - /f&Tυ  L o g o   :S  	 	 	 	 
 
 @ M a i n M e n u H i d e   b i t , 	 	 	 - - /f&Tυ;N܃USag  
 
 @ B a n n e r H i d e   b i t , 	 	 	 - - /f&Tυ  B a n n e r   
 
 @ B r e a d c r u m b H i d e   b i t , 	 	 	 - - /f&TυbSQ\
 
 @ P a g e M e n u H i d e   b i t , 	 	 	 - - /f&TυS_MRubv  P a g e   M e n u   Oag   N,(WuǏُ*Nib'Yuv[E]\Oby	
 
 @ P a g e B a r H i d e   b i t , 	 	 	 - - /f&Tυ  P a g e B a r   
 
 @ C o p y r i g h t H i d e   b i t , 	 	 	 - - /f&TυHrCgT|:S
 
 
 
 @ T y p e   i n t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   NbwƋv  {|W1   -   nfwƋ          2   -   WNevwƋZS[e	        3   -   R+R{|wƋ/ghF A Q bX		
 
 @ P r e s e n t a t i o n   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   NbvwƋvU\:ye_  1   -   ck8^U\:y          2   -   >f:yh  pQۏeQwQSOQ[	        3   -   >f:yXd  YZS[Q[>f:yXdpQۏeQwQSOQ[		
 
 @ J u m p T o C o n t e n t   b i t , 	 	 	 - - S_MRuۏeQT/f&Tvcl0RQ[  # B o o k m a r k 
 
 
 
 @ S h o w T i t l e   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w T i t l e   F l a g 
 
 @ S h o w A u t h o r   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w A u t h o r   F l a g 
 
 @ S h o w U p d a t e T i m e   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w U p d a t e T i m e   F l a g 
 
 @ S h o w H i t C o u n t   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w H i t C o u n t   F l a g 
 
 @ S h o w C o m m e n t s   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w C o m m e n t s   F l a g 
 
 @ S h o w S t a t i c U r l   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w S t a t i c U r l   F l a g 
 
 @ S h o w K n o w l e d g e H t m l   b i t , 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w K n o w l e d g e H t m l   F l a g 
 
 @ S h o w R e l a t i v e   b i t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  S h o w R e l a t i v e   F l a g 
 
 
 
 @ E d i t o r   n t e x t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   vCgP  YgeQzzW[&{b  N U L L RS	g  A d m i n ,   C h i e f E d i t o r ,   NS,gN~bv
N~  D i r e c t o r y   v  E d i t o r   SNNYgeQNwQSOv
TW[SNY*N	Rc[SN	
 
 @ D e d i c a t e d T o   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   vCgP  Yg:NzzW[&{b  N U L L RNNSYg/fc[(u7bT~Rc[(u7bTc[~Nv(u7bS	
 
 @ C o m m e n t s P e r m i s s i o n   n t e x t 	 	 - - S_MR  P a g e D i r e c t o r y   vċCgP  Yg/fzzW[&{b  N U L L RNNSċYg/fc[(u7bT~Rc[(u7bT~Nv(u7bSċ	
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' P a g e D i r e c t o r y ' , @ P a g e D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg  @ N a m e   Speww/f
N/f]~(u  FOcd](uv`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e   A N D   [ I D ] < > @ P a g e D i r e c t o r y I D ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' uvU_v
TW[  % s   ]`S(u' , 1 6 , 1 , @ N a m e ) 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (WO9e  P a g e D i r e c t o r y   U_KNMRHQww,gU_v  @ H o m e   ^\'`/f
N/f:N  " t r u e " Yg/fR\penc^-NvQN:N   t r u e    vU_9e:N  ' f a l s e '   V:NS	g N*N  t r u e 1\/f|~-NTeS	g N*Nu/f  H o m e   P a g e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ H o m e = 1 
 
 B E G I N 
 
 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   H o m e = 0   W H E R E   H o m e = 1 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  P a g e D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . P a g e D i r e c t o r y   S E T 
 
 
 
 	 S e r i a l = @ S e r i a l , 
 
 	 [ N a m e ] = @ N a m e , 
 
 	 P a g e S i z e = @ P a g e S i z e , 
 
 	 N e w W i n d o w = @ N e w W i n d o w , 
 
 	 O v e r v i e w = @ O v e r v i e w , 
 
 	 F a s t A c c e s s = @ F a s t A c c e s s , 
 
 	 H o m e = @ H o m e , 
 
 
 
 	 R i g h t I n d e n t = @ R i g h t I n d e n t , 
 
 
 
 	 j Q u e r y = @ j Q u e r y , 
 
 
 
 	 L o g o H i d e = @ L o g o H i d e ,   
 
 	 M a i n M e n u H i d e = @ M a i n M e n u H i d e , 
 
 	 B a n n e r H i d e = @ B a n n e r H i d e , 
 
 	 B r e a d c r u m b H i d e = @ B r e a d c r u m b H i d e , 
 
 	 P a g e M e n u H i d e = @ P a g e M e n u H i d e , 
 
 	 P a g e B a r H i d e = @ P a g e B a r H i d e , 
 
 	 C o p y r i g h t H i d e = @ C o p y r i g h t H i d e , 
 
 
 
 	 T y p e = @ T y p e , 
 
 	 P r e s e n t a t i o n = @ P r e s e n t a t i o n , 
 
 	 J u m p T o C o n t e n t = @ J u m p T o C o n t e n t , 
 
 
 
 	 S h o w T i t l e = @ S h o w T i t l e , 
 
 	 S h o w A u t h o r = @ S h o w A u t h o r , 
 
 	 S h o w U p d a t e T i m e = @ S h o w U p d a t e T i m e , 
 
 
 	 S h o w H i t C o u n t = @ S h o w H i t C o u n t , 
 
 	 S h o w C o m m e n t s = @ S h o w C o m m e n t s , 
 
 	 S h o w S t a t i c U r l = @ S h o w S t a t i c U r l , 
 
 	 S h o w K n o w l e d g e H t m l = @ S h o w K n o w l e d g e H t m l , 
 
 	 S h o w R e l a t i v e = @ S h o w R e l a t i v e , 
 
 
 
 	 E d i t o r = @ E d i t o r , 
 
 	 D e d i c a t e d T o = @ D e d i c a t e d T o , 
 
 	 C o m m e n t s P e r m i s s i o n = @ C o m m e n t s P e r m i s s i o n 
 
 
 
 W H E R E   [ I D ] = @ P a g e D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg  @ O v e r v i e w   Spe:N   t r u e  R\,g  P a g e D i r e c t o r y   v@b	gDQ_  P a g e D i r e c t o r y   ͑ecN  2    _Y gT\S_MR  P a g e D i r e c t o r y   v  S e r i a l   n:N  1 ُ7h1\[sN\  O v e r v i e w =  t r u e    v  P a g e D i r e c t o r y   nvvv
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ O v e r v i e w = 1 
 
 
 
 B E G I N 
 
 	 E X E C   d b o . P a g e D i r e c t o r y S e t O v e r v i e w   @ U s e r , @ P a g e D i r e c t o r y I D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  P a g e D i r e c t o r y   cOv  S e r i a l   \NI{N  O v e r v i e w   yvv  S e r i a l RꁨR\  O v e r v i e w   yvv  S e r i a l   n:NkS_MR  S e r i a l   \  1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ S u b D i r e c t o r y I D   I N T 
 
 S E L E C T   @ S u b D i r e c t o r y I D = S u b D i r e c t o r y I D   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ I D ] = @ P a g e D i r e c t o r y I D 
 
 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   A n d   O v e r v i e w = 1 ) 
 
 B E G I N 
 
 	 D E C L A R E   @ O v e r v i e w I D   I N T ,   @ O v e r v i e w S e r i a l   I N T 
 
 	 S E L E C T   @ O v e r v i e w I D = [ I D ] ,   @ O v e r v i e w S e r i a l = S e r i a l   F R O M   d b o . P a g e D i r e c t o r y   W h e r e   S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   A n d   O v e r v i e w = 1 
 
 
 
 	 I F   ( @ S e r i a l < = @ O v e r v i e w S e r i a l ) 
 
 	 B E G I N 
 
 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = @ S e r i a l - 1   W H E R E   [ I D ] = @ O v e r v i e w I D 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9eNuvU_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 2 ,   @ P a g e D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y S a v e ] 
 
 G O 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  S u b D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ M a i n D i r e c t o r y I D   i n t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   [^v  M a i n D i r e c t o r y   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 	 - - S_MR  S u b D i r e c t o r y   v^RSkag  K n o w l e d g e   v>f:y!k^1u  S e r i a l   Q[^RS\HQ>f:y	
 
 @ N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   v
TW[
 
 @ O v e r v i e w P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 - - S_MR  S u b D i r e c t o r y   v  O v e r v i e w P a g e D i r e c t o r y   v
TW[
 
 @ N e w W i n d o w   b i t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   v  N e w W i n d o w   F l a g 
 
 @ O v e r v i e w   b i t , 	 	 	 	 	 - - S_MR  S u b D i r e c t o r y   /f&T,gyb  S u b D i r e c t o r i e s   vi
 
 @ W i z a r d   b i t , 	 	 	 	 	 - - S_MR  S u b D i r e c t o r y   Nv  P a g e D i r e c t o r y   /f&TNT[b__Q
 
 
 
 @ E d i t o r   n t e x t , 	 	 	 	 	 - - S_MR  S u b D i r e c t o r y   vCgPYgeQzzW[&{b  N U L L RS	g    A d m i n ,   C h i e f E d i t o r   NS,gN~bv
N~vU_vSNYgwQSOeQv
TW[SNY*N	RُNc[v_NSN	
 
 @ D e d i c a t e d T o   n t e x t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   vCgP  Yg:NzzW[&{b  N U L L RNNSYg/fc[(u7bT~Rc[(u7bTc[~Nv(u7bS	
 
 @ C o m m e n t s P e r m i s s i o n   n t e x t , 	 	 	 - - S_MR  S u b D i r e c t o r y   vċCgP  Yg/fzzW[&{b  N U L L RNNSċYg/fc[(u7bT~Rc[(u7bT~Nv(u7bSċ	
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg       M a i n D i r e c t o r y   CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' M a i n D i r e c t o r y ' , @ M a i n D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg  @ N a m e   Speww/f
N/f]~(u  1uNOX[  S u b D i r e c t o r y   vePTeOub N*N  O v e r v i e w   P a g e D i r e c t o r y O~bُ*N  @ N a m e   \O:NNv
TW[VdkbN NhQ  S u b D i r e c t o r y ,   P a g e D i r e c t o r y   -Nhg/f&T͑
T	
 
 - - = = :g6Rf/T(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 I F     ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e ) )   O R     ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e ) ) 
 
 * / 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg  N a m e   /f&T  ]`S(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' P[vU_v
TW[  % s   ]`S(u' , 1 6 , 1 , @ N a m e ) 
 
 E N D 
 
 
 
 I F     E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ O v e r v i e w P a g e D i r e c t o r y N a m e ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' Q[uvU_v
TW[  % s   ]`S(u' , 1 6 , 1 , @ O v e r v i e w P a g e D i r e c t o r y N a m e ) 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  S u b D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . S u b D i r e c t o r y ( M a i n D i r e c t o r y I D , S e r i a l , [ N a m e ] , N e w W i n d o w , O v e r v i e w , W i z a r d , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n )   V A L U E S ( @ M a i n D i r e c t o r y I D , @ S e r i a l , @ N a m e , @ N e w W i n d o w , @ O v e r v i e w , @ W i z a r d , @ E d i t o r , @ D e d i c a t e d T o , @ C o m m e n t s P e r m i s s i o n ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg  @ O v e r v i e w   Spe:N  1 R\,g  S u b D i r e c t o r y   v@b	gDQ_  S u b D i r e c t o r y   ͑ecN  2    _Y gT\S_MR  S u b D i r e c t o r y   v  S e r i a l   n:N  1 ُ7h1\[sN\  O v e r v i e w =  t r u e    v  S u b D i r e c t o r y   nvvv
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ O v e r v i e w = 1 
 
 
 
 B E G I N 
 
 	 E X E C   d b o . S u b D i r e c t o r y S e t O v e r v i e w   @ U s e r , @ o N e w I D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = NbꁨRR^  O v e r v i e w   P a g e D i r e c t o r y ,   P a g e D i r e c t o r y C o n t e n t   ve  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o O v e r v i e w P a g e D i r e c t o r y N e w I D   I N T 
 
 D E C L A R E   @ o O v e r v i e w P a g e D i r e c t o r y C o n t e n t N e w I D   I N T 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (WeR^v  S u b D i r e c t o r y   U_NbꁨRR^  O v e r v i e w   P a g e D i r e c t o r y   NS[v  C o n t e n t 	
 
 - - = = l(WgbLNbv  S P   vePS u b D i r e c t o r y C o n t e n t S a v e   ؏l	geg_SgbLVdk(W  S P   S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y C o n t e n t   -N@bv~b  S u b D i r e c t o r y C o n t e n t   -Nv  T i t l e   *N  D e s c r i p t i o n   vQ[~b0Rv/fzz<PbN؏(W  S u b D i r e c t o r y C o n t e n t S a v e   -Nfnx0W\  T i t l e   T  D e s c r i p t i o n   <P O~vQ  O v e r v i e w   P a g e D i r e c t o r y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 E X E C   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y   @ U s e r ,   @ o N e w I D ,   @ O v e r v i e w P a g e D i r e c t o r y N a m e ,   @ o O v e r v i e w P a g e D i r e c t o r y N e w I D   O U T 
 
 E X E C   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y C o n t e n t   @ U s e r ,   @ o O v e r v i e w P a g e D i r e c t o r y N e w I D ,   @ o O v e r v i e w P a g e D i r e c t o r y C o n t e n t N e w I D   O U T 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  S u b D i r e c t o r y   cOv  S e r i a l   \NI{N  O v e r v i e w   yvv  S e r i a l RꁨR\  O v e r v i e w   yvv  S e r i a l   n:NkS_MR  S e r i a l   \  1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   A n d   O v e r v i e w = 1 ) 
 
 B E G I N 
 
 	 D E C L A R E   @ O v e r v i e w I D   I N T ,   @ O v e r v i e w S e r i a l   I N T 
 
 	 S E L E C T   @ O v e r v i e w I D = [ I D ] ,   @ O v e r v i e w S e r i a l = S e r i a l   F R O M   d b o . S u b D i r e c t o r y   W h e r e   M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   A n d   O v e r v i e w = 1 
 
 
 
 	 I F   ( @ S e r i a l < = @ O v e r v i e w S e r i a l ) 
 
 	 B E G I N 
 
 	 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = @ S e r i a l - 1   W H E R E   [ I D ] = @ O v e r v i e w I D 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhmRP[vU_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   4 ,   @ o N e w I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  S u b D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 1 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S u b D i r e c t o r y I D   i n t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 	 - - S_MR  S u b D i r e c t o r y   v^RSkag  K n o w l e d g e   v>f:y!k^1u  S e r i a l   Q[^RS\HQ>f:y	
 
 @ N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   v
TW[
 
 @ O v e r v i e w P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 - - v^\Q[u
TW[  N  S u b D i r e c t o r y   U I   s:W Oeg	
 
 @ N e w W i n d o w   b i t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   v  N e w W i n d o w   F l a g 
 
 @ O v e r v i e w   b i t , 	 	 	 	 	 - - S_MR  S u b D i r e c t o r y   /f&T,gyb  S u b D i r e c t o r i e s   vi
 
 @ W i z a r d   b i t , 	 	 	 	 	 - - S_MR  S u b D i r e c t o r y   Nv  P a g e D i r c e t o r y   Q[/f&TNT[vb__Q
 
 
 
 @ E d i t o r   n t e x t , 	 	 	 	 	 - - S_MR  S u b D i r e c t o r y   vCgPYgeQzzW[&{b  N U L L RS	g  A d m i n   T  C h i e f E d i t o r NS,gN~bv
N~vU_vSNYgeQwQSO
TW[SNY*N	RُNSN	
 
 @ D e d i c a t e d T o   n t e x t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   vCgP  Yg:NzzW[&{b  N U L L RNNSYg/fc[(u7bT~Rc[(u7bTc[~Nv(u7bS	
 
 @ C o m m e n t s P e r m i s s i o n   n t e x t 	 	 	 - - S_MR  S u b D i r e c t o r y   vċCgP  Yg/fzzW[&{b  N U L L RNNSċYg/fc[(u7bT~Rc[(u7bT~Nv(u7bSċ	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = SS_MR  S u b D i r e c t o r y   v  O v e r v i e w   P a g e D i r e c t o r y   v  I D 
 
 - - = = :g6Rf/T(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 D E C L A R E   @ O v e r v i e w P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg  @ N a m e   Speww/f
N/f]~(u  FOcd](uv`b_	b
0^0]v  O v e r v i e w   P a g e D i r e c t o r y   `S(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e   A n d   [ I D ] < > @ S u b D i r e c t o r y I D ) )   O R   ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e   A n d   [ I D ] < > @ O v e r v i e w P a g e D i r e c t o r y I D ) ) 
 
 * / 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg  N a m e   /   O v e r v i e w P a g e D i r e c t o r y N a m e   /f&T]`S(u  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e   A n d   [ I D ] < > @ S u b D i r e c t o r y I D ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' P[vU_v
TW[  % s   ]`S(u' , 1 6 , 1 , @ N a m e ) 
 
 E N D 
 
 
 
 D E C L A R E   @ O v e r v i e w P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D ) 
 
 
 
 I F     E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ O v e r v i e w P a g e D i r e c t o r y N a m e   A n d   [ I D ] < > @ O v e r v i e w P a g e D i r e c t o r y I D ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' P[vU_vv^\Q[u
TW[  % s   ]`S(u' , 1 6 , 1 , @ O v e r v i e w P a g e D i r e c t o r y N a m e ) 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  S u b D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . S u b D i r e c t o r y   S E T 
 
 
 
 	 S e r i a l = @ S e r i a l , 
 
 	 [ N a m e ] = @ N a m e , 
 
 	 N e w W i n d o w = @ N e w W i n d o w , 
 
 	 O v e r v i e w = @ O v e r v i e w , 
 
 	 W i z a r d = @ W i z a r d , 
 
 	 E d i t o r = @ E d i t o r , 
 
 	 D e d i c a t e d T o = @ D e d i c a t e d T o , 
 
 	 C o m m e n t s P e r m i s s i o n = @ C o m m e n t s P e r m i s s i o n 
 
 
 
 
 
 W H E R E   [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9evQ  O v e r v i e w   P a g e D i r e c t o r y   v  N a m e   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   [ N a m e ] = @ O v e r v i e w P a g e D i r e c t o r y N a m e   W H E R E   [ I D ] = @ O v e r v i e w P a g e D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9evQ  O v e r v i e w   P a g e D i r e c t o r y   v  N e w W i n d o w   S u b D i r e c t o r y   T  vQ  O v e r v i e w   P a g e D i r e c t o r y   v  N e w W i n d o w   ^Oc N	<ONN
N/f^8^_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 D E C L A R E   @ O v e r v i e w P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D ) 
 
 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   [ N e w W i n d o w ] = @ N e w W i n d o w   W H E R E   [ I D ] = @ O v e r v i e w P a g e D i r e c t o r y I D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9evQ  O v e r v i e w   P a g e D i r e c t o r y   v  N a m e   S u b D i r e c t o r y   T  vQ  O v e r v i e w   P a g e D i r e c t o r y   v  N a m e   ^Oc N	
 
 - - = = ُ/f
NNv  P r o p a g a n d a 
 
 - - = = :g6Rf/T(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   [ N a m e ] = @ N a m e   W H E R E   [ I D ] = @ O v e r v i e w P a g e D i r e c t o r y I D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg  @ O v e r v i e w   Spe:N  1 R\,g  S u b D i r e c t o r y   v@b	gDQ_  S u b D i r e c t o r y   ͑ecN  2    _Y gT\S_MR  S u b D i r e c t o r y   v  S e r i a l   n:N  1 ُ7h1\[sN\  O v e r v i e w =  t r u e    v  S u b D i r e c t o r y   nvvv
 
 - - = = SY hgS_MR  S u b D i r e c t o r y   Nv  P a g e D i r e c t o r y   pev/f&T  > 1 Yg/f>NV:N\O:Ni  S u b D i r e c t o r y ,   vQN^\v  P a g e D i r e c t o r y   peS:N  1   *N
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ O v e r v i e w = 1 
 
 
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = _S_MR  S u b D i r e c t o r y   Nv  P a g e D i r e c t o r y   pevY  > 1   R>N
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E C L A R E   @ C o u n t   I N T 
 
 	 S E L E C T   @ C o u n t = C O U N T ( p d . [ I D ] )   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D 
 
 
 
 	 I F   @ C o u n t > 1 
 
 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   O v e r v i e w = 0     W H E R E   [ I D ] = @ S u b D i r e c t o r y I D 
 
 	 	 	 R A I S E R R O R ( N ' `S_MRP[vU_NvuvU_peϑYYO1 *NYg``\S_MRP[vU_n:NvQ
N~;NvU_viQ[RP[vU_N^\vuvU_pev
N^勅Ǐ1 *N0V:N:Niv+TIN:NS_MRP[vU_Nv,{1 *NuvU_NvQ[\vc>f:y(WP[vU_v
N~;NvU_N0' , 1 6 , 1 ) 
 
 	 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 	 B E G I N 	 
 
 	 	 	 E X E C   d b o . S u b D i r e c t o r y S e t O v e r v i e w   @ U s e r , @ S u b D i r e c t o r y I D 
 
 	 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  S u b D i r e c t o r y   cOv  S e r i a l   \NI{N  O v e r v i e w   yvv  S e r i a l RꁨR\  O v e r v i e w   yvv  S e r i a l   n:NkS_MR  S e r i a l   \  1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ M a i n D i r e c t o r y I D   I N T 
 
 S E L E C T   @ M a i n D i r e c t o r y I D = M a i n D i r e c t o r y I D   F R O M   d b o . S u b D i r e c t o r y   W H E R E   [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   A n d   O v e r v i e w = 1 ) 
 
 B E G I N 
 
 	 D E C L A R E   @ O v e r v i e w I D   I N T ,   @ O v e r v i e w S e r i a l   I N T 
 
 	 S E L E C T   @ O v e r v i e w I D = [ I D ] ,   @ O v e r v i e w S e r i a l = S e r i a l   F R O M   d b o . S u b D i r e c t o r y   W h e r e   M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   A n d   O v e r v i e w = 1 
 
 
 
 	 I F   ( @ S e r i a l < = @ O v e r v i e w S e r i a l ) 
 
 	 B E G I N 
 
 	 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = @ S e r i a l - 1   W H E R E   [ I D ] = @ O v e r v i e w I D 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9eNP[vU_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 1 ,   @ S u b D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M a i n D i r e c t o r y S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M a i n D i r e c t o r y S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M a i n D i r e c t o r y S a v e ] 
 
 G O 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  M a i n D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M a i n D i r e c t o r y S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v^RSkag  K n o w l e d g e   v>f:y!k^1u  S e r i a l   Q[^RS\HQ>f:y	
 
 @ N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v
TW[
 
 @ O v e r v i e w P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 - - Q[u
TW[  N  M a i n D i r e c t o r y   U I   s:W Oeg	
 
 @ N e w W i n d o w   b i t , 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  N e w W i n d o w   F l a g 
 
 @ S y s t e m   b i t , 	 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  S y s t e m   F l a g 
 
 @ I n A c t i v e M a i n M e n u I c o n M a p   n t e x t , 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  I n A c t i v e M a i n M e n u I c o n M a p 
 
 @ A c t i v e M a i n M e n u I c o n M a p   n t e x t , 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  A c t i v e M a i n M e n u I c o n M a p 
 
 @ B a n n e r M a p   n t e x t , 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  B a n n e r M a p 
 
 @ B a n n e r C o n t e n t L a y e r   n t e x t , 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  B a n n e r C o n t e n t L a y e r 
 
 
 
 @ E d i t o r   n t e x t , 	 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   vCgP  Yg:NzzW[&{b  N U L L RS	g  A d m i n   T  C h i e f E d i t o r   SNYgeQNwQSOv
TW[SNY*N	Rc[SN	
 
 @ D e d i c a t e d T o   n t e x t , 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   vCgP  Yg:NzzW[&{b  N U L L RNNSYg/fc[(u7bT~Rc[(u7bTc[~Nv(u7bS	
 
 @ C o m m e n t s P e r m i s s i o n   n t e x t , 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   vċCgP  Yg/fzzW[&{b  N U L L RNNSċYg/fc[(u7bT~Rc[(u7bT~Nv(u7bSċ	
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  ُ̑   A d m i n   b    C h i e f E d i t o r   CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg  @ N a m e   Speww/f
N/f]~(u  1uNOX[  M a i n D i r e c t o r y   vePTeOub N*N  O v e r v i e w   S u b D i r e c t o r y ~ub N*N  O v e r v i e w   P a g e D i r e c t o r y T$N*NO~bُ*N  @ N a m e   \O:NNNv
TW[VdkbN NhQ  M a i n D i r e c t o r y ,   S u b D i r e c t o r y ,   P a g e D i r e c t o r y   -Nhg/f&T͑
T	
 
 - - = = :g6Rf/T(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - I F   ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e ) )   O R     ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e ) )   O R     ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e ) ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg  M a i n D i r e c t o r y   v
TW[/f&T]`S(u
 
 - - = = hg  O v e r v i e w P a g e D i r e c t o r y   v
TW[/f&T]`S(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' ;NvU_v
TW[  % s   ]`S(u' , 1 6 , 1 , @ N a m e ) 
 
 E N D 
 
 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ O v e r v i e w P a g e D i r e c t o r y N a m e ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' Q[uvU_v
TW[  % s   ]`S(u' , 1 6 , 1 , @ O v e r v i e w P a g e D i r e c t o r y N a m e ) 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (WO9e  M a i n D i r e c t o r y   U_KNMRHQww,gU_v  @ S y s t e m   ^\'`/f
N/f:N  " t r u e " Yg/fR\penc^-NvQN:N   t r u e    vU_9e:N  ' f a l s e '   V:NS	g N*N  t r u e 1\/f|~-NTeS	g N*N;N܃US/f  S y s t e m   M e n u 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ S y s t e m = 1 
 
 B E G I N 
 
 	 U P D A T E   d b o . M a i n D i r e c t o r y   S E T   [ S y s t e m ] = 0   W H E R E   [ S y s t e m ] = 1 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  M a i n D i r e c t o r y   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . M a i n D i r e c t o r y ( S e r i a l , [ N a m e ] , N e w W i n d o w , [ S y s t e m ] , I n A c t i v e M a i n M e n u I c o n M a p , A c t i v e M a i n M e n u I c o n M a p , B a n n e r M a p , B a n n e r C o n t e n t L a y e r , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n )   V A L U E S ( @ S e r i a l , @ N a m e , @ N e w W i n d o w , @ S y s t e m , @ I n A c t i v e M a i n M e n u I c o n M a p , @ A c t i v e M a i n M e n u I c o n M a p , @ B a n n e r M a p , @ B a n n e r C o n t e n t L a y e r , @ E d i t o r , @ D e d i c a t e d T o , @ C o m m e n t s P e r m i s s i o n ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = NbꁨRR^  O v e r v i e w   S u b D i r e c t o r y ,   S u b D i r e c t o r y C o n t e n t     l  O v e r v i e w   P a g e D i r e c t o r y ,   P a g e D i r e c t o r y C o n t e n t     vR^O(W  S P   M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y   -NǏ(u  S u b D i r e c t o r y S a v e   [s	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o O v e r v i e w S u b D i r e c t o r y N e w I D   I N T 
 
 D E C L A R E   @ o O v e r v i e w S u b D i r e c t o r y C o n t e n t N e w I D   I N T 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (WeR^v  M a i n D i r e c t o r y   U_NbꁨRR^  O v e r v i e w   S u b D i r e c t o r y   NS[v  C o n t e n t 	
 
 - - = = lN[
N(WgbLNbNxvePS P   M a i n D i r e c t o r y C o n t e n t S a v e   ؏l	g _YgbLVdkNbv  S P   M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y C o n t e n t   -N@b~b  M a i n D i r e c t o r y C o n t e n t   v  T i t l e   T  D e s c r i p t i o n ~b0RvvQ[/f  N U L L   bzz<PVdk(W  S P   M a i n D i r e c t o r y C o n t e n t S a v e   bN؏fnx0W:NvQ  O v e r v i e w S u b D i r e c t o r y C o n t e n t    O  T i t l e ,   D e s c r i p t i o n   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y   @ U s e r ,   @ o N e w I D ,   @ O v e r v i e w P a g e D i r e c t o r y N a m e ,   @ o O v e r v i e w S u b D i r e c t o r y N e w I D   O U T 
 
 E X E C   d b o . M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y C o n t e n t   @ U s e r ,   @ o O v e r v i e w S u b D i r e c t o r y N e w I D ,   @ o O v e r v i e w S u b D i r e c t o r y C o n t e n t N e w I D   O U T 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhmRN;NvU_  @ o N e w I D 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   3 ,   @ o N e w I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M a i n D i r e c t o r y S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M a i n D i r e c t o r y M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M a i n D i r e c t o r y M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M a i n D i r e c t o r y M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  M a i n D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 1 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M a i n D i r e c t o r y M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ M a i n D i r e c t o r y I D   i n t , 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v^RSkag  K n o w l e d g e   v>f:y!k^1u  S e r i a l   Q[^RS\HQ>f:y	
 
 @ N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v
TW[
 
 @ O v e r v i e w P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 - - v^\Q[u
TW[  N  M a i n D i r e c t o r y   U I   s:W Oeg	
 
 @ N e w W i n d o w   b i t , 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  N e w W i n d o w   F l a g 
 
 @ S y s t e m   b i t , 	 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  S y s t e m   F l a g 
 
 @ I n A c t i v e M a i n M e n u I c o n M a p   n t e x t , 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  I n A c t i v e M a i n M e n u I c o n M a p 
 
 @ A c t i v e M a i n M e n u I c o n M a p   n t e x t , 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  A c t i v e M a i n M e n u I c o n M a p 
 
 @ B a n n e r M a p   n t e x t , 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  B a n n e r M a p   
 
 @ B a n n e r C o n t e n t L a y e r   n t e x t , 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  B a n n e r C o n t e n t L a y e r 
 
 
 
 @ E d i t o r   n t e x t , 	 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   vCgP  Yg:NzzW[&{b  N U L L RS	g  A d m i n   T  C h i e f E d i t o r   SNYgeQNwQSOv
TW[SN/feS _vY*N	RُNSN	
 
 @ D e d i c a t e d T o   n t e x t , 	 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   vCgP  Yg:NzzW[&{b  N U L L RNNSYg/fc[(u7bT~Rc[(u7bTc[~Nv(u7bS	
 
 @ C o m m e n t s P e r m i s s i o n   n t e x t 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   vċCgP  Yg/fzzW[&{b  N U L L RNNSċYg/fc[(u7bT~Rc[(u7bT~Nv(u7bSċ	
 
 
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' M a i n D i r e c t o r y ' , @ M a i n D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = SS_MR  M a i n D i r e c t o r y   v  O v e r v i e w   S u b D i r e c t o r y   T  O v e r v i e w P a g e D i r e c t o r y   v  I D 
 
 - - = = :g6Rf/T(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 D E C L A R E   @ O v e r v i e w S u b D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w S u b D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w S u b D i r e c t o r y ( @ M a i n D i r e c t o r y I D ) 
 
 
 
 D E C L A R E   @ O v e r v i e w P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' M a i n D i r e c t o r y ' , @ M a i n D i r e c t o r y I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg  @ N a m e   Speww/f
N/f]~(u  FOcd](uv`b_	b
0^0]v  O v e r v i e w   S u b D i r e c t o r y   `S(ub
0^0]v  O v e r v i e w   P a g e D i r e c t o r y   `S(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e   A n d   [ I D ] < > @ M a i n D i r e c t o r y I D ) )   O R   ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e   A n d   [ I D ] < > @ O v e r v i e w S u b D i r e c t o r y I D ) )   O R   ( E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e   A n d   [ I D ] < > @ O v e r v i e w P a g e D i r e c t o r y I D ) ) 
 
 * / 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;NvU_
TySvQN^\Q[u
Tyhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   [ N a m e ] = @ N a m e   A n d   [ I D ] < > @ M a i n D i r e c t o r y I D ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' ;NvU_v
TW[  % s   ]`S(u' , 1 6 , 1 , @ N a m e ) 
 
 E N D 
 
 
 
 D E C L A R E   @ O v e r v i e w P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' M a i n D i r e c t o r y ' , @ M a i n D i r e c t o r y I D ) 
 
 
 
 I F     E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   [ N a m e ] = @ O v e r v i e w P a g e D i r e c t o r y N a m e   A n d   [ I D ] < > @ O v e r v i e w P a g e D i r e c t o r y I D ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' ;NvU_v^\Q[ubv
TW[  % s   ]`S(u' , 1 6 , 1 , @ O v e r v i e w P a g e D i r e c t o r y N a m e ) 
 
 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (WO9e  M a i n D i r e c t o r y   U_KNMRHQww,gU_v  @ S y s t e m   ^\'`/f
N/f:N  " t r u e " Yg/fR\penc^-NvQN:N   t r u e    vU_9e:N  ' f a l s e '   V:NS	g N*N  t r u e 1\/f|~-NTeS	g N*N;N܃US/f  S y s t e m   M e n u 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ S y s t e m = 1 
 
 B E G I N 
 
 	 U P D A T E   d b o . M a i n D i r e c t o r y   S E T   [ S y s t e m ] = 0   W H E R E   [ S y s t e m ] = 1 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  M a i n D i r e c y t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . M a i n D i r e c t o r y   S E T 
 
 
 
 	 S e r i a l = @ S e r i a l , 
 
 	 [ N a m e ] = @ N a m e , 
 
 	 N e w W i n d o w = @ N e w W i n d o w , 
 
 	 [ S y s t e m ] = @ S y s t e m , 
 
 	 I n A c t i v e M a i n M e n u I c o n M a p = @ I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 A c t i v e M a i n M e n u I c o n M a p = @ A c t i v e M a i n M e n u I c o n M a p , 
 
 	 B a n n e r M a p = @ B a n n e r M a p , 
 
 	 B a n n e r C o n t e n t L a y e r = @ B a n n e r C o n t e n t L a y e r , 
 
 	 E d i t o r = @ E d i t o r , 
 
 	 D e d i c a t e d T o = @ D e d i c a t e d T o , 
 
 	 C o m m e n t s P e r m i s s i o n = @ C o m m e n t s P e r m i s s i o n 
 
 
 
 W H E R E   [ I D ] = @ M a i n D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9evQ  O v e r v i e w   P a g e D i r e c t o r y   v  N a m e   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   [ N a m e ] = @ O v e r v i e w P a g e D i r e c t o r y N a m e   W H E R E   [ I D ] = @ O v e r v i e w P a g e D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9evQ  O v e r v i e w   S u b D i r e c t o r y   T  O v e r v i e w   P a g e D i r e c t o r y   v  N a m e   M a i n D i r e c t o r y   T  vQ  O v e r v i e w   S u b D i r e c t o r y   NS  O v e r v i e w   P a g e D i r e c t o r y   v  N a m e   ^Oc N	
 
 - - = = :g6Rf/T(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 U P D A T E   d b o . S u b D i r e c t o r y   S E T   [ N a m e ] = @ N a m e   W H E R E   [ I D ] = @ O v e r v i e w S u b D i r e c t o r y I D 
 
 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   [ N a m e ] = @ N a m e   W H E R E   [ I D ] = @ O v e r v i e w P a g e D i r e c t o r y I D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9eN  @ M a i n D i r e c t o r y I D     [^v  m d 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 0 ,   @ M a i n D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M a i n D i r e c t o r y M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M a i n D i r e c t o r y D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M a i n D i r e c t o r y D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M a i n D i r e c t o r y D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  M a i n D i r e c t o r y   agv
 
 - - = =  Rd  M a i n D i r e c t o r y   agvvTeOS  T r i g g e r    Rd  M a i n D i r e c t o r y   [^v  S u b D i r e c t o r y   T  M a i n D i r e c t o r y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M a i n D i r e c t o r y D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ M a i n D i r e c t o r y I D   i n t 	 	 	 	 - - sS\ Rdv  M a i n D i r e c t o r y     agvv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg       A d m i n   b  C h i e f E d i t o r   CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . M a i n D i r e c t o r y   W H E R E   [ I D ] = @ M a i n D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHh RdN  @ M a i n D i r e c t o r y I D     [^v  m d 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 6 ,   @ M a i n D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M a i n D i r e c t o r y D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  S u b D i r e c t o r y   agv
 
 - - = =  Rd  S u b D i r e c t o r y   agvS  T r i g g e r   Te Rd  S u b D i r e c t o r y C o n t e n t   T  P a g e D i r e c t o r y   -Nvv^yv
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 1 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S u b D i r e c t o r y I D   i n t , 	 	 	 	 - - sS\ Rdv  S u b D i r e c t o r y     agvv  I D 
 
 
 
 @ I s S y s t e m M e n u   b i t   	 	 	 	 - -  Rd/feg|~܃UST[N|~܃USS_,gP[܃US/f|~;N܃US|~܃USteSOhs:N;N܃US	N/U NvP[܃USveP Rd,gyv\Te Rdte*N|~;N܃US
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  S u b D i r e c t o r y I D   _  M a i n D i r e c t o r y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ M a i n D i r e c t o r y I D   I N T 
 
 S E L E C T   @ M a i n D i r e c t o r y I D = s d . M a i n D i r e c t o r y I D   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg vQ
N~CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' M a i n D i r e c t o r y ' , @ M a i n D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  S u b D i r e c t o r y I D   _[^v  M a i n D i r e c t o r y I D wwS_MR  M a i n D i r e c t o r y   N/f&TS	gُ N*N  S u b D i r e c t o r y Yg/fR>NV:N N*N  M a i n D i r e c t o r y   N^\	g N*N  S u b D i r e c t o r y 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - D E C L A R E   @ M a i n D i r e c t o r y I D   I N T 
 
 D E C L A R E   @ C o u n t   I N T 
 
 
 
 - - S E L E C T   @ M a i n D i r e c t o r y I D = s d . M a i n D i r e c t o r y I D   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ S u b D i r e c t o r y I D 
 
 S E L E C T   @ C o u n t = C O U N T ( s d . [ I D ] )   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/f/U Nv  S u b D i r e c t o r y   yvR>N&TRRck8^ Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ C o u n t < = 1 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = /f&T Rd|~P[܃USyv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ I s S y s t e m M e n u = 1 
 
 
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Yg/f Rd|~P[܃USR(WS_MR|~P[܃US/fte*N|~;N܃USN/U NP[yvvePbNTe Rdte*N|~;N܃US
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 D E L E T E   F R O M   d b o . M a i n D i r e c t o r y   W H E R E   [ I D ] = @ M a i n D i r e c t o r y I D 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = \S_MR;mRU_(WHh RdNte*N|~;NvU_	
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 6 ,   @ M a i n D i r e c t o r y I D 
 
 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = >N,g`b_
N*YSSu	
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 R A I S E R R O R ( N ' `sS\ RdvP[vU_/fvQ
N~vU_;NvU_	N/U NP[agv
NSN Rd' , 1 6 , 1 ) 
 
 	 	 E N D 
 
 	 E N D 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  Rd
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E L E T E   F R O M   d b o . S u b D i r e c t o r y   W H E R E   [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHh RdNP[vU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 7 ,   @ S u b D i r e c t o r y I D 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  P a g e D i r e c t o r y   agv
 
 - - = =  Rd  P a g e D i r e c t o r y   agvS  T r i g g e r   Te Rd  K n o w l e d g e   T  P a g e D i r e c t o r y C o n t e n t   agv
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y I D   i n t 	 	 	 	 - - sS\ Rdv  P a g e D i r e c t o r y     agvv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  P a g e D i r e c t o r y I D   _vQ
N~  S u b D i r e c t o r y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ S u b D i r e c t o r y I D   I N T 
 
 S E L E C T   @ S u b D i r e c t o r y I D = p d . S u b D i r e c t o r y I D   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . [ I D ] = @ P a g e D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg   vQ
N~CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  P a g e D i r e c t o r y I D   _[^v  S u b D i r e c t o r y I D wwS_MR  S u b D i r e c t o r y   N/f&TS	gُ N*N  P a g e D i r e c t o r y Yg/fR>NV:N N*N  S u b D i r e c t o r y   N^\	g N*N  P a g e D i r e c t o r y 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - D E C L A R E   @ S u b D i r e c t o r y I D 2   I N T 
 
 D E C L A R E   @ C o u n t   I N T 
 
 
 
 - - S E L E C T   @ S u b D i r e c t o r y I D 2 = p d . S u b D i r e c t o r y I D   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . [ I D ] = @ P a g e D i r e c t o r y I D 
 
 S E L E C T   @ C o u n t = C O U N T ( p d . [ I D ] )   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/f/U Nv  P a g e D i r e c t o r y   yvR>N&TRRck8^ Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ C o u n t < = 1 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = >N
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 R A I S E R R O R ( N ' `sS\ RdvuvU_/fvQ
N~vU_P[vU_	N/U NP[agv
NSN Rd' , 1 6 , 1 ) 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  Rd
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E L E T E   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ I D ] = @ P a g e D i r e c t o r y I D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHh RdNuvU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 8 ,   @ P a g e D i r e c t o r y I D 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  K n o w l e d g e   agv
 
 - - = =  Rd  K n o w l e d g e   agvveP  K n o w l e d g e   -Nv  T r i g g e r   OSgbL[  K n o w l e d g e C o n t e n t   v^agvv Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e I D   i n t 	 	 	 	 - - sS\ Rdv  K n o w l e d g e     agvv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ K n o w l e d g e I D   ԏV[^v  P a g e D i r e c t o r y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ P a g e D i r e c t o r y I D = n o w . P a g e D i r e c t o r y I D   F R O M   d b o . K n o w l e d g e   n o w   W H E R E   n o w . [ I D ] = @ K n o w l e d g e I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg   RdCgPhgvQ
N~	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' P a g e D i r e c t o r y ' , @ P a g e D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . K n o w l e d g e   W H E R E   [ I D ] = @ K n o w l e d g e I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHh RdN  K n o w l e d g e   -     K n o w l e d g e C o n t e n t I D   =   @ o N e w I D 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 9 ,   @ K n o w l e d g e I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e g i s t e r S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e g i s t e r S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e g i s t e r S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[(u7blQ
 
 - - = = HQhgS_MR(u7b/f&T]~X[(WYgX[(W>N
 
 - - = = \R^(u7bvDeQeQ  U s e r s   hN  C o m m u n i t y   ҉r	
 
 - - = = lalQ(u7bv^
NcO  R a n k   SpeVdk؞O(u  1 0 0 0 0 0 0   \O:NvQ  R a n k   <P
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e g i s t e r S a v e 
 
 
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - (u7b
T
 
 @ P a s s w o r d   n v a r c h a r ( 2 0 ) , 	 	 	 	 - - [xSeُ*N[x(ueg^zpenc^(u7b   g'Y^  2 0 	
 
 @ E n c r y p t e d P a s s w o r d   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - [xvR[b__ُ*N[x\OX[(W  U s e r s   h(W  L o g i n   veP\(uegT{vU_[x[gq   g'Y^  2 0 0 	
 
 @ F i r s t N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - Y
 
 @ L a s t N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - 
T
 
 @ T e l   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - 5u݋
 
 @ E m a i l   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - 5uP[N
 
 @ M o b i l e   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - yR5u݋
 
 @ F a x   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - -  Ow
 
 @ M S N   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - M S N 
 
 @ S k y p e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - S k y p e 
 
 @ T w i t t e r   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - T w i t t e r 
 
 @ Q Q   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - Q Q 
 
 @ A d d r e s s   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 - - A d d r e s s 
 
 @ S e x   i n t , 	 	 	 	 	 	 - - '`+R
 
 @ O r g a n i z a t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 - - ~~
 
 @ P o s i t i o n   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - LMO
 
 @ P o r t r a i t N a m e   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 	 - - 4YP;_  / W r i t a b l e / U s e r A c c o u n t P o r t r a i t / < G U I D > / P o r t r a i t N a m e 	
 
 @ R e m a r k   n v a r c h a r ( 1 0 0 0 ) 	 	 	 	 - - Yl
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spehg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ N a m e = L T R I M ( R T R I M ( @ N a m e ) ) 
 
 S E T   @ P a s s w o r d = L T R I M ( R T R I M ( @ P a s s w o r d ) ) 
 
 S E T   @ E n c r y p t e d P a s s w o r d = L T R I M ( R T R I M ( @ E n c r y p t e d P a s s w o r d ) ) 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gNSpe:Nzz
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ N a m e = N ' ' )   O R   ( @ N a m e   I S   N U L L )   O R   ( @ P a s s w o r d = N ' ' )   O R   ( @ P a s s w o r d   I S   N U L L )   O R   ( @ E n c r y p t e d P a s s w o r d = N ' ' )   O R   ( @ E n c r y p t e d P a s s w o r d   I S   N U L L ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' (u7b
TT[x
NS:Nzz0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg(u7b]~X[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ P u b l i c P r o f i l e E x i s t s ( @ N a m e ) = 1 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' `	bv(u7b
T]~X[(WS	b N*N
TW[0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ,g0WSϑ    
 
 - - = = elQꁨRۏeQ  U s e r R o l e   ( 2   -   C o m m u n i t y ) 
 
 - - = = elQ(u7bv  I s C l i e n t   ^\'`ꁨR:N  2   ( C A N C E L ) 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ U s e r R o l e   I N T   	 
 
 S E T   @ U s e r R o l e = d b o . U D F _ U s e r R o l e I D ( N ' C o m m u n i t y ' ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  U s e r R o l e   ޏTqQTv  N a m e , P a s s w o r d , . . . .   OX[0R  U s e r s   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . U s e r s   ( [ N a m e ] , [ P a s s w o r d ] , F i r s t N a m e , L a s t N a m e , T e l , E m a i l , M o b i l e , F a x , M S N , S k y p e , T w i t t e r , Q Q , A d d r e s s , S e x , O r g a n i z a t i o n , [ P o s i t i o n ] , P o r t r a i t N a m e , R e m a r k , R e g i s t e r D a t e , U s e r R o l e )   V A L U E S   ( @ N a m e , @ E n c r y p t e d P a s s w o r d , @ F i r s t N a m e , @ L a s t N a m e , @ T e l , @ E m a i l , @ M o b i l e , @ F a x , @ M S N , @ S k y p e , @ T w i t t e r , @ Q Q , @ A d d r e s s , @ S e x , @ O r g a n i z a t i o n , @ P o s i t i o n , @ P o r t r a i t N a m e , @ R e m a r k , G E T D A T E ( ) , @ U s e r R o l e ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \(u7bv  R e a d E n a b l e d ,   T o p i c W r i t e E n a b l e d ,   F o l l o w U p W r i t e E n a b l e d   CgPRM~@b	g  P u b l i c   F o r u m 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - I N S E R T   I N T O   d b o . U s e r F o r u m s   ( [ U s e r ] , F o r u m , R e a d E n a b l e d , T o p i c W r i t e E n a b l e d , F o l l o w U p W r i t e E n a b l e d )   S E L E C T   @ N a m e , [ I D ] , 1 , 1 , 1   F R O M   d b o . F o r u m   W H E R E   [ P u b l i c ] = N ' t r u e ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \(u7bR0RlQ؞~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . U s e r G r o u p s   ( U s e r G r o u p I D , [ U s e r ] )   S E L E C T   u g . [ I D ] ,   @ N a m e   F R O M   d b o . U s e r G r o u p   u g   W H E R E   u g . R e g i s t e r D e f a u l t = 1 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e g i s t e r S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y T r e e S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y T r e e S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y T r e e S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  V i e w _ C o m m u n i t y T r e e   -NShQbc[vU_
 
 - - = = YgSpe  C o m m u n i t y D i r e c t o r y   T  C o m m u n i t y I t e m   /f  N U L L RԏVhQ萰U_  &TRԏVc[vU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y T r e e S e l e c t 
 
 
 
 @ C o m m u n i t y D i r e c t o r y   N V A R C H A R ( 4 0 0 0 ) , 	 	 - - C o m m u n i t y   vU_
 
 @ C o m m u n i t y I t e m   I N T , 	 	 	 	 	 - - C o m m u n i t y   I D 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 )           	 	 	 	 - - c[eS    
 
 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg  @ C o m m u n i t y D i r e c t o r y   T  @ C o m m u n i t y I t e m   /f  N U L L 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ C o m m u n i t y D i r e c t o r y   I S   N U L L   A N D   @ C o m m u n i t y I t e m   I S   N U L L 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ԏVte*N  V i e w _ C o m m u n i t y T r e e 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 	 	 S E L E C T   *   F R O M   d b o . V i e w _ C o m m u n i t y T r e e   W H E R E   C u l t u r e = @ C u l t u r e   O R D E R   B Y   S e r i a l 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = Yg  @ C o m m u n i t y D i r e c t o r y   T  @ C o m m u n i t y I t e m   
N/f  N U L L 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F   @ C o m m u n i t y D i r e c t o r y   I S   N O T   N U L L   A N D   @ C o m m u n i t y I t e m   I S   N O T   N U L L 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ԏVc[v  @ C o m m u n i t y D i r e c t o r y   Nvc[  I t e m 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   *   F R O M   d b o . V i e w _ C o m m u n i t y T r e e   W H E R E   D i r e c t o r y   I N   ( S e l e c t   E l e m e n t   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ C o m m u n i t y D i r e c t o r y , N ' , ' ) )   A N D   [ I D ] = @ C o m m u n i t y I t e m   A N D   C u l t u r e = @ C u l t u r e   O R D E R   B Y   S e r i a l 
 
 	 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ԏVc[v  @ C o m m u n i t y D i r e c t o r y   Nv@b	g  I t e m 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   *   F R O M   d b o . V i e w _ C o m m u n i t y T r e e   W H E R E   D i r e c t o r y   I N   ( S e l e c t   E l e m e n t   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ C o m m u n i t y D i r e c t o r y , N ' , ' ) )   A N D   C u l t u r e = @ C u l t u r e   O R D E R   B Y   S e r i a l 
 
 	 	 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y T r e e S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    C o m m u n i t y I t e m   ( C o m m u n i t y   I D )   _  C o m m u n i t y   h-Nvc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y S e l e c t 
 
 
 
 @ C o m m u n i t y I t e m   I N T 	 	 	 	 - - C o m m u n i t y   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 [ I D ]   A S   [ I D ] , 
 
 	 S e r i a l   A S   S e r i a l , 
 
 	 [ N a m e ]   A S   [ N a m e ] , 
 
 	 M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 I S N U L L ( [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 	 R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 F R O M   d b o . C o m m u n i t y 
 
 
 
 W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o r u m S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o r u m S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o r u m S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    C o m m u n i t y I t e m   ( F o r u m   I D )   _  F o r u m   h-Nvc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o r u m S e l e c t 
 
 
 
 @ C o m m u n i t y I t e m   I N T 	 	 	 	 - - F o r u m   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b  F o r u m   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 [ I D ]   A S   [ I D ] , 
 
 	 C o m m u n i t y I D   A S   C o m m u n i t y I D , 
 
 	 S e r i a l   A S   S e r i a l , 
 
 	 [ N a m e ]   A S   [ N a m e ] , 
 
 	 M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 I S N U L L ( [ P u b l i c ] , N ' t r u e ' )   A S   [ P u b l i c ] , 
 
 	 R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 F R O M   d b o . F o r u m 
 
 
 
 W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o r u m S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  C o m m u n i t y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 	 	 - - S_MR  C o m m u n i t y   v^RSkag  C o m m u n i t y     v>f:y!k^1u  S e r i a l   Q[^RS'YHQ>f:y	
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - S_MR  C o m m u n i t y   v
TW[
 
 @ M o d e r a t o r   N V A R C H A R ( 1 0 0 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y   v  M o d e r a t o r   ^\'`
 
 @ P u b l i c   N V A R C H A R ( 5 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y   v  P u b l i c   ^\'`
 
 @ I n A c t i v e M a i n M e n u I c o n M a p   n t e x t , 	 	 	 - - S_MR  C o m m u n i t y   v  I n A c t i v e M a i n M e n u I c o n M a p 
 
 @ A c t i v e M a i n M e n u I c o n M a p   n t e x t , 	 	 	 - - S_MR  C o m m u n i t y   v  A c t i v e M a i n M e n u I c o n M a p 
 
 @ B a n n e r M a p   n t e x t , 	 	 	 	 	 - - S_MR  C o m m u n i t y   v  B a n n e r M a p 
 
 @ B a n n e r C o n t e n t L a y e r   n t e x t , 	 	 	 	 - - S_MR  C o m m u n i t y   v  B a n n e r C o n t e n t L a y e r 
 
 @ R e a d P e r m i s s i o n   n t e x t , 	 	 	 	 	 - - S_MR  C o m m u n i t y   v  R e a d P e r m i s s i o n 
 
 @ T o p i c W r i t e P e r m i s s i o n   n t e x t , 	 	 	 	 - - S_MR  C o m m u n i t y   v  T o p i c W r i t e P e r m i s s i o n 
 
 @ F o l l o w U p W r i t e P e r m i s s i o n   n t e x t , 	 	 	 	 - - S_MR  C o m m u n i t y   v  F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . C o m m u n i t y ( S e r i a l , [ N a m e ] , M o d e r a t o r , [ P u b l i c ] , I n A c t i v e M a i n M e n u I c o n M a p , A c t i v e M a i n M e n u I c o n M a p , B a n n e r M a p , B a n n e r C o n t e n t L a y e r , R e a d P e r m i s s i o n , T o p i c W r i t e P e r m i s s i o n , F o l l o w U p W r i t e P e r m i s s i o n )   V A L U E S ( @ S e r i a l , @ N a m e , d b o . U D F _ M o d e r a t o r C l e a n ( @ M o d e r a t o r ) , @ P u b l i c , @ I n A c t i v e M a i n M e n u I c o n M a p , @ A c t i v e M a i n M e n u I c o n M a p , @ B a n n e r M a p , @ B a n n e r C o n t e n t L a y e r , @ R e a d P e r m i s s i o n , @ T o p i c W r i t e P e r m i s s i o n , @ F o l l o w U p W r i t e P e r m i s s i o n ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e s s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o r u m S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o r u m S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o r u m S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  F o r u m 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o r u m S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C o m m u n i t y I D   i n t , 	 	 	 - - S_MR  F o r u m   [^v  C o m m u n i t y   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 - - S_MR  F o r u m   v^RSkag  F o r u m     v>f:y!k^1u  S e r i a l   Q[^RS'YHQ>f:y	
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  F o r u m   v
TW[
 
 @ M o d e r a t o r   n v a r c h a r ( 1 0 0 0 ) , 	 	 - - S_MR  F o r u m   vezRhN   _	
 
 @ P u b l i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  F o r u m   /f&T  P u b l i c 
 
 @ R e a d P e r m i s s i o n   n t e x t , 	 	 	 - - S_MR  F o r u m   /f&T  R e a d P e r m i s s i o n 
 
 @ T o p i c W r i t e P e r m i s s i o n   n t e x t , 	 	 - - S_MR  F o r u m   /f&T  T o p i c W r i t e P e r m i s s i o n 
 
 @ F o l l o w U p W r i t e P e r m i s s i o n   n t e x t , 	 	 - - S_MR  F o r u m   /f&T  F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . F o r u m ( C o m m u n i t y I D , S e r i a l , [ N a m e ] , M o d e r a t o r , [ P u b l i c ] , R e a d P e r m i s s i o n , T o p i c W r i t e P e r m i s s i o n , F o l l o w U p W r i t e P e r m i s s i o n )   V A L U E S ( @ C o m m u n i t y I D , @ S e r i a l , @ N a m e , d b o . U D F _ M o d e r a t o r C l e a n ( @ M o d e r a t o r ) , @ P u b l i c , @ R e a d P e r m i s s i o n , @ T o p i c W r i t e P e r m i s s i o n , @ F o l l o w U p W r i t e P e r m i s s i o n ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e s s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o r u m S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  C o m m u n i t y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C o m m u n i t y I D   i n t , 	 	 	 	 	 - - S_MR  C o m m u n i t y   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 	 	 - - S_MR  C o m m u n i t y   v^RSkag  C o m m u n i t y   v>f:y!k^1u  S e r i a l   Q[^RS'YHQ>f:y	
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - S_MR  C o m m u n i t y   v
TW[
 
 @ M o d e r a t o r   N V A R C H A R ( 1 0 0 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y   v  M o d e r a t o r   ^\'`
 
 @ P u b l i c   N V A R C H A R ( 5 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y   v  P u b l i c   ^\'`
 
 @ I n A c t i v e M a i n M e n u I c o n M a p   n t e x t , 	 	 	 - - S_MR  C o m m u n i t y   v  I n A c t i v e M a i n M e n u I c o n M a p 
 
 @ A c t i v e M a i n M e n u I c o n M a p   n t e x t , 	 	 	 - - S_MR  C o m m u n i t y   v  A c t i v e M a i n M e n u I c o n M a p 
 
 @ B a n n e r M a p   n t e x t , 	 	 	 	 	 - - S_MR  C o m m u n i t y   v  B a n n e r M a p 
 
 @ B a n n e r C o n t e n t L a y e r   n t e x t , 	 	 	 	 - - S_MR  C o m m u n i t y   v  B a n n e r C o n t e n t L a y e r 
 
 @ R e a d P e r m i s s i o n   n t e x t , 	 	 	 	 	 - - S_MR  C o m m u n i t y   v  R e a d P e r m i s s i o n 
 
 @ T o p i c W r i t e P e r m i s s i o n   n t e x t , 	 	 	 	 - - S_MR  C o m m u n i t y   v  T o p i c W r i t e P e r m i s s i o n 
 
 @ F o l l o w U p W r i t e P e r m i s s i o n   n t e x t 	 	 	 	 - - S_MR  C o m m u n i t y   v  F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . C o m m u n i t y   S E T 
 
 
 
 	 S e r i a l = @ S e r i a l , 
 
 	 [ N a m e ] = @ N a m e , 
 
 	 M o d e r a t o r = d b o . U D F _ M o d e r a t o r C l e a n ( @ M o d e r a t o r ) , 
 
 	 [ P u b l i c ] = @ P u b l i c , 
 
 	 I n A c t i v e M a i n M e n u I c o n M a p = @ I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 A c t i v e M a i n M e n u I c o n M a p = @ A c t i v e M a i n M e n u I c o n M a p , 
 
 	 B a n n e r M a p = @ B a n n e r M a p , 
 
 	 B a n n e r C o n t e n t L a y e r = @ B a n n e r C o n t e n t L a y e r , 
 
 	 R e a d P e r m i s s i o n = @ R e a d P e r m i s s i o n , 
 
 	 T o p i c W r i t e P e r m i s s i o n = @ T o p i c W r i t e P e r m i s s i o n , 
 
 	 F o l l o w U p W r i t e P e r m i s s i o n = @ F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 W H E R E   [ I D ] = @ C o m m u n i t y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o r u m M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o r u m M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o r u m M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  F o r u m 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o r u m M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o r u m I D   i n t , 	 	 	 	 - - S_MR  F o r u m   v  I D 
 
 
 
 @ S e r i a l   i n t , 	 	 	 	 - - S_MR  F o r u m   v^RSkag  F o r u m   v>f:y!k^1u  S e r i a l   Q[^RS'YHQ>f:y	
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  F o r u m   v
TW[
 
 @ M o d e r a t o r   n v a r c h a r ( 1 0 0 0 ) , 	 	 - - S_MR  F o r u m   vezRh(u       _	
 
 @ P u b l i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  F o r u m   /f&T  P u b l i c   R^(u7bvePOꁨR:Ne^(u7bRM  P u b l i c   F o r u m   vOmȉS^V^CgP	
 
 @ R e a d P e r m i s s i o n   n t e x t , 	 	 	 - - S_MR  F o r u m   v  R e a d P e r m i s s i o n 
 
 @ T o p i c W r i t e P e r m i s s i o n   n t e x t , 	 	 - - S_MR  F o r u m   v  T o p i c W r i t e P e r m i s s i o n 
 
 @ F o l l o w U p W r i t e P e r m i s s i o n   n t e x t 	 	 - - S_MR  F o r u m   v  F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . F o r u m   S E T 
 
 
 
 	 S e r i a l = @ S e r i a l , 
 
 	 [ N a m e ] = @ N a m e , 
 
 	 M o d e r a t o r = d b o . U D F _ M o d e r a t o r C l e a n ( @ M o d e r a t o r ) , 
 
 	 [ P u b l i c ] = @ P u b l i c , 
 
 	 R e a d P e r m i s s i o n = @ R e a d P e r m i s s i o n , 
 
 	 T o p i c W r i t e P e r m i s s i o n = @ T o p i c W r i t e P e r m i s s i o n , 
 
 	 F o l l o w U p W r i t e P e r m i s s i o n = @ F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 W H E R E   [ I D ] = @ F o r u m I D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o r u m M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  C o m m u n i t y   agv
 
 - - = =  Rd  C o m m u n i t y   agvO_S  T r i g g e r   Te Rd  C o m m u n i t y C o n t e n t   T  F o r u m   -N[^vU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 1 - 0 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C o m m u n i t y I D   i n t 	 	 	 	 - - sS\ Rdv  C o m m u n i t y     agvv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . C o m m u n i t y   W H E R E   [ I D ] = @ C o m m u n i t y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o r u m D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o r u m D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o r u m D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  F o r u m   agv
 
 - - = =  Rdagv_S  T r i g g e r   OTe Rd  T o p i c   -Nv^U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o r u m D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o r u m I D   i n t 	 	 	 	 - - sS\ Rdv  F o r u m     agvv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ F o r u m I D   _[^v  C o m m u n i t y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C o m m u n i t y I D   I N T 
 
 S E L E C T   @ C o m m u n i t y I D = d b o . U D F _ G e t C o m m u n i t y I D F r o m F o r u m I D ( @ F o r u m I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = wwS_MR  C o m m u n i t y   N/f&TS	gُ N*N  F o r u m Yg/fR>NV:N N*N  C o m m u n i t y   N^\	g N*N  F o r u m 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C o u n t   I N T 
 
 S E L E C T   @ C o u n t = C O U N T ( f o . [ I D ] )   F R O M   d b o . F o r u m   f o   W H E R E   f o . C o m m u n i t y I D = @ C o m m u n i t y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/f/U Nv  F o r u m     yvR>N&TRRck8^ Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ C o u n t < = 1 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = >N
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 R A I S E R R O R ( N ' `sS\ Rdv[WF o r u m 	/fvQ@b^\>y:SC o m m u n i t y 	N/U N[W
NSN Rd' , 1 6 , 1 ) 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  Rd
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E L E T E   F R O M   d b o . F o r u m   W H E R E   [ I D ] = @ F o r u m I D 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o r u m D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e Q u e r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e Q u e r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e Q u e r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ُ*N  S P   v\O(u9hnc~[~"}g  K n o w l e d g e   
 
 - - = = Sped"}  K e y w o r d YgSpe:NN U L L ,   Ry
NSNh"}
 
 - - = = SpeC u l t u r e   Sd"}~[eSNvQ[
 
 - - = = ^zRu:g6RHQ\ck8^g~gX[eQ N*N~g N7hFOYN N*NP a g i n g I D vhSϑ	9hncP a g i n g I D @ P a g e S i z e @ C u r r e n t P a g e 	SS_MRuvU_v^\;`upe\O:N N*NRhMOQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 9 - 0 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e Q u e r y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X    OǏegvS_MR(u7b
 
 
 
 @ K e y w o r d   n v a r c h a r ( 5 0 ) , 	 	 	 - - d"}sQ.͋   gY5 0 W[SN2bkv`ad"}	
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - c[eS
 
 
 
 @ P a g e S i z e   I N T , 	 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T , 	 	 	 - - ux:g6RS_MRu
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) 	 	 - - c^e_  A S C ,   D E S C 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spev8YtN(WX[(WR`Sv0WeO(u	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ K e y w o r d = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ K e y w o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = CgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (uegg^  W h e r e   NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 )         
 
 D E C L A R E   @ D y n W h e r e   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^Ruh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = N '   S E T   N O C O U N T   O N       ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ P a g i n g   t a b l e   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ I D ]   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T i t l e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C o n t e n t   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ K n o w l e d g e A p p r o v e   n v a r c h a r ( 5 0 )   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   @ K n o w l e d g e A p p r o v e = c o n v e r t ( n v a r c h a r ( 5 0 ) , o p t . [ V a l u e ] )   F r o m   d b o . [ O p t i o n ]   o p t   W h e r e   o p t . [ K e y ] = N ' ' K n o w l e d g e A p p r o v e ' '   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = kXEQRuh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t         '     
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w . [ I D ]   a s   [ I D ] ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C a s e   n o w c . T i t l e   W h e n   N u l l   T h e n   N ' ' N o   T i t l e ' '   W h e n   N ' ' ' '   T h e n   N ' ' N o   T i t l e ' '   E l s e   n o w c . T i t l e   E n d   a s   T i t l e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w c . C o n t e n t   a s   C o n t e n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   p d . [ N a m e ]   a s   P a g e D i r e c t o r y N a m e   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . K n o w l e d g e   n o w   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . K n o w l e d g e C o n t e n t   n o w c   o n   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A n d   n o w c . C u l t u r e = ' ' '     +   @ C u l t u r e   +     N ' ' ' ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . P a g e D i r e c t o r y   p d   o n   p d . [ I D ] = n o w . P a g e D i r e c t o r y I D   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hncS_MR(u7bCgPO(u
NTagN  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W H E R E   1 = 1   ' 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   o n   n o w p . K n o w l e d g e I D = n o w . [ I D ]   ' 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W H E R E   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' ' , ' ' , N ' ' ' ' ) = N ' ' ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( N ' ' '   +   @ U s e r   +   N ' ' ' , n o w p . D e d i c a t e d T o ) = 1 )     A N D   n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' ' f a l s e ' ' )   ' 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = vQ[R`  W H E R E   NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n W h e r e = N ' ' 
 
 	 	 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ K e y w o r d   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = laُ̑R+RN  T i t l e   T  C o n t e n t   -NۏLd"}
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ K e y w o r d   I S   N O T   N U L L     
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ K e y w o r d   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ K e y w o r d = R T R I M ( L T R I M ( @ K e y w o r d ) )   
 
 	 	 
 
 	 I F   @ K e y w o r d < > N ' '   
 
 	 B E G I N 	 	 
 
 	 	 S E T   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   ( n o w c . T i t l e   l i k e   N ' ' % '   +   @ K e y w o r d   +   N ' % ' '   o r   n o w c . C o n t e n t   l i k e   N ' ' % '   +   @ K e y w o r d   +   N ' % ' ' )   '   
 
 	 E N D 
 
 E N D 
 
 	 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = MRbv  S Q L   S gTR  vQ[R`  W H E R E   NS  @ D y n S Q L   -N]~S+T  W H E R E   1 = 1 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   @ D y n W h e r e 
 
 	 	 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R
N  O r d e r   B y   NS
 
 - - = = Yg  O r d e r B y = ' '   RO(u:w  o r d e r   b y   U p d a t e T i m e   D E S C 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ O r d e r B y = L T R I M ( R T R I M ( @ O r d e r B y ) ) 
 
 S E T   @ O r d e r B y O r d e r = L T R I M ( R T R I M ( @ O r d e r B y O r d e r ) ) 
 
 	 	 
 
 I F   L E N ( @ O r d e r B y ) = 0   O R     L E N ( @ O r d e r B y O r d e r ) = 0 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   T i t l e   D E S C   ' 
 
 	 E N D 
 
 E L S E 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ '   +   @ O r d e r B y   +   N ' ]   '   +   @ O r d e r B y O r d e r 
 
 	 E N D 
 
 	 	 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e t   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   * , P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ P a g e S i z e )   +   N ' ) )   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ F i r s t R e c o r d )   +   N '   a n d   P a g i n g I D < '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgR`Sv^
NSNǏ|~
NP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s D y n S Q L   I N T 
 
 E X E C   d b o . P u b l i c D y n S Q L L e n g t h C h e c k   @ D y n S Q L , @ o P a s s D y n S Q L   O U T 
 
 I F   @ o P a s s D y n S Q L = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLR`  S Q L   S   _Y~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e Q u e r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r A c c o u n t O n l i n e L i s t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r A c c o u n t O n l i n e L i s t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r A c c o u n t O n l i n e L i s t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  U s e r s   h_S_MR(W~(u7bRh
 
 - - = = (u  U D F _ P u b l i c L o g i n O n l i n e   Nhgg*N(u7b/f&T(W~
 
 - - = =   S P   (uN  D a t a R e s t o r e U I . c s   N$ReS_MR/f&TSNۏL  R e s t o r e   ۏL  R e s t o r e   v N*N[hQce/f_{OS_MRl	g(u7b(W~
 
 - - = = 2 0 0 8 / 1 1 / 1 9   (WvMRv`RNU D F _ P u b l i c L o g i n O n l i n e   Y~ԏV  0   @bNُ̑v  U s e r A c c o u n t O n l i n e L i s t   Y~ԏVzz  V:NbN
NQO(upenc^~(u7b|~/f  T a b l e   ~(u7b|~vMR  U s e r O n L i n e   :g6RS@bN؏~~OYu}6q]~l(u	/f^gNT(W  T a b l e   ~_N[s(u7b/f&T(W~ߍ*kY N*N(u7b{vFT(WvQ  P r o f i l e   -Nn N*N  o n l i n e   h_y _Tn N*N  o f f l i n e   h_FOُ/fNTvR	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 1 - 0 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r A c c o u n t O n l i n e L i s t 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 S E L E C T   D I S T I N C T 
 
 	 	 u s r . [ N a m e ]   A S   [ N a m e ] 
 
 
 
 F R O M   d b o . U s e r s   u s r 
 
 W H E R E   d b o . U D F _ P u b l i c L o g i n O n l i n e ( u s r . [ N a m e ] ) = 1 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r A c c o u n t O n l i n e L i s t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M a i n D i r e c t o r y C o n t e n t S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M a i n D i r e c t o r y C o n t e n t S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M a i n D i r e c t o r y C o n t e n t S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e I t e m   ( M a i n D i r e c t o r y   I D )   _  M a i n D i r e c t o r y C o n t e n t   h-N  @b	g  C u l t u r e   NvU_vc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M a i n D i r e c t o r y C o n t e n t S e l e c t 
 
 
 
 @ K n o w l e d g e I t e m   I N T 	 	 	 	 - - M a i n D i r e c t o r y   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 m d c . [ I D ]   A S   [ I D ] , 
 
 	 m d c . M a i n D i r e c t o r y I D   A S   M a i n D i r e c t o r y I D , 
 
 	 m d c . C u l t u r e   A S   C u l t u r e , 
 
 	 m d c . T i t l e   A S   T i t l e , 
 
 	 m d c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 m d c . H i d d e n   A S   H i d d e n , 
 
 	 m d c . H i d d e n I n N a v i g a t i o n O n l y   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 m d c . P a g e H e a d e r   A S   P a g e H e a d e r , 
 
 	 m d c . P a g e F o o t e r   A S   P a g e F o o t e r , 
 
 
 
 	 m d c . U r l   A S   U r l , 
 
 	 I S N U L L ( m d c . T h i s I s L i n k , 0 )   A S   T h i s I s L i n k , 
 
 
 
 	 m d c . T i t l e   A S   A c t i o n I n d i c a t o r T i t l e 
 
 
 
 F R O M   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   
 
 
 
 W H E R E   m d c . M a i n D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M a i n D i r e c t o r y C o n t e n t S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y C o n t e n t S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y C o n t e n t S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y C o n t e n t S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e I t e m   ( S u b D i r e c t o r y   I D )   _  S u b D i r e c t o r y C o n t e n t   h-N@b	g  C u l t u r e   NvU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y C o n t e n t S e l e c t 
 
 
 
 @ K n o w l e d g e I t e m   I N T 	 	 	 	 - - S u b D i r e c t o r y   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 s d c . [ I D ]   A S   [ I D ] , 
 
 	 s d c . S u b D i r e c t o r y I D   A S   S u b D i r e c t o r y I D , 
 
 	 s d c . C u l t u r e   A S   C u l t u r e , 
 
 	 s d c . T i t l e   A S   T i t l e , 
 
 	 s d c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 s d c . W i z a r d P r e v i o u s T i t l e   A S   W i z a r d P r e v i o u s T i t l e , 
 
 	 s d c . W i z a r d N e x t T i t l e   A S   W i z a r d N e x t T i t l e , 
 
 	 s d c . H i d d e n   A S   H i d d e n , 
 
 	 s d c . H i d d e n I n N a v i g a t i o n O n l y   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 s d c . P a g e H e a d e r , 
 
 	 s d c . P a g e F o o t e r , 
 
 
 
 	 s d c . U r l   A S   U r l , 
 
 	 I S N U L L ( s d c . T h i s I s L i n k , 0 )   A S   T h i s I s L i n k , 
 
 
 
 	 m d c . T i t l e   +   N '   /   '   +   s d c . t i t l e   A S   A c t i o n I n d i c a t o r T i t l e 
 
 
 
 
 
 F R O M   d b o . S u b D i r e c t o r y C o n t e n t   s d c   
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = s d c . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d . [ I D ] = m d c . M a i n D i r e c t o r y I D   A N D   m d c . C u l t u r e = s d c . C u l t u r e 
 
 
 
 W H E R E   s d c . S u b D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y C o n t e n t S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y C o n t e n t S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e I t e m   ( P a g e D i r e c t o r y   I D )   _  P a g e D i r e c t o r y C o n t e n t   h-N@b	gU_NvU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y C o n t e n t S e l e c t 
 
 
 
 @ K n o w l e d g e I t e m   I N T 	 	 	 	 - - P a g e D i r e c t o r y   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 p d c . [ I D ]   A S   [ I D ] , 
 
 	 p d c . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 p d c . C u l t u r e   A S   C u l t u r e , 
 
 	 p d c . S e o T i t l e   A S   S e o T i t l e , 
 
 	 p d c . S e o D e s c r i p t i o n   A S   S e o D e s c r i p t i o n , 
 
 	 p d c . S e o K e y w o r d s   A S   S e o K e y w o r d s , 
 
 	 p d c . T i t l e   A S   T i t l e , 
 
 	 p d c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 p d c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 p d c . H i d d e n   A S   H i d d e n , 
 
 	 p d c . H i d d e n I n N a v i g a t i o n O n l y   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 p d c . P a g e H e a d e r   A S   P a g e H e a d e r , 
 
 	 p d c . P a g e F o o t e r   A S   P a g e F o o t e r , 
 
 
 
 	 p d c . U r l   A S   U r l , 
 
 	 I S N U L L ( p d c . T h i s I s L i n k , 0 )   A S   T h i s I s L i n k , 
 
 
 
 	 - - m d c . T i t l e   +   N '   /   '   +   s d c . T i t l e   +   N '   /   '   +   p d c . T i t l e   A S   A c t i o n I n d i c a t o r T i t l e 
 
 
 
 	 A c t i o n I n d i c a t o r T i t l e = 
 
 
 
 	 C A S E 
 
 	 	 W H E N   ( s d . O v e r v i e w = 1 )   A N D   ( p d . O v e r v i e w = 1 )   T H E N   m d c . T i t l e 
 
 	 	 W H E N   p d . O v e r v i e w = 1   T H E N   m d c . T i t l e   +   N '   /   '   +   s d c . T i t l e 
 
 	 	 E L S E   m d c . T i t l e   +   N '   /   '   +   s d c . T i t l e   +   N '   /   '   +   p d c . T i t l e 
 
 	 E N D 
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y C o n t e n t   p d c 
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p d   O N   p d . [ I D ] = p d c . P a g e D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p d . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d . [ I D ] = s d c . S u b D i r e c t o r y I D   A N D   s d c . C u l t u r e = p d c . C u l t u r e 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d . [ I D ] = m d c . M a i n D i r e c t o r y I D   A N D   m d c . C u l t u r e = p d c . C u l t u r e 
 
 
 
 W H E R E   p d c . P a g e D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o n t e n t S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o n t e n t S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o n t e n t S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e   I D   N  _  K n o w l e d g e C o n t e n t   h-N@b	geSNvU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 1   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 8 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o n t e n t S e l e c t 
 
 
 
 @ K n o w l e d g e I t e m   I N T 	 	 	 	 - - K n o w l e d g e   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 n o w c . [ I D ]   A S   [ I D ] , 
 
 	 n o w c . K n o w l e d g e I D   A S   K n o w l e d g e I D , 
 
 	 n o w c . C u l t u r e   A S   C u l t u r e , 
 
 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 n o w c . T a g   A S   T a g , 
 
 	 n o w c . H i d d e n   A S   H i d d e n , 
 
 	 n o w c . A p p r o v e d   A S   A p p r o v e d , 
 
 	 n o w c . A p p r o v e M e s s a g e   A S   A p p r o v e M e s s a g e , 
 
 	 n o w c . A p p r o v e d B y   A S   A p p r o v e d B y , 
 
 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 - - m d c . T i t l e   +   N '   /   '   +   s d c . T i t l e   +   N '   /   '   +   p d c . t i t l e   +   N '     /   '   +   n o w c . T i t l e   A S   A c t i o n I n d i c a t o r T i t l e 
 
 
 
 	 A c t i o n I n d i c a t o r T i t l e = 
 
 
 
 	 C A S E 
 
 	 	 W H E N   ( s d . O v e r v i e w = 1 )   A N D   ( p d . O v e r v i e w = 1 )   T H E N   m d c . T i t l e   +   N '   /   '   +   n o w c . T i t l e 
 
 	 	 W H E N   p d . O v e r v i e w = 1   T H E N   m d c . T i t l e   +   N '   /   '   +   s d c . T i t l e   +   N '   /   '   +   n o w c . T i t l e 
 
 	 	 E L S E   m d c . T i t l e   +   N '   /   '   +   s d c . T i t l e   +   N '   /   '   +   p d c . t i t l e   +   N '     /   '   +   n o w c . T i t l e 
 
 	 E N D 
 
 
 
 F R O M   d b o . K n o w l e d g e C o n t e n t   n o w c 
 
 L E F T   J O I N   d b o . K n o w l e d g e   n o w   O N   n o w . [ I D ] = n o w c . K n o w l e d g e I D 
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p d   O N   p d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   O N   p d . [ I D ] = p d c . P a g e D i r e c t o r y I D   A N D   p d c . C u l t u r e = n o w c . C u l t u r e 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p d . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d . [ I D ] = s d c . S u b D i r e c t o r y I D   A N D   s d c . C u l t u r e = n o w c . C u l t u r e 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d . [ I D ] = m d c . M a i n D i r e c t o r y I D   A N D   m d c . C u l t u r e = n o w c . C u l t u r e 
 
 
 
 W H E R E   n o w c . K n o w l e d g e I D = @ K n o w l e d g e I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o n t e n t S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M a i n D i r e c t o r y C o n t e n t M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M a i n D i r e c t o r y C o n t e n t M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M a i n D i r e c t o r y C o n t e n t M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  M a i n D i r e c t o r y C o n t e n t   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M a i n D i r e c t o r y C o n t e n t M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ M a i n D i r e c t o r y I D   i n t , 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  I D 
 
 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t vc
 
 @ H i d d e n   b i t , 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   /f&Tυ
 
 @ H i d d e n I n N a v i g a t i o n O n l y   b i t , 	 	 - - ُyυ/f&TSPN(W[*-Nυ(Wُy`b_υvQ[_(ubcvePN6qO>f:yFO
NOQs(W[*-N	
 
 
 
 @ P a g e H e a d e r   n t e x t , 	 	 	 - - S_MR  m a i n D i r e c t o r y C o n t e n t   ~v  P a g e H e a d e r   \TN~b	
 
 @ P a g e F o o t e r   n t e x t , 	 	 	 - - S_MR  m a i n D i r e c t o r y C o n t e n t   ~v  P a g e F o o t e r   \TN~b	
 
 
 
 @ U r l   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   v  U r l 
 
 @ T h i s I s L i n k   b i t , 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   v  T h i s I s L i n k 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   veS
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' M a i n D i r e c t o r y ' , @ M a i n D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  @ M a i n D i r e c t o r y I D   S_MR  @ C u l t u r e   Nv  M a i n D i r e c y t o r y C o n t e n t   U_X[(WRO9eKN&TRmRKN  V:N N*NzpS(WTegmReveS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y C o n t e n t   W h e r e   M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   A n d   C u l t u r e = @ C u l t u r e ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O9e  M a i n D i r e c t o r y C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . M a i n D i r e c t o r y C o n t e n t   S E T 
 
 
 
 	 	 	 T i t l e = @ T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] = @ D e s c r i p t i o n , 
 
 	 	 	 H i d d e n = @ H i d d e n , 
 
 	 	 	 H i d d e n I n N a v i g a t i o n O n l y = @ H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 P a g e H e a d e r = @ P a g e H e a d e r , 
 
 	 	 	 P a g e F o o t e r = @ P a g e F o o t e r , 
 
 	 	 	 U r l = @ U r l , 
 
 	 	 	 T h i s I s L i n k = @ T h i s I s L i n k 
 
 
 
 	 	 W H E R E   M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   A N D   C u l t u r e = @ C u l t u r e 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = mR  M a i n D i r e c t o r y C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . M a i n D i r e c t o r y C o n t e n t   
 
 
 
 	 	 ( 
 
 	 	 	 M a i n D i r e c t o r y I D , 
 
 	 	 	 C u l t u r e , 
 
 	 	 	 T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] , 
 
 	 	 	 H i d d e n , 
 
 	 	 	 H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 P a g e H e a d e r , 
 
 	 	 	 P a g e F o o t e r , 
 
 	 	 	 U r l , 
 
 	 	 	 T h i s I s L i n k 
 
 	 	 ) 
 
 
 
 	 	 V A L U E S 
 
 
 
 	 	 ( 
 
 	 	 	 @ M a i n D i r e c t o r y I D , 
 
 	 	 	 @ C u l t u r e , 
 
 	 	 	 @ T i t l e , 
 
 	 	 	 @ D e s c r i p t i o n , 
 
 	 	 	 @ H i d d e n , 
 
 	 	 	 @ H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 @ P a g e H e a d e r , 
 
 	 	 	 @ P a g e F o o t e r , 
 
 	 	 	 @ U r l , 
 
 	 	 	 @ T h i s I s L i n k 
 
 	 	 ) 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = TevQ  O v e r v i e w   S u b D i r e c t o r y C o n t e n t   ~b  T i t l e   T  D e s c r i p t i o n   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ O v e r v i e w S u b D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w S u b D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w S u b D i r e c t o r y ( @ M a i n D i r e c t o r y I D ) 
 
 
 
 U P D A T E   d b o . S u b D i r e c t o r y C o n t e n t   S E T   [ T i t l e ] = @ T i t l e ,   [ D e s c r i p t i o n ] = @ D e s c r i p t i o n   W H E R E   S u b D i r e c t o r y I D = @ O v e r v i e w S u b D i r e c t o r y I D   A N D   [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = TevQ  O v e r v i e w   P a g e D i r e c t o r y C o n t e n t   ~b  T i t l e   T  D e s c r i p t i o n   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ O v e r v i e w P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' M a i n D i r e c t o r y ' , @ M a i n D i r e c t o r y I D ) 
 
 
 
 U P D A T E   d b o . P a g e D i r e c t o r y C o n t e n t   S E T   [ T i t l e ] = @ T i t l e ,   [ D e s c r i p t i o n ] = @ D e s c r i p t i o n   W H E R E   P a g e D i r e c t o r y I D = @ O v e r v i e w P a g e D i r e c t o r y I D   A N D   [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M a i n D i r e c t o r y C o n t e n t M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y C o n t e n t M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y C o n t e n t M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y C o n t e n t M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  S u b D i r e c t o r y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y C o n t e n t M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S u b D i r e c t o r y I D   i n t , 	 	 	 - - S_MR  S u b D i r e c t o r y   v  I D 
 
 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  S u b D i r e c t o r y   C o n t e n t   vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 - - S_MR  S u b D i r e c t o r y   C o n t e n t   vc
 
 @ W i z a r d P r e v i o u s T i t l e   n v a r c h a r ( 2 0 0 ) , 	 - - S_MR  S u b D i r e c t o r y   v  W i z a r d   ^\'`:N  t r u e   veP  S u b D i r e c t o r y   Nv  P a g e D i r e c t o r y   Q[vTbR Nk  W i z a r d   [*ُ̑/f[*-N   P r e v i o u s    cvh~{eW[
 
 @ W i z a r d N e x t T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  S u b D i r e c t o r y   v  W i z a r d   ^\'`:N  t r u e   veP  S u b D i r e c t o r y   Nv  P a g e D i r e c t o r y   Q[vTbR Nk  W i z a r d   [*ُ̑/f[*-N  " N e x t "   cvh~{eW[
 
 @ H i d d e n   b i t , 	 	 	 	 - - MRMR  S u b D i r e c t o r y   C o n t e n t   /f&Tυ
 
 @ H i d d e n I n N a v i g a t i o n O n l y   b i t , 	 	 - - ُyυ/f&TSPN(W[*-Nυ(Wُy`b_υvQ[_(ubcvePN6qO>f:yFO
NOQs(W[*-N	
 
 
 
 @ P a g e H e a d e r   n t e x t , 	 	 	 - - S_MR  S u b D i r e c t o r y   ~v  P a g e H e a d e r   \TN~b	
 
 @ P a g e F o o t e r   n t e x t , 	 	 	 - - S_MR  S u b D i r e c t o r y   ~v  P a g e F o o t e r   \TN~b	
 
 
 
 @ U r l   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - S_MR  S u b D i r e c t o r y   C o n t e n t   v  U r l   W[&{2N
 
 @ T h i s I s L i n k   b i t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   C o n t e n t   v  T h i s I s L i n k   F l a g 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 - - S_MR  S u b D i r e c t o r y   C o n t e n t   veS
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  @ S u b D i r e c t o r y I D   S_MR  @ C u l t u r e   Nv  S u b D i r e c t o r y C o n t e n t   U_X[(WRO9eKN&TRmRKN  V:N N*NzpS(WTegmReveS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y C o n t e n t   W h e r e   S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   A n d   C u l t u r e = @ C u l t u r e ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O9e  S u b D i r e c t o r y C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . S u b D i r e c t o r y C o n t e n t   S E T 
 
 
 
 	 	 	 T i t l e = @ T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] = @ D e s c r i p t i o n , 
 
 	 	 	 W i z a r d P r e v i o u s T i t l e = @ W i z a r d P r e v i o u s T i t l e , 
 
 	 	 	 W i z a r d N e x t T i t l e = @ W i z a r d N e x t T i t l e , 
 
 	 	 	 H i d d e n = @ H i d d e n , 
 
 	 	 	 H i d d e n I n N a v i g a t i o n O n l y = @ H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 P a g e H e a d e r = @ P a g e H e a d e r , 
 
 	 	 	 P a g e F o o t e r = @ P a g e F o o t e r , 
 
 	 	 	 U r l = @ U r l , 
 
 	 	 	 T h i s I s L i n k = @ T h i s I s L i n k 
 
 
 
 	 	 W H E R E   S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   A N D   C u l t u r e = @ C u l t u r e 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = mR  S u b D i r e c t o r y C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . S u b D i r e c t o r y C o n t e n t   
 
 
 
 	 	 ( 
 
 	 	 	 S u b D i r e c t o r y I D , 
 
 	 	 	 C u l t u r e , 
 
 	 	 	 T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] , 
 
 	 	 	 W i z a r d P r e v i o u s T i t l e , 
 
 	 	 	 W i z a r d N e x t T i t l e , 
 
 	 	 	 H i d d e n , 
 
 	 	 	 H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 P a g e H e a d e r , 
 
 	 	 	 P a g e F o o t e r , 
 
 	 	 	 U r l , 
 
 	 	 	 T h i s I s L i n k 
 
 	 	 ) 
 
 
 
 	 	 V A L U E S 
 
 
 
 	 	 ( 
 
 	 	 	 @ S u b D i r e c t o r y I D , 
 
 	 	 	 @ C u l t u r e , 
 
 	 	 	 @ T i t l e , 
 
 	 	 	 @ D e s c r i p t i o n , 
 
 	 	 	 @ W i z a r d P r e v i o u s T i t l e , 
 
 	 	 	 @ W i z a r d N e x t T i t l e , 
 
 	 	 	 @ H i d d e n , 
 
 	 	 	 @ H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 @ P a g e H e a d e r , 
 
 	 	 	 @ P a g e F o o t e r , 
 
 	 	 	 @ U r l , 
 
 	 	 	 @ T h i s I s L i n k 
 
 	 	 ) 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = TevQ  O v e r v i e w   P a g e D i r e c t o r y C o n t e n t   ~b  T i t l e   T  D e s c r i p t i o n   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ O v e r v i e w P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D ) 
 
 
 
 U P D A T E   d b o . P a g e D i r e c t o r y C o n t e n t   S E T   [ T i t l e ] = @ T i t l e ,   [ D e s c r i p t i o n ] = @ D e s c r i p t i o n   W H E R E   P a g e D i r e c t o r y I D = @ O v e r v i e w P a g e D i r e c t o r y I D   A N D   [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y C o n t e n t M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y C o n t e n t M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  P a g e D i r e c t o r y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y C o n t e n t M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y I D   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  I D 
 
 
 
 @ S e o T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  S e o T i t l e 
 
 @ S e o D e s c r i p t i o n   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  S e o D e s c r i p t i o n 
 
 @ S e o K e y w o r d s   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  S e o K e y w o r d s 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   vc
 
 @ T e m p l a t e   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  T e m p l a t e 
 
 @ H i d d e n   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   /f&Tυ
 
 @ H i d d e n I n N a v i g a t i o n O n l y   b i t , 	 	 - - ُyυ/f&TSPN(W[*-Nυ(Wُy`b_υvQ[_(ubcvePN6qO>f:yFO
NOQs(W[*-N	
 
 @ P a g e H e a d e r   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  P a g e H e a d e r   R
 
 @ P a g e F o o t e r   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  P a g e F o o t e r   R
 
 
 
 @ U r l   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  U r l   W[&{2N
 
 @ T h i s I s L i n k   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  T h i s I s L i n k   F l a g 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   veS
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' P a g e D i r e c t o r y ' , @ P a g e D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  @ P a g e D i r e c t o r y I D   S_MR  @ C u l t u r e   Nv  P a g e D i r e c t o r y C o n t e n t   U_X[(WRO9eKN&TRmRKN  V:N N*NzpS(WTegmReveS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y C o n t e n t   W h e r e   P a g e D i r e c t o r y I D = @ P a g e D i r e c t o r y I D   A n d   C u l t u r e = @ C u l t u r e ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O9e  P a g e D i r e c t o r y   C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . P a g e D i r e c t o r y C o n t e n t   S E T 
 
 
 
 	 	 	 S e o T i t l e = @ S e o T i t l e , 
 
 	 	 	 S e o D e s c r i p t i o n = @ S e o D e s c r i p t i o n , 
 
 	 	 	 S e o K e y w o r d s = @ S e o K e y w o r d s , 
 
 	 	 	 T i t l e = @ T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] = @ D e s c r i p t i o n , 
 
 	 	 	 T e m p l a t e = @ T e m p l a t e , 
 
 	 	 	 H i d d e n = @ H i d d e n , 
 
 	 	 	 H i d d e n I n N a v i g a t i o n O n l y = @ H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 P a g e H e a d e r = @ P a g e H e a d e r , 
 
 	 	 	 P a g e F o o t e r = @ P a g e F o o t e r , 
 
 	 	 	 U r l = @ U r l , 
 
 	 	 	 T h i s I s L i n k = @ T h i s I s L i n k 
 
 
 
 	 	 W H E R E   P a g e D i r e c t o r y I D = @ P a g e D i r e c t o r y I D   A N D   C u l t u r e = @ C u l t u r e 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = mR  P a g e D i r e c t o r y   C o n t e n t   U_
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . P a g e D i r e c t o r y C o n t e n t   
 
 
 
 	 	 ( 
 
 	 	 	 P a g e D i r e c t o r y I D , 
 
 	 	 	 C u l t u r e , 
 
 	 	 	 S e o T i t l e , 
 
 	 	 	 S e o D e s c r i p t i o n , 
 
 	 	 	 S e o K e y w o r d s , 
 
 	 	 	 T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] , 
 
 	 	 	 T e m p l a t e , 
 
 	 	 	 H i d d e n , 
 
 	 	 	 H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 P a g e H e a d e r , 
 
 	 	 	 P a g e F o o t e r , 
 
 	 	 	 U r l , 
 
 	 	 	 T h i s I s L i n k 
 
 	 	 ) 
 
 
 
 	 	 V A L U E S 
 
 
 
 	 	 ( 
 
 	 	 	 @ P a g e D i r e c t o r y I D , 
 
 	 	 	 @ C u l t u r e , 
 
 	 	 	 @ S e o T i t l e , 
 
 	 	 	 @ S e o D e s c r i p t i o n , 
 
 	 	 	 @ S e o K e y w o r d s , 
 
 	 	 	 @ T i t l e , 
 
 	 	 	 @ D e s c r i p t i o n , 
 
 	 	 	 @ T e m p l a t e , 
 
 	 	 	 @ H i d d e n , 
 
 	 	 	 @ H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 @ P a g e H e a d e r , 
 
 	 	 	 @ P a g e F o o t e r , 
 
 	 	 	 @ U r l , 
 
 	 	 	 @ T h i s I s L i n k 
 
 	 	 ) 
 
 	 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o n t e n t M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o n t e n t M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o n t e n t M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  K n o w l e d g e C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 1   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 3 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o n t e n t M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e I D   i n t , 	 	 	 - - S_MR  K n o w l e d g e   v  I D 
 
 
 
 - - @ T e m p l a t e   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  K n o w l e d g e C o n t e n t   O(uv  T e m p l a t e 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - S_MR  K n o w l e d g e C o n t e n t   vh
 
 - - @ T i t l e S h o w   n v a r c h a r ( 5 0 ) , 	 	 - - /f&T\h>f:y(Wcke-NkYZS[	
 
 @ C o n t e n t   n t e x t , 	 	 	 	 - - S_MR  K n o w l e d g e C o n t e n t   vQ[
 
 @ T a g   n v a r c h a r ( 5 0 0 ) , 	 	 	 - - S_MR  K n o w l e d g e C o n t e n t   vh~{
 
 @ H i d d e n   b i t , 	 	 	 	 - - /f&TυS_MR  C u l t u r e   NvQ[
 
 @ A b s t r a c t   n t e x t , 	 	 	 	 - - S_MR  K n o w l e d g e C o n t e n t   vQ[Xd(u(W _(u b Xd>f:y 	
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 - - S_MR  K n o w l e d g e C o n t e n t   veSNxY  z h - c n 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' K n o w l e d g e ' , @ K n o w l e d g e I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  @ K n o w l e d g e I D   S_MR  @ C u l t u r e   Nv  K n o w l e d g e C o n t e n t   U_X[(WRO9eKN&TRmRKN  V:N N*NzpS(WTegmReveS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . K n o w l e d g e C o n t e n t   W h e r e   K n o w l e d g e I D = @ K n o w l e d g e I D   A n d   C u l t u r e = @ C u l t u r e ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O9e  K n o w l e d g e C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   
 
 
 
 	 	 	 - - T e m p l a t e = @ T e m p l a t e , 
 
 	 	 	 T i t l e = @ T i t l e ,   
 
 	 	 	 - - T i t l e S h o w = @ T i t l e S h o w , 
 
 	 	 	 C o n t e n t = @ C o n t e n t , 
 
 	 	 	 T a g = @ T a g , 
 
 	 	 	 H i d d e n = @ H i d d e n , 
 
 	 	 	 A b s t r a c t = @ A b s t r a c t 
 
 
 
 	 	 W H E R E   K n o w l e d g e I D = @ K n o w l e d g e I D   A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc  @ K n o w l e d g e I D   T  @ C u l t u r e   ԏV  K n o w l e d g e C o n t e n t I D 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ K n o w l e d g e C o n t e n t I D   I N T 
 
 	 	 S E L E C T   @ K n o w l e d g e C o n t e n t I D = n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   n o w c   W H E R E   n o w c . K n o w l e d g e I D = @ K n o w l e d g e I D   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQ\  K n o w l e d g e T a g s   -NS_MR  K n o w l e d g e C o n t e n t I D   Nv  T a g    RdQReQev  T a g 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E L E T E   F R O M   d b o . K n o w l e d g e T a g s   W H E R E   K n o w l e d g e C o n t e n t I D = @ K n o w l e d g e C o n t e n t I D 
 
 	 	 I N S E R T   I N T O   d b o . K n o w l e d g e T a g s   ( K n o w l e d g e C o n t e n t I D , T a g )   S E L E C T   @ K n o w l e d g e C o n t e n t I D , E l e m e n t   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eN  K n o w l e d g e C o n t e n t 	
 
 	 	 - - = = ُ̑SN
NU_(W  K n o w l e d g e S a v e   -NSOs
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 3 ,   @ K n o w l e d g e C o n t e n t I D 
 
 
 
 	 E N D 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = A p p r o v e d   ؞<PYg  O p t i o n . K n o w l e d g e A p p r o v e = N ' t r u e '   fQ[ [ybȒُꁨR:N  0 &TR:N  1 	laV:N  [ V a l u e ]   vpenc{|W]~O9e:N  n t e x t   Vdkُ̑(WO(u  [ V a l u e ] = N ' t r u e '   agNveP_{HQ  C O N V E R T   b  N V A R C H A R   penc{|W	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ A p p r o v e d   I N T 
 
 	 	 
 
 	 	 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . [ O p t i o n ]   W h e r e   [ K e y ] = N ' K n o w l e d g e A p p r o v e '   A n d   C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , [ V a l u e ] ) = N ' t r u e ' ) 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ A p p r o v e d = 0 
 
 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ A p p r o v e d = 1 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = mR  K n o w l e d g e C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . K n o w l e d g e C o n t e n t   
 
 
 
 	 	 ( 
 
 	 	 	 K n o w l e d g e I D , 
 
 	 	 	 C u l t u r e , 
 
 	 	 	 - - T e m p l a t e , 
 
 	 	 	 T i t l e , 
 
 	 	 	 - - T i t l e S h o w , 
 
 	 	 	 C o n t e n t , 
 
 	 	 	 T a g , 
 
 	 	 	 H i d d e n , 
 
 	 	 	 A p p r o v e d , 
 
 	 	 	 A p p r o v e M e s s a g e , 
 
 	 	 	 A p p r o v e d B y , 
 
 	 	 	 A b s t r a c t 
 
 	 	 )   
 
 
 
 	 	 V A L U E S 
 
 
 
 	 	 ( 
 
 	 	 	 @ K n o w l e d g e I D , 
 
 	 	 	 @ C u l t u r e , 
 
 	 	 	 - - @ T e m p l a t e , 
 
 	 	 	 @ T i t l e ,   
 
 	 	 	 - - @ T i t l e S h o w , 
 
 	 	 	 @ C o n t e n t , 
 
 	 	 	 @ T a g , 
 
 	 	 	 @ H i d d e n , 
 
 	 	 	 @ A p p r o v e d , 
 
 	 	 	 N ' ' , 
 
 	 	 	 N ' ' , 
 
 	 	 	 @ A b s t r a c t 
 
 	 	 ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = zsSUcRROX[vagmo`v  I D 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ o N e w I D   I N T 
 
 	 	 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \  T a g   S/f ,     _vRh	ROX[(W  K n o w l e d g e T a g s   h
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . K n o w l e d g e T a g s ( K n o w l e d g e C o n t e n t I D , T a g )   S E L E C T   @ o N e w I D ,   E l e m e n t   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhmRN  K n o w l e d g e C o n t e n t   -     K n o w l e d g e C o n t e n t I D   =   @ o N e w I D 	
 
 	 	 - - = = ُ̑SN
NU_(W  K n o w l e d g e M o d i f y   -NSOs
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   6 ,   @ o N e w I D 
 
 	 	 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o n t e n t M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M a i n D i r e c t o r y C o n t e n t S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M a i n D i r e c t o r y C o n t e n t S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M a i n D i r e c t o r y C o n t e n t S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  M a i n D i r e c t o r y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M a i n D i r e c t o r y C o n t e n t S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ M a i n D i r e c t o r y I D   I N T , 	 	 	 - - S_MR  M a i n D i r e c t o r y   v  I D 
 
 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   vc
 
 @ H i d d e n   b i t , 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   /f&Tυ
 
 @ H i d d e n I n N a v i g a t i o n O n l y   b i t , 	 	 - - ُyυ/f&TSPN(W[*-Nυ(Wُy`b_υvQ[_(ubcvePN6qO>f:yFO
NOQs(W[*-N	
 
 
 
 @ P a g e H e a d e r   n t e x t , 	 	 	 - - S_MR  m a i n D i r e c t o r y C o n t e n t   ~v  P a g e H e a d e r   \TN~b	
 
 @ P a g e F o o t e r   n t e x t , 	 	 	 - - S_MR  m a i n D i r e c t o r y C o n t e n t   ~v  P a g e F o o t e r   \TN~b	
 
 
 
 @ U r l   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   v  U r l 
 
 @ T h i s I s L i n k   b i t , 	 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   v  T h i s I s L i n k 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - S_MR  M a i n D i r e c t o r y   C o n t e n t   veS
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg    ( K n o w l e d g e D i r e c t o r y = N ' '   R   A d m i n   b  C h i e f E d i t o r   CgP) 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  M a i n D i r e c t o r y C o n t e n t   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . M a i n D i r e c t o r y C o n t e n t ( M a i n D i r e c t o r y I D , C u l t u r e , T i t l e , [ D e s c r i p t i o n ] , H i d d e n , H i d d e n I n N a v i g a t i o n O n l y , P a g e H e a d e r , P a g e F o o t e r , U r l , T h i s I s L i n k )   V A L U E S ( @ M a i n D i r e c t o r y I D , @ C u l t u r e , @ T i t l e , @ D e s c r i p t i o n , @ H i d d e n , @ H i d d e n I n N a v i g a t i o n O n l y , @ P a g e H e a d e r , @ P a g e F o o t e r , @ U r l , @ T h i s I s L i n k ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = TevQ  O v e r v i e w   S u b D i r e c t o r y C o n t e n t   ~b  T i t l e   T  D e s c r i p t i o n   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ O v e r v i e w S u b D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w S u b D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w S u b D i r e c t o r y ( @ M a i n D i r e c t o r y I D ) 
 
 
 
 U P D A T E   d b o . S u b D i r e c t o r y C o n t e n t   S E T   [ T i t l e ] = @ T i t l e ,   [ D e s c r i p t i o n ] = @ D e s c r i p t i o n   W H E R E   S u b D i r e c t o r y I D = @ O v e r v i e w S u b D i r e c t o r y I D   A N D   [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = TevQ  O v e r v i e w   P a g e D i r e c t o r y C o n t e n t   ~b  T i t l e   T  D e s c r i p t i o n   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ O v e r v i e w P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' M a i n D i r e c t o r y ' , @ M a i n D i r e c t o r y I D ) 
 
 
 
 U P D A T E   d b o . P a g e D i r e c t o r y C o n t e n t   S E T   [ T i t l e ] = @ T i t l e ,   [ D e s c r i p t i o n ] = @ D e s c r i p t i o n   W H E R E   P a g e D i r e c t o r y I D = @ O v e r v i e w P a g e D i r e c t o r y I D   A N D   [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M a i n D i r e c t o r y C o n t e n t S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y C o n t e n t S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y C o n t e n t S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y C o n t e n t S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  S u b D i r e c t o r y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y C o n t e n t S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S u b D i r e c t o r y I D   i n t , 	 	 	 - - S_MR  S u b D i r e c t o r y     v  I D 
 
 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  S u b D i r e c t o r y   C o n t e n t   vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 - - S_MR  S u b D i r e c t o r y   C o n t e n t   vc
 
 @ W i z a r d P r e v i o u s T i t l e   n v a r c h a r ( 2 0 0 ) , 	 - - S_MR  S u b D i r e c t o r y   v  W i z a r d   ^\'`:N  t r u e   veP  S u b D i r e c t o r y   Nv  P a g e D i r e c t o r y   Q[vTbR Nk  W i z a r d   [*ُ̑/f[*-N   P r e v i o u s    cvh~{eW[
 
 @ W i z a r d N e x t T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  S u b D i r e c t o r y   v  W i z a r d   ^\'`:N  t r u e   veP  S u b D i r e c t o r y   Nv  P a g e D i r e c t o r y   Q[vTbR Nk  W i z a r d   [*ُ̑/f[*-N  " N e x t "   cvh~{eW[
 
 @ H i d d e n   b i t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   C o n t e n t   /f&Tυ
 
 @ H i d d e n I n N a v i g a t i o n O n l y   b i t , 	 	 - - ُyυ/f&TSPN(W[*-Nυ(Wُy`b_υvQ[_(ubcvePN6qO>f:yFO
NOQs(W[*-N	
 
 
 
 @ P a g e H e a d e r   n t e x t , 	 	 	 - - S_MR  S u b D i r e c t o r y   ~v  P a g e H e a d e r   \TN~b	
 
 @ P a g e F o o t e r   n t e x t , 	 	 	 - - S_MR  S u b D i r e c t o r y   ~v  P a g e F o o t e r   \TN~b	
 
 
 
 @ U r l   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - S_MR  S u b D i r e c t o r y C o n t e n t     v  U r l   W[&{2N
 
 @ T h i s I s L i n k   b i t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y C o n t e n t     v  T h i s I s L i n k   F l a g 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - S_MR  S u b D i r e c t o r y   C o n t e n t   veS
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ S u b D i r e c t o r y I D   S[^v  M a i n D i r e c t o r y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ M a i n D i r e c t o r y I D   I N T 
 
 S E L E C T   @ M a i n D i r e c t o r y I D = s d . M a i n D i r e c t o r y I D   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg vQ
N~CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' M a i n D i r e c t o r y ' , @ M a i n D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  S u b D i r e c t o r y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . S u b D i r e c t o r y C o n t e n t ( S u b D i r e c t o r y I D , C u l t u r e , T i t l e , [ D e s c r i p t i o n ] , W i z a r d P r e v i o u s T i t l e , W i z a r d N e x t T i t l e , H i d d e n , H i d d e n I n N a v i g a t i o n O n l y , P a g e H e a d e r , P a g e F o o t e r , U r l , T h i s I s L i n k )   V A L U E S ( @ S u b D i r e c t o r y I D , @ C u l t u r e , @ T i t l e , @ D e s c r i p t i o n , @ W i z a r d P r e v i o u s T i t l e , @ W i z a r d N e x t T i t l e , @ H i d d e n , @ H i d d e n I n N a v i g a t i o n O n l y , @ P a g e H e a d e r , @ P a g e F o o t e r , @ U r l , @ T h i s I s L i n k ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = TevQ  O v e r v i e w   P a g e D i r e c t o r y C o n t e n t   ~b  T i t l e   T  D e s c r i p t i o n   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ O v e r v i e w P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ O v e r v i e w P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D ) 
 
 
 
 U P D A T E   d b o . P a g e D i r e c t o r y C o n t e n t   S E T   [ T i t l e ] = @ T i t l e ,   [ D e s c r i p t i o n ] = @ D e s c r i p t i o n   W H E R E   P a g e D i r e c t o r y I D = @ O v e r v i e w P a g e D i r e c t o r y I D   A N D   [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y C o n t e n t S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y C o n t e n t S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  P a g e D i r e c t o r y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y C o n t e n t S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y I D   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y     v  I D 
 
 
 
 @ S e o T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  S e o T i t l e 
 
 @ S e o D e s c r i p t i o n   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  S e o D e s c r i p t i o n 
 
 @ S e o K e y w o r d s   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  S e o K e y w o r d s 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   vc
 
 @ T e m p l a t e   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  T e m p l a t e 
 
 @ H i d d e n   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   /f&Tυ
 
 @ H i d d e n I n N a v i g a t i o n O n l y   b i t , 	 	 - - ُyυ/f&TSPN(W[*-Nυ(Wُy`b_υvQ[_(ubcvePN6qO>f:yFO
NOQs(W[*-N	
 
 @ P a g e H e a d e r   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  H e a d e r   R
 
 @ P a g e F o o t e r   n t e x t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   v  F o o t e r   R
 
 
 
 @ U r l   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  U r l   W[&{2N
 
 @ T h i s I s L i n k   b i t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  T h i s I s L i n k   F l a g 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - S_MR  P a g e D i r e c t o r y   C o n t e n t   veS
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ P a g e D i r e c t o r y I D   _vQ[^v  S u b D i r e c t o r y I D   ُ̑   S u b D i r e c t o r y   CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ S u b D i r e c t o r y I D   I N T 
 
 S E L E C T   @ S u b D i r e c t o r y I D = p d . S u b D i r e c t o r y I D   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . [ I D ] = @ P a g e D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  P a g e D i r e c t o r y C o n t e n t   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . P a g e D i r e c t o r y C o n t e n t ( P a g e D i r e c t o r y I D , C u l t u r e , S e o T i t l e , S e o D e s c r i p t i o n , S e o K e y w o r d s , T i t l e , [ D e s c r i p t i o n ] , T e m p l a t e , H i d d e n , H i d d e n I n N a v i g a t i o n O n l y , P a g e H e a d e r , P a g e F o o t e r , U r l , T h i s I s L i n k )   V A L U E S ( @ P a g e D i r e c t o r y I D , @ C u l t u r e , @ S e o T i t l e , @ S e o D e s c r i p t i o n , @ S e o K e y w o r d s , @ T i t l e , @ D e s c r i p t i o n , @ T e m p l a t e , @ H i d d e n , @ H i d d e n I n N a v i g a t i o n O n l y , @ P a g e H e a d e r , @ P a g e F o o t e r , @ U r l , @ T h i s I s L i n k ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o n t e n t S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o n t e n t S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o n t e n t S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  K n o w l e d g e C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 3 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o n t e n t S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e I D   i n t , 	 	 	 - - S_MR  K n o w l e d g e   v  I D 
 
 
 
 - - @ T e m p l a t e   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  K n o w l e d g e C o n t e n t   O(uv  T e m p l a t e 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - S_MR  K n o w l e d g e   C o n t e n t   vh
 
 - - @ T i t l e S h o w   n v a r c h a r ( 5 0 ) , 	 	 - - h/f&T>f:y(Wcke-NkYZS[	
 
 @ C o n t e n t   n t e x t , 	 	 	 	 - - S_MR  K n o w l e d g e   C o n t e n t   vQ[
 
 @ T a g   n v a r c h a r ( 5 0 0 ) , 	 	 	 - - S_MR  K n o w l e d g e   C o n t e n t   vh~{
 
 @ H i d d e n   b i t , 	 	 	 	 - - /f&TυS_MR  C u l t u r e   NvQ[
 
 @ A b s t r a c t   n t e x t , 	 	 	 	 - - S_MR  K n o w l e d g e   C o n t e n t   vQ[Xd
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - S_MR  K n o w l e d g e   C o n t e n t   veS
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ K n o w l e d g e I D   _  P a g e D i r e c t o r y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ P a g e D i r e c t o r y I D = n o w . P a g e D i r e c t o r y I D   F R O M   d b o . K n o w l e d g e   n o w   W H E R E   n o w . [ I D ] = @ K n o w l e d g e I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' P a g e D i r e c t o r y ' , @ P a g e D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = A p p r o v e d   ؞<PYg  O p t i o n . K n o w l e d g e A p p r o v e = N ' t r u e '   fQ[ [ybȒُꁨR:N  0 &TR:N  1 	labN]~\  [ V a l u e ]   vpenc{|W9e:N  n t e x t VdkNbv  , V a l u e ] = N ' t r u e '   _{HQ(u  C O N V E R T ( N V A R C H A R ( 4 0 0 0 )   Yt  [ V a l u e ] 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ A p p r o v e d   I N T 
 
 	 	 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . [ O p t i o n ]   W h e r e   [ K e y ] = N ' K n o w l e d g e A p p r o v e '   A n d   C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , [ V a l u e ] ) = N ' t r u e ' ) 
 
 B E G I N 
 
 	 S E T   @ A p p r o v e d = 0 
 
 E N D 
 
 E L S E 
 
 B E G I N 
 
 	 S E T   @ A p p r o v e d = 1 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  K n o w l e d g e   C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - I N S E R T   I N T O   d b o . K n o w l e d g e C o n t e n t ( K n o w l e d g e I D , C u l t u r e , T e m p l a t e , T i t l e , T i t l e S h o w , C o n t e n t , T a g , H i d d e n ,   A p p r o v e d ,   A p p r o v e M e s s a g e ,   A p p r o v e d B y ,   A b s t r a c t )   V A L U E S ( @ K n o w l e d g e I D , @ C u l t u r e , @ T e m p l a t e , @ T i t l e , @ T i t l e S h o w , @ C o n t e n t , @ T a g , @ H i d d e n , @ A p p r o v e d , N ' ' , N ' ' , @ A b s t r a c t ) 
 
 I N S E R T   I N T O   d b o . K n o w l e d g e C o n t e n t ( K n o w l e d g e I D , C u l t u r e , T i t l e , C o n t e n t , T a g , H i d d e n , A p p r o v e d ,   A p p r o v e M e s s a g e ,   A p p r o v e d B y ,   A b s t r a c t )   V A L U E S ( @ K n o w l e d g e I D , @ C u l t u r e , @ T i t l e , @ C o n t e n t , @ T a g , @ H i d d e n , @ A p p r o v e d , N ' ' , N ' ' , @ A b s t r a c t ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  T a g   S/f ,     _vRh	ROX[(W  K n o w l e d g e T a g s   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . K n o w l e d g e T a g s ( K n o w l e d g e C o n t e n t I D , T a g )   S E L E C T   @ o N e w I D ,   E l e m e n t   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhmRN  K n o w l e d g e C o n t e n t   -     K n o w l e d g e C o n t e n t I D   =   @ o N e w I D 	
 
 - - = = ُ̑SN
NU_(W  K n o w l e d g e S a v e   -NSOs
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   6 ,   @ o N e w I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o n t e n t S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y C o n t e n t M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y C o n t e n t M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y C o n t e n t M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  C o m m u n i t y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y C o n t e n t M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C o m m u n i t y I D   i n t , 	 	 	 	 	 	 - - S_MR  C o m m u n i t y   v  I D 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   veSNxY  z h - c n 	
 
 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   vc
 
 @ H i d d e n   b i t , 	 	 	 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   /f&Tυ
 
 
 
 @ C o m m a n d T i t l e T a s k L i s t   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     S_MR;N   }TNh~{  
 
 @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     S_MR;N   }TNh~{vc
 
 @ C o m m a n d T i t l e A d d   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     e;N   }TNh~{  
 
 @ C o m m a n d T i t l e A d d D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     e;N   }TNh~{vc
 
 @ C o m m a n d T i t l e Q u e r y   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     d"}   }TNh~{  
 
 @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     d"}   }TNh~{vc
 
 
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   \eߍ4;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   ]	gߍ4;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   p^;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   |NS;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   ݏy;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   nv;N
 
 @ T o p i c C o m m a n d S e t E l i t e T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   n|NS
 
 @ T o p i c C o m m a n d S e t T a b o o T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   nݏy
 
 @ T o p i c C o m m a n d S e t S t i c k y T o p i c   n v a r c h a r ( 5 0 ) 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   nv
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  @ C o m m u n i t y I D   S_MR  @ C u l t u r e   Nv  C o m m u n i t y C o n t e n t   U_X[(WRO9eKN&TRmRKN  V:N N*NzpS(WTegmReveS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . C o m m u n i t y C o n t e n t   W h e r e   C o m m u n i t y I D = @ C o m m u n i t y I D   A n d   C u l t u r e = @ C u l t u r e ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O9e  C o m m u n i t y C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . C o m m u n i t y C o n t e n t   S E T   
 
 
 
 	 	 	 T i t l e = @ T i t l e ,   
 
 	 	 	 [ D e s c r i p t i o n ] = @ D e s c r i p t i o n , 
 
 	 	 	 H i d d e n = @ H i d d e n , 
 
 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t = @ C o m m a n d T i t l e T a s k L i s t , 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n = @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e A d d = @ C o m m a n d T i t l e A d d , 
 
 	 	 	 C o m m a n d T i t l e A d d D e s c r i p t i o n = @ C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y = @ C o m m a n d T i t l e Q u e r y , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n = @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 	 	 	 
 
 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t E l i t e T o p i c = @ T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t T a b o o T o p i c = @ T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t S t i c k y T o p i c = @ T o p i c C o m m a n d S e t S t i c k y T o p i c 	 	 	 
 
 
 
 	 	 W H E R E   C o m m u n i t y I D = @ C o m m u n i t y I D   A N D   C u l t u r e = @ C u l t u r e 
 
 	 E N D 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = mR  C o m m u n i t y C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . C o m m u n i t y C o n t e n t   
 
 
 
 	 	 ( 
 
 	 	 	 C o m m u n i t y I D , 
 
 
 
 	 	 	 C u l t u r e , 
 
 
 
 	 	 	 T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] , 
 
 	 	 	 H i d d e n , 
 
 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t , 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e A d d , 
 
 	 	 	 C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 	 	 )   
 
 
 
 	 	 V A L U E S 
 
 
 
 	 	 ( 
 
 	 	 	 @ C o m m u n i t y I D , 
 
 
 
 	 	 	 @ C u l t u r e , 
 
 
 
 	 	 	 @ T i t l e ,   
 
 	 	 	 @ D e s c r i p t i o n , 
 
 	 	 	 @ H i d d e n , 
 
 
 
 	 	 	 @ C o m m a n d T i t l e T a s k L i s t , 
 
 	 	 	 @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 	 	 @ C o m m a n d T i t l e A d d , 
 
 	 	 	 @ C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 	 	 @ C o m m a n d T i t l e Q u e r y , 
 
 	 	 	 @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 	 	 @ T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 	 	 @ T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 	 	 @ T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 	 	 ) 
 
 	 	 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y C o n t e n t M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y C o n t e n t S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y C o n t e n t S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y C o n t e n t S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  C o m m u n i t y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y C o n t e n t S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C o m m u n i t y I D   i n t , 	 	 	 	 	 	 - - S_MR  C o m m u n i t y   v  I D 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   veSNxY  z h - c n 	
 
 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   vc
 
 @ H i d d e n   b i t , 	 	 	 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v  H i d d e n   ^\'`
 
 
 
 @ C o m m a n d T i t l e T a s k L i s t   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     S_MR;N   }TNh~{  
 
 @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     S_MR;N   }TNh~{vc
 
 @ C o m m a n d T i t l e A d d   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     e;N   }TNh~{  
 
 @ C o m m a n d T i t l e A d d D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     e;N   }TNh~{vc
 
 @ C o m m a n d T i t l e Q u e r y   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     d"}   }TNh~{  
 
 @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v     d"}   }TNh~{vc
 
 
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   \eߍ4;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   ]	gߍ4;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   p^;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   |NS;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   ݏy;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   nv;N
 
 @ T o p i c C o m m a n d S e t E l i t e T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   n|NS
 
 @ T o p i c C o m m a n d S e t T a b o o T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   nݏy
 
 @ T o p i c C o m m a n d S e t S t i c k y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   nv
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  C o m m u n i t y C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . C o m m u n i t y C o n t e n t   
 
 
 
 ( 
 
 	 C o m m u n i t y I D , 
 
 
 
 	 C u l t u r e , 
 
 
 
 	 T i t l e , 
 
 	 [ D e s c r i p t i o n ] , 
 
 	 H i d d e n , 
 
 
 
 	 C o m m a n d T i t l e T a s k L i s t , 
 
 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 C o m m a n d T i t l e A d d , 
 
 	 C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 C o m m a n d T i t l e Q u e r y , 
 
 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 )   
 
 
 
 V A L U E S 
 
 
 
 ( 
 
 	 @ C o m m u n i t y I D , 
 
 
 
 	 @ C u l t u r e , 
 
 
 
 	 @ T i t l e ,   
 
 	 @ D e s c r i p t i o n , 
 
 	 @ H i d d e n , 
 
 
 
 	 @ C o m m a n d T i t l e T a s k L i s t , 
 
 	 @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 @ C o m m a n d T i t l e A d d , 
 
 	 @ C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 @ C o m m a n d T i t l e Q u e r y , 
 
 	 @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 @ T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 @ T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 @ T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 ) 
 
 	 	 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e s s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y C o n t e n t S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y C o n t e n t S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y C o n t e n t S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y C o n t e n t S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    C o m m u n i t y I t e m   ( C o m m u n i t y   I D )   _  C o m m u n i t y C o n t e n t   h-Nvc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y C o n t e n t S e l e c t 
 
 
 
 @ C o m m u n i t y I t e m   I N T 	 	 	 	 - - C o m m u n i t y   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 c o c . [ I D ]   A S   [ I D ] , 
 
 	 c o c . C o m m u n i t y I D   A S   C o m m u n i t y I D , 
 
 
 
 	 c o c . C u l t u r e   A S   C u l t u r e , 
 
 
 
 	 c o c . T i t l e   A S   T i t l e , 
 
 	 c o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 c o c . H i d d e n   A S   H i d d e n , 
 
 
 
 	 c o c . C o m m a n d T i t l e T a s k L i s t   A S   C o m m a n d T i t l e T a s k L i s t , 
 
 	 c o c . C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n     A S   C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 c o c . C o m m a n d T i t l e A d d   A S   C o m m a n d T i t l e A d d , 
 
 	 c o c . C o m m a n d T i t l e A d d D e s c r i p t i o n   A S   C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 c o c . C o m m a n d T i t l e Q u e r y   A S   C o m m a n d T i t l e Q u e r y , 
 
 	 c o c . C o m m a n d T i t l e Q u e r y D e s c r i p t i o n   A S   C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 c o c . T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 c o c . T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c     A S   T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 c o c . T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 c o c . T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 c o c . T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 c o c . T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 c o c . T o p i c C o m m a n d S e t E l i t e T o p i c   A S   T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 c o c . T o p i c C o m m a n d S e t T a b o o T o p i c     A S   T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 c o c . T o p i c C o m m a n d S e t S t i c k y T o p i c   A S   T o p i c C o m m a n d S e t S t i c k y T o p i c , 
 
 
 
 	 c o c . T i t l e   A S   A c t i o n I n d i c a t o r T i t l e 
 
 
 
 F R O M   d b o . C o m m u n i t y C o n t e n t   c o c 
 
 
 
 W H E R E   C o m m u n i t y I D = @ C o m m u n i t y I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y C o n t e n t S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o r u m C o n t e n t M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o r u m C o n t e n t M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o r u m C o n t e n t M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  F o r u m C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o r u m C o n t e n t M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o r u m I D   i n t , 	 	 	 	 	 	 	 - - S_MR  F o r u m   v  I D 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MR  F o r u m C o n t e n t   veSNxY  z h - c n 	
 
 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 	 	 - - S_MR  F o r u m C o n t e n t   vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 	 	 - - S_MR  F o r u m C o n t e n t   vc
 
 @ H i d d e n   b i t , 	 	 	 	 	 	 	 - - S_MR  F o r u m C o n t e n t   v  " H i d d e n "   ^\'`
 
 
 
 @ C o m m a n d T i t l e T a s k L i s t   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  F o r u m C o n t e n t   v     S_MR;N   }TNh~{  
 
 @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  F o r u m C o n t e n t   v     S_MR;N   }TNh~{vc
 
 @ C o m m a n d T i t l e A d d   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  F o r u m C o n t e n t   v     e;N   }TNh~{  
 
 @ C o m m a n d T i t l e A d d D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  F o r u m C o n t e n t   v     e;N   }TNh~{vc
 
 @ C o m m a n d T i t l e Q u e r y   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  F o r u m C o n t e n t   v     d"}   }TNh~{  
 
 @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  F o r u m C o n t e n t   v     d"}   }TNh~{vc
 
 
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   \eߍ4;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   ]	gߍ4;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   p^;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   |NS;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   ݏy;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   nv;N
 
 @ T o p i c C o m m a n d S e t E l i t e T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   n|NS
 
 @ T o p i c C o m m a n d S e t T a b o o T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   nݏy
 
 @ T o p i c C o m m a n d S e t S t i c k y T o p i c   n v a r c h a r ( 5 0 ) 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   nv
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  @ F o r u m I D   S_MR  @ C u l t u r e   Nv  F o r u m C o n t e n t   U_X[(WRO9eKN&TRmRKN  V:N N*NzpS(WTegmReveS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . F o r u m C o n t e n t   W h e r e   F o r u m I D = @ F o r u m I D   A n d   C u l t u r e = @ C u l t u r e ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O9e  F o r u m C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . F o r u m C o n t e n t   S E T   
 
 
 
 	 	 	 T i t l e = @ T i t l e ,   
 
 	 	 	 [ D e s c r i p t i o n ] = @ D e s c r i p t i o n , 
 
 	 	 	 H i d d e n = @ H i d d e n , 
 
 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t = @ C o m m a n d T i t l e T a s k L i s t , 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n = @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e A d d = @ C o m m a n d T i t l e A d d , 
 
 	 	 	 C o m m a n d T i t l e A d d D e s c r i p t i o n = @ C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y = @ C o m m a n d T i t l e Q u e r y , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n = @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c = @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t E l i t e T o p i c = @ T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t T a b o o T o p i c = @ T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t S t i c k y T o p i c = @ T o p i c C o m m a n d S e t S t i c k y T o p i c 	 	 
 
 
 
 	 	 W H E R E   F o r u m I D = @ F o r u m I D   A N D   C u l t u r e = @ C u l t u r e 
 
 	 E N D 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = mR  F o r u m C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . F o r u m C o n t e n t   
 
 
 
 	 	 ( 
 
 	 	 	 F o r u m I D , 
 
 
 
 	 	 	 C u l t u r e , 
 
 
 
 	 	 	 T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] , 
 
 	 	 	 H i d d e n , 
 
 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t , 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e A d d , 
 
 	 	 	 C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 	 	 )   
 
 
 
 	 	 V A L U E S 
 
 
 
 	 	 ( 
 
 	 	 	 @ F o r u m I D , 
 
 
 
 	 	 	 @ C u l t u r e , 
 
 
 
 	 	 	 @ T i t l e ,   
 
 	 	 	 @ D e s c r i p t i o n , 
 
 	 	 	 @ H i d d e n , 
 
 
 
 	 	 	 @ C o m m a n d T i t l e T a s k L i s t , 
 
 	 	 	 @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 	 	 @ C o m m a n d T i t l e A d d , 
 
 	 	 	 @ C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 	 	 @ C o m m a n d T i t l e Q u e r y , 
 
 	 	 	 @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 	 	 @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 	 	 @ T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 	 	 @ T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 	 	 @ T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 	 	 ) 
 
 	 	 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o r u m C o n t e n t M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o r u m C o n t e n t S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o r u m C o n t e n t S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o r u m C o n t e n t S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  F o r u m C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o r u m C o n t e n t S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o r u m I D   i n t , 	 	 	 	 	 	 	 - - S_MR  F o r u m   v  I D 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MR  F o r u m C o n t e n t   veSNxY  z h - c n 	
 
 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 	 	 - - S_MR  F o r u m C o n t e n t   vh
 
 @ D e s c r i p t i o n   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 	 	 - - S_MR  F o r u m C o n t e n t   vc
 
 @ H i d d e n   b i t , 	 	 	 	 	 	 	 - - S_MR  F o r u m C o n t e n t   v     H i d e n    ^\'`  
 
 
 
 @ C o m m a n d T i t l e T a s k L i s t   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  F o r u m C o n t e n t   v     S_MR;N   }TNh~{  
 
 @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 - - S_MR  F o r u m C o n t e n t   v     S_MR;N   }TNh~{vc
 
 @ C o m m a n d T i t l e A d d   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  F o r u m C o n t e n t   v     e;N   }TNh~{  
 
 @ C o m m a n d T i t l e A d d D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  F o r u m C o n t e n t   v     e;N   }TNh~{vc
 
 @ C o m m a n d T i t l e Q u e r y   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MR  F o r u m C o n t e n t   v     d"}   }TNh~{  
 
 @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  F o r u m C o n t e n t   v     d"}   }TNh~{vc
 
 
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   \eߍ4;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   ]	gߍ4;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   p^;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   |NS;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   ݏy;N
 
 @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;Nr`  -   nv;N
 
 @ T o p i c C o m m a n d S e t E l i t e T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   n|NS
 
 @ T o p i c C o m m a n d S e t T a b o o T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   nݏy
 
 @ T o p i c C o m m a n d S e t S t i c k y T o p i c   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y C o n t e n t   v      ;N}TN  -   nv
 
 
 
 @ o N e w I D   i n t   O U T       	 	 	 	 	 	 - - eU_v  I D   QSpe    
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  F o r u m C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . F o r u m C o n t e n t   
 
 
 
 ( 
 
 	 F o r u m I D , 
 
 
 
 	 C u l t u r e , 
 
 
 
 	 T i t l e , 
 
 	 [ D e s c r i p t i o n ] , 
 
 	 H i d d e n , 
 
 
 
 	 C o m m a n d T i t l e T a s k L i s t , 
 
 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 C o m m a n d T i t l e A d d , 
 
 	 C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 C o m m a n d T i t l e Q u e r y , 
 
 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 )   
 
 
 
 V A L U E S 
 
 
 
 ( 
 
 	 @ F o r u m I D , 
 
 
 
 	 @ C u l t u r e , 
 
 
 
 	 @ T i t l e ,   
 
 	 @ D e s c r i p t i o n , 
 
 	 @ H i d d e n , 
 
 
 
 	 @ C o m m a n d T i t l e T a s k L i s t , 
 
 	 @ C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 @ C o m m a n d T i t l e A d d , 
 
 	 @ C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 @ C o m m a n d T i t l e Q u e r y , 
 
 	 @ C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 @ T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 @ T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 @ T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 @ T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 ) 
 
 	 	 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z     
 
     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = zsSUcRROX[vagmo`v  I D     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	    
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o r u m C o n t e n t S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o r u m C o n t e n t S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o r u m C o n t e n t S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o r u m C o n t e n t S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    F o r u m I t e m   ( F o r u m   I D )   _  F o r u m C o n t e n t   h-Nvc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o r u m C o n t e n t S e l e c t 
 
 
 
 @ F o r u m I t e m   I N T 	 	 	 	 - - F o r u m   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 f o c . [ I D ]   A S   [ I D ] , 
 
 	 f o c . F o r u m I D   A S   F o r u m I D , 
 
 
 
 	 f o c . C u l t u r e   A S   C u l t u r e , 
 
 
 
 	 f o c . T i t l e   A S   T i t l e , 
 
 	 f o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 f o c . H i d d e n   A S   H i d d e n , 
 
 
 
 	 f o c . C o m m a n d T i t l e T a s k L i s t   A S   C o m m a n d T i t l e T a s k L i s t , 
 
 	 f o c . C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n   A S   C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 f o c . C o m m a n d T i t l e A d d   A S   C o m m a n d T i t l e A d d , 
 
 	 f o c . C o m m a n d T i t l e A d d D e s c r i p t i o n   A S   C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 f o c . C o m m a n d T i t l e Q u e r y   A S   C o m m a n d T i t l e Q u e r y , 
 
 	 f o c . C o m m a n d T i t l e Q u e r y D e s c r i p t i o n   A S   C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 f o c . T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 f o c . T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c     A S   T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 f o c . T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 f o c . T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 f o c . T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 f o c . T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c   A S   T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 f o c . T o p i c C o m m a n d S e t E l i t e T o p i c   A S   T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 f o c . T o p i c C o m m a n d S e t T a b o o T o p i c     A S   T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 f o c . T o p i c C o m m a n d S e t S t i c k y T o p i c   A S   T o p i c C o m m a n d S e t S t i c k y T o p i c , 
 
 
 
 	 c o c . T i t l e   +   N '   /   '   +   f o c . T i t l e   A S   A c t i o n I n d i c a t o r T i t l e 
 
 
 
 
 
 F R O M   d b o . F o r u m C o n t e n t   f o c 
 
 L E F T   J O I N   d b o . F o r u m   f o   O N   f o . [ I D ] = f o c . F o r u m I D 
 
 L E F T   J O I N   d b o . C o m m u n i t y   c o   O N   c o . [ I D ] = f o . C o m m u n i t y I D 
 
 L E F T   J O I N   d b o . C o m m u n i t y C o n t e n t   c o c   O N   c o . [ I D ] = c o c . C o m m u n i t y I D   A N D   c o c . C u l t u r e = f o c . C u l t u r e 
 
 
 
 W H E R E   F o r u m I D = @ F o r u m I t e m 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o r u m C o n t e n t S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o r u m L i s t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o r u m L i s t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o r u m L i s t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV@b	g  F o r u m   -NvyvNO|~9hncُ*Nh:NS_MR(u7bRM  F o r u m     vQCgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o r u m L i s t 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 - - \ԏV  F o r u m   Rhec[veS
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b  F o r u m   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   
 
 	 f o . [ I D ]   A S   [ I D ] , 
 
 	 f o . C o m m u n i t y I D   A S     C o m m u n i t y I D , 
 
 	 f o . S e r i a l   A S   S e r i a l , 
 
 	 f o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 f o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 I S N U L L ( f o . [ P u b l i c ] , N ' t r u e ' )   A S   [ P u b l i c ] , 
 
 
 
 	 f o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 f o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 f o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 
 
 	 f o c . C u l t u r e   A S   C u l t u r e , 
 
 	 c o c . T i t l e   +   N '   /   '   +   f o c . T i t l e   A S   T i t l e , 
 
 	 f o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 I S N U L L ( f o c . H i d d e n , 0 )   A S   H i d d e n 
 
 
 
 
 
 F R O M   d b o . F o r u m   f o 
 
 L E F T   J O I N   d b o . F o r u m C o n t e n t   f o c   O N   f o c . F o r u m I D = f o . [ I D ] 
 
 L E F T   J O I N   d b o . C o m m u n i t y   c o   O N   c o . [ I D ] = f o . C o m m u n i t y I D 
 
 L E F T   J O I N   d b o . C o m m u n i t y C o n t e n t   c o c   O N   c o c . C o m m u n i t y I D = c o . [ I D ] 
 
 
 
 W H E R E   f o c . C u l t u r e = @ C u l t u r e   A N D   c o c . C u l t u r e = @ C u l t u r e 
 
 
 
 O R D E R   B Y   f o . C o m m u n i t y I D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o r u m L i s t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r F o r u m s S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r F o r u m s S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r F o r u m s S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  U s e r F o r u m s   hԏVS_MR(u7b(W
NT  F o r u m   
NvCgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0     C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 6 - 0 5 - 2 9   
 
 - - = =   S P   f\PO(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r F o r u m s S e l e c t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) 	 	 	 	 - - c[(u7b
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b  U s e r F o r u m s   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   
 
 	 u f . [ I D ]   A S   [ I D ] , 
 
 	 u f . [ U s e r ]   A S     [ U s e r ] , 
 
 	 u f . F o r u m   A S   F o r u m , 
 
 	 u f . R e a d E n a b l e d   A S   R e a d E n a b l e d , 
 
 	 u f . T o p i c W r i t e E n a b l e d   A S   T o p i c W r i t e E n a b l e d , 
 
 	 u f . F o l l o w U p W r i t e E n a b l e d   A S   F o l l o w U p W r i t e E n a b l e d 
 
 
 
 F R O M   d b o . U s e r F o r u m s   u f 
 
 
 
 W H E R E   u f . [ U s e r ] = @ U s e r 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r F o r u m s S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r F o r u m s S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r F o r u m s S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r F o r u m s S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  U s e r F o r u m s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = =   S P   f\PO(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r F o r u m s S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ U s e r N a m e   n v a r c h a r ( 5 0 ) , 	 	 - - S_MR  (u7b  v
TW[
 
 @ F o r u m   i n t , 	 	 	 	 - - S_MR  F o r u m   v  I D 
 
 @ R e a d E n a b l e d   i n t , 	 	 	 - - S
 
 @ T o p i c W r i t e E n a b l e d   i n t , 	 	 	 - - SS4
 
 @ F o l l o w U p W r i t e E n a b l e d   i n t 	 	 - - Sߍ^
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  
 
 - - = = la(W(u7bO9e!j_bN]~(W  S P   U s e r A c c o u n t S a v e   -N RdN(u7b(W  U s e r F o r u m s   -NvX[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . U s e r F o r u m s ( [ U s e r ] , F o r u m , R e a d E n a b l e d , T o p i c W r i t e E n a b l e d , F o l l o w U p W r i t e E n a b l e d )   V A L U E S ( @ U s e r N a m e , @ F o r u m , @ R e a d E n a b l e d , @ T o p i c W r i t e E n a b l e d , @ F o l l o w U p W r i t e E n a b l e d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r F o r u m s S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c U s e r A u t h e n t i c a t i o n S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b(Wc[  F o r u m   -N/f&TSNS^
 
 - - = = 	gNN`b_NKN NvF o r u m   /fSNS4v        
 
 - - = =   F o r u m   NSvQ
N~  C o m m u n i t y   v  T o p i c W r i t e P e r m i s s i o n   :Nzz        
 
 - - = =   F o r u m   bvQ
N~  C o m m u n i t y   nN  P u b l i c   ^\'`        
 
 - - = = S_MR(u7b/f  A d m i n         
 
 - - = = S_MR(u7b/f  F o r u m   v  M o d e r a t o r         
 
 - - = = S_MR(u7b=(W  F o r u m   bvQ
N~  C o m m u n i t y   v  T o p i c W r i t e P e r m i s s i o n   nUS-N        
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c U s e r A u t h e n t i c a t i o n S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o r u m   I N T , 	 	 	 - - c[  F o r u m 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgCgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ F o r u m T o p i c W r i t a b l e ( @ U s e r , @ F o r u m ) = 0 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' _bIk`*gcCg(WS_MR[WS40< b r / > HQlQbT||~{tXTSHr;NSv^CgP0< b r / > ""0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 
 
 / * 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7bl	glQ:N  C o m m u n i t y (u7bR>Nv^ Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( d b o . U D F _ U s e r C o m m u n i t y ( @ U s e r ) < > 1 )     A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 ) 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' W e   a r e   s o r r y ,   b u t   y o u   a r e   n o t   r e g i s t e r e d   C o m m u n i t y   U s e r .   O n l y   r e g i s t e r e d   C o m m u n i t y   U s e r s   h a v e   r i g h t s   t o   p o s t   t o p i c s . < B R > P l e a s e   c l i c k   t h e   S i g n   u p   l i n k   o n   o u r   s i t e   t o   g e t   r g i s t e r e d   a s   C o m m u n i t y   U s e r . < B R > T h a n k   y o u . ' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7b/f  C o m m u n i t y FO(W  U s e r F o r u m s   -N  [,g  F o r u m   Mnv  T o p i c W r i t e E n a b l e d   CgP
N/f  1 R>Nv^ Q  f(u7bl	g[  F o r u m   S^CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( N O T   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . U s e r F o r u m s   W h e r e   [ U s e r ] = @ U s e r   A n d   F o r u m = @ F o r u m   A n d   T o p i c W r i t e E n a b l e d = 1 ) )   A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 ) 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' W e   a r e   s o r r y ,   b u t   y o u   a r e   n o t   a u t h o r i z e d   t o   p o s t   t o p i c   t o   c u r r e n t   F o r u m .   < B R > P l e a s e   c o n t a c t   o u r   s y s t e m   a d m i n i s t r a t o r   t o   g r a n d   t h e   p e r m i s s i o n   t o   y o u .   < B R > T h a n k   y o u . ' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b(Wc[  T o p i c   @b(Wv  F o r u m   -N/f&TSN  ۏLߍ^
 
 - - = = 	gNN`b_NKN NvF o r u m   /fSNߍ4v    
 
 - - = =   F o r u m   NSvQ
N~  C o m m u n i t y   v  F o l l o w U p W r i t e P e r m i s s i o n   :Nzz    
 
 - - = =   F o r u m   bvQ
N~  C o m m u n i t y   nN  P u b l i c   ^\'`    
 
 - - = = S_MR(u7b/f  A d m i n     
 
 - - = = S_MR(u7b/f  F o r u m   v  M o d e r a t o r     
 
 - - = = S_MR(u7b=(W  F o r u m   bvQ
N~  C o m m u n i t y   v  F o l l o w U p W r i t e P e r m i s s i o n   nUS-N    
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c   I N T , 	 	 	 - - c[  T o p i c 
 
 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  T o p i c   I D   _  F o r u m   I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m   I N T 
 
 S E T   @ F o r u m = d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( @ T o p i c ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O(u  U D F _ F o r u m F o l l o w U p W r i t a b l e   QpehgS_MR(u7b[S_MR[W/f&T	gߍ4CgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ F o r u m F o l l o w U p W r i t a b l e ( @ U s e r , @ F o r u m ) = 0 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' _bIk`vMReCg(WS_MR[Wߍ40< b r / > T|zp{tXT_v^>y:SCgP0< b r / > ""0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 / * 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7bl	glQ:N  C o m m u n i t y (u7bNe^  A d m i n   S^  M o d e r a t o r 	R>Nv^ Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( d b o . U D F _ U s e r C o m m u n i t y ( @ U s e r ) < > 1 )     A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 )   A N D   ( d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m ) < > 1 ) 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' _bIk`
N/f>y:S(u7bS	g>y:S(u7bMbSNߍ40< b r / > pQ   lQ   	clQ:N>y:S(u7bbT|zp{tXT_>y:SCgP0< b r / > ""`0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7b/f  C o m m u n i t y FO
Nb	gS_MR  F o r u m   vߍ4CgPNS_MR  F o r u m   ^  P u b l i c TeS_MR(u7be^  A d m i n   S^  M o d e r a t o r 	R>Nv^ Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( N O T   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . U s e r F o r u m s   W h e r e   [ U s e r ] = @ U s e r   A n d   F o r u m = @ F o r u m   A n d   F o l l o w U p W r i t e E n a b l e d = 1 ) )   A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 )   A N D   ( d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m ) < > 1 ) 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' W e   a r e   s o r r y ,   b u t   y o u   a r e   n o t   a u t h o r i z e d   t o   p o s t   f o l l o w u p   t o   c u r r e n t   F o r u m .   < B R > P l e a s e   c o n t a c t   o u r   s y s t e m   a d m i n i s t r a t o r   t o   g r a n d   t h e   p e r m i s s i o n   t o   y o u .   < B R > T h a n k   y o u . ' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b(Wc[  T o p i c   b  F o l l o w U p   @b(Wv  F o r u m   -N/f&TSN  ۏL^P[Omȉ
 
 - - = = 	gNN`b_NKN NvF o r u m   /fSNOmȉv    
 
 - - = =   F o r u m   NSvQ
N~  C o m m u n i t y   v  R e a d P e r m i s s i o n   :Nzz    
 
 - - = =   F o r u m   bvQ
N~  C o m m u n i t y   nN  P u b l i c   ^\'`    
 
 - - = = S_MR(u7b/f  A d m i n     
 
 - - = = S_MR(u7b/f  F o r u m   v  M o d e r a t o r     
 
 - - = = S_MR(u7b=(W  F o r u m   bvQ
N~  C o m m u n i t y   v  R e a d P e r m i s s i o n   nUS-N    
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n S e l e c t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c   I N T , 	 	 	 - - c[  T o p i c 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  T o p i c   I D   _  F o r u m   I D   laُ̑  T o p i c   Yg/fckpeRNh  T o p i c   I D   Yg/fpeRvQ~[<PNh  F o l l o w U p   I D 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m   I N T 
 
 
 
 I F   @ T o p i c > = 0 
 
 
 
 	 B E G I N 
 
 	 	 S E T   @ F o r u m = d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( @ T o p i c ) 
 
 	 E N D 
 
 E L S E 
 
 	 B E G I N 
 
 	 	 S E T   @ F o r u m = d b o . U D F _ G e t F o r u m I D F r o m F o l l o w U p I D ( A B S ( @ T o p i c ) ) 
 
 	 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  U D F _ F o r u m R e a d a b l e   $ReS_MR(u7b[S_MR  F o r u m   /f&T	gCgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ F o r u m R e a d a b l e ( @ U s e r , @ F o r u m ) = 0 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' _bIk`eCgOmȉ,g[W0< b r / > T||~{tXTSv^CgP0  < b r / > ""0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 / * 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  F o r u m   
N/flQO  F o r u m   ( P u b l i c < > t r u e ) b(u7b(W  U s e r F o r u m s   -N  [,g  F o r u m   Mnv  R e a d E n a b l e d   CgP
N/f  1 N(u7be
N/f  A d m i n   _N
N/f  M o d e r a t o r R>Nv^ Q  f(u7bl	g[  F o r u m   OmȉCgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( N o t   E x i s t s   ( s e l e c t   [ I D ]   f r o m   d b o . F o r u m   w h e r e   [ I D ] = @ F o r u m   a n d   [ P u b l i c ] = N ' t r u e ' ) )   A N D   ( N o t   E x i s t s   ( s e l e c t   [ I D ]   f r o m   d b o . U s e r F o r u m s   w h e r e   [ U s e r ] = @ U s e r   a n d   F o r u m = @ F o r u m   a n d   R e a d E n a b l e d = 1 ) )   A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 )   A N D   ( d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m ) < > 1 ) 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' W e   a r e   s o r r y ,   b u t   y o u   a r e   n o t   a u t h o r i z e d   t o   a c c e s s   c u r r e n t   F o r u m .   < B R > P l e a s e   c o n t a c t   o u r   s y s t e m   a d m i n i s t r a t o r   t o   g r a n d   t h e   p e r m i s s i o n   t o   y o u .   < B R > T h a n k   y o u . ' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b(Wc[    F o r u m   -N/f&TSN  ۏL^P[Omȉ
 
 - - = = 	gNN`b_NKN NvF o r u m   /fSNOmȉv        
 
 - - = =   F o r u m   NSvQ
N~  C o m m u n i t y   v  R e a d P e r m i s s i o n   :Nzz        
 
 - - = =   F o r u m   bvQ
N~  C o m m u n i t y   nN  P u b l i c   ^\'`        
 
 - - = = S_MR(u7b/f  A d m i n         
 
 - - = = S_MR(u7b/f  F o r u m   v  M o d e r a t o r         
 
 - - = = S_MR(u7b=(W  F o r u m   bvQ
N~  C o m m u n i t y   v  R e a d P e r m i s s i o n   nUS-N        
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e l e c t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o r u m   I N T , 	 	 	 - - c[  F o r u m 
 
 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ F o r u m R e a d a b l e ( @ U s e r , @ F o r u m ) = 0 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' _bIk`*gcCg,g[W0< b r / > T||~{tXTbHr;N_v^CgP0< b r / > ""0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 / * 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR  F o r u m   
N/flQO  F o r u m   ( P u b l i c < > t r u e ) b(u7b(W  U s e r F o r u m s   -N  [,g  F o r u m   Mnv  R e a d E n a b l e d   CgP
N/f  1 N(u7be
N/f  A d m i n   _N
N/f  M o d e r a t o r R>Nv^ Q  f(u7bl	g[  F o r u m   OmȉCgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( N o t   E x i s t s   ( s e l e c t   [ I D ]   f r o m   d b o . F o r u m   w h e r e   [ I D ] = @ F o r u m   a n d   [ P u b l i c ] = N ' t r u e ' ) )   A N D   ( N o t   E x i s t s   ( s e l e c t   [ I D ]   f r o m   d b o . U s e r F o r u m s   w h e r e   [ U s e r ] = @ U s e r   a n d   F o r u m = @ F o r u m   a n d   R e a d E n a b l e d = 1 ) )   A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 )   A N D   ( d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m ) < > 1 ) 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' W e   a r e   s o r r y ,   b u t   y o u   a r e   n o t   a u t h o r i z e d   t o   a c c e s s   c u r r e n t   F o r u m .   < B R > P l e a s e   c o n t a c t   o u r   s y s t e m   a d m i n i s t r a t o r   t o   g r a n d   t h e   p e r m i s s i o n   t o   y o u .   < B R > T h a n k   y o u . ' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . H o m e P a g e N a m e G e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ H o m e P a g e N a m e G e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ H o m e P a g e N a m e G e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  P a g e D i r e c t o r y   h_  H o m e = t r u e   *NU_v  N a m e 
 
 - - = = (uNԏV|~ub܃US-NEQS_  H o m e   P a g e   v*Nuv
TW[  A c t i v e P a g e M e n u N a m e 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . H o m e P a g e N a m e G e t 
 
 
 
 @ H o m e P a g e N a m e   n v a r c h a r ( 1 0 0 )   O U T 	 	 - - ԏVSpe, H o m e   P a g e   uv
TW[  
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV  H o m e = 1   v*NU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   T O P   1 
 
 
 
 	 @ H o m e P a g e N a m e = p d . [ N a m e ]   
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y   p d 
 
 
 
 W H E R E   p d . H o m e = 1 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ H o m e P a g e N a m e G e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . O p t i o n S e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ O p t i o n S e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ O p t i o n S e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \~[v  O p t i o n   K e y     v  V a l u e   Q0Rpenc^
 
 - - = = (u(W  C o m m o n H e l p e r   -NOX[g*N|~Spe
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . O p t i o n S e t 
 
 
 
 @ K e y   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - c[  O p t i o n   
TW[
 
 @ V a l u e   n t e x t 	   	 	 	 	 - - ԏVv~g
 
 - - @ V a l u e   n v a r c h a r ( 3 0 0 0 )   	 	 	 - - ԏVv~g
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = fe
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n ]   S E T   V a l u e = @ V a l u e   W H E R E   [ K e y ] = @ K e y 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ O p t i o n S e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . O p t i o n S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ O p t i o n S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ O p t i o n S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S  O p t i o n   h@b	g  C a t   U_
 
 - - = = ~[  C u l t u r e   S  O p t i o n   h  ( ޏT  O p t i o n C o n t e n t )   -N@b	g  O p t i o n   v  K e y ,   V a l u e   <PNSvsQ  T i t l e ,   D e s c r i p t i o n 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . O p t i o n S e l e c t 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 )   	 	 	 - - S_MReS
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hS@b	g  C a t   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   D I S T I N C T   
 
 
 
 	 o p t . C a t   A S   C a t , 
 
 	 o p c . C a t T i t l e   A S   C a t T i t l e 
 
 
 
 F R O M   d b o . [ O p t i o n ]   o p t 
 
 L E F T   J O I N   d b o . O p t i o n C o n t e n t   o p c   O N   o p c . O p t i o n I D = o p t . [ I D ] 
 
 
 
 W H E R E   o p c . C u l t u r e = @ C u l t u r e 
 
 O R D E R   B Y   o p c . C a t T i t l e 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV@b	g  O p t i o n   U_J o i n   S_MReSNv  O p t i o n C o n t e n t   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   
 
 
 
 	 o p t . [ I D ]   A S   [ I D ] , 
 
 	 o p t . C a t   A S   C a t , 
 
 	 o p t . R i g h t I n d e n t   A S   R i g h t I n d e n t , 
 
 	 o p t . [ K e y ]   A S   [ K e y ] , 
 
 	 o p t . V a l u e   A S   V a l u e , 
 
 	 o p t . L e g e n d   A S   L e g e n d , 
 
 	 o p t . N u m b e r O n l y   A S   N u m b e r O n l y , 
 
 	 o p t . T e x t A r e a   A S   T e x t A r e a , 
 
 	 o p t . M u l t i C u l t u r e   A S   M u l t i C u l t u r e , 
 
 	 o p t . F o r T h e m e   A S   F o r T h e m e , 
 
 	 o p t . V a l i d a t i o n   A S   V a l i d a t i o n , 
 
 	 o p c . T i t l e   A S   T i t l e , 
 
 	 o p c . C a t T i t l e   A S   C a t T i t l e , 
 
 	 o p c . [ D e s c r i p t i o n ]   A s   [ D e s c r i p t i o n ] 
 
 
 
 F R O M   d b o . [ O p t i o n ]   o p t   
 
 L E F T   J O I N   d b o . O p t i o n C o n t e n t   o p c   O N   o p c . O p t i o n I D = o p t . [ I D ] 
 
 
 
 W H E R E   o p c . C u l t u r e = @ C u l t u r e 
 
 
 
 O R D E R   B Y   o p t . [ I D ] 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ O p t i o n S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . O p t i o n S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ O p t i o n S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ O p t i o n S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  O p t i o n   K e y   V a l u e   P a i r   0R  O p t i o n   h  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . O p t i o n S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K e y   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - S_MR  O p t i o n   v
TW[
 
 @ V a l u e   n t e x t , 	 	 	 	 - - S_MR  O p t i o n   v  V a l u e 
 
 - - @ V a l u e   n v a r c h a r ( 3 0 0 0 ) , 	 	 - - S_MR  O p t i o n   v  V a l u e 
 
 
 
 @ F o r T h e m e   n v a r c h a r ( 5 0 )   O U T 	 	 - - ԏVS_MR  K e y   /f&T  F o r T h e m e 
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n ]   S E T 
 
 
 
 	 V a l u e = @ V a l u e 
 
 
 
 W H E R E   [ K e y ] = @ K e y 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hncS_MR  K e y   /f&T  F o r T h e m e   ԏV  F o r T h e m e   Spe(W  A S P X   z  O p t i o n S a v e . c s   ̑Yg/f  F o r T h e m e   R ub NNLubCQ }T  C S S 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ F o r T h e m e = F o r T h e m e   F R O M   d b o . [ O p t i o n ]   W H E R E   [ K e y ] = @ K e y 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ O p t i o n S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y C l o n e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y C l o n e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y C l o n e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \ N*N  C o m m u n i t y   KQ0RSY N*NTeKQ  C o m m u n i t y   Nbv@b	g  F o r u m 
 
 - - = = kY:N[7b _/T
gRSveP募R^8^	g(uV:N N,eg
NT[7bv
gRSnW,g/f NvS O9e
NT[7b
TW[
 
 - - = = bN؞KQu_ُ7hvĉRKQv  C o m m u n i t y   T  e  C o m m u n i t y   KNv/U N:S+R/fN  I d e n t i t y   vfbc  ]wQNN(uN[7b
gRS  C o m m u n i t y   v
Y6R	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 2   
 
 - - = =   S P   \*g/T(ubN؏  N*N  M a i n D i r e c t o r y C l o n e   S P ُ$N*N  S P   vvv/fteSO
Y6R  C o m m u n i t y   ޏTvQ^\Nv  F o r u m 	teSO
Y6R  M a i n D i r e c t o r y   ޏTvQ^\Nv  S u b D i r e c t o r y ,   P a g e D i r e c t o r y ,   K n o w l e d g e 	0vMRv  < x x x > M o v e   _N	g{|<ORFO*gmS  C o m m u n i t y ,   M a i n D i r e c t o r y   ُ$N*N,{ N~B\b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y C l o n e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 @ C u r r e n t C o m m u n i t y I D   i n t , 	 	 	 	 - - S_MR  C o m m u n i t y   v  I D 
 
 @ C u r r e n t C o m m u n i t y I d e n t i t y   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR  C o m m u n i t y   vh_( kY[7b
TW[bN N,	cُ7hvĉR:N  C o m m u n i t y   vQ
TW[  m C o m m u n i t y < I d e n t i t y > ) 
 
 @ N e w C o m m u n i t y I d e n t i t y   n v a r c h a r ( 5 0 ) 	 	 	 - - e  C o m m u n i t y   vh_
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _S_MR  C o m m u n i t y   v
TW[
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r r e n t C o m m u n i t y N a m e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ C u r r e n t C o m m u n i t y N a m e = [ N a m e ]   F R O M   d b o . C o m m u n i t y   W H E R E   [ I D ] = @ C u r r e n t C o m m u n i t y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = c{e  C o m m u n i t y   v
TW[
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ N e w C o m m u n i t y N a m e   N V A R C H A R ( 5 0 ) 
 
 S E T   @ N e w C o m m u n i t y N a m e = R E P L A C E ( @ C u r r e n t C o m m u n i t y N a m e , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yge  C o m m u n i t y   ]~X[(WR>N
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . C o m m u n i t y   W h e r e   [ N a m e ] = @ N e w C o m m u n i t y N a m e ) 
 
 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' `sS\R^v>y:S]~X[(W0' , 1 6 , 1 )     
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _S_MR  C o m m u n i t y   v  S e r i a l ,   I n A c t i v e M a i n M e n u I c o n M a p ,   A c t i v e M a i n M e n u I c o n M a p ,   B a n n e r M a p ,   B a n n e r C o n t e n t L a y e r ,   R e a d P e r m i s s i o n ,   T o p i c W r i t e P e r m i s s i o n ,   F o l l o w U p W r i t e P e r m i s s i o n   Q*N^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ S e r i a l   I N T 
 
 D E C L A R E   @ M o d e r a t o r   N V A R C H A R ( 1 0 0 0 ) 
 
 D E C L A R E   @ P u b l i c   N V A R C H A R ( 5 0 ) 
 
 D E C L A R E   @ I n A c t i v e M a i n M e n u I c o n M a p   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ A c t i v e M a i n M e n u I c o n M a p   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ B a n n e r M a p   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ B a n n e r C o n t e n t L a y e r   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ R e a d P e r m i s s i o n   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ T o p i c W r i t e P e r m i s s i o n   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ F o l l o w U p W r i t e P e r m i s s i o n   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 S E L E C T   
 
 
 
 	 @ S e r i a l = S e r i a l , 
 
 	 @ M o d e r a t o r = M o d e r a t o r , 
 
 	 @ P u b l i c = [ P u b l i c ] , 
 
 	 @ I n A c t i v e M a i n M e n u I c o n M a p = I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 @ A c t i v e M a i n M e n u I c o n M a p = A c t i v e M a i n M e n u I c o n M a p , 
 
 	 @ B a n n e r M a p = B a n n e r M a p , 
 
 	 @ B a n n e r C o n t e n t L a y e r = B a n n e r C o n t e n t L a y e r , 
 
 	 @ R e a d P e r m i s s i o n = R e a d P e r m i s s i o n , 
 
 	 @ T o p i c W r i t e P e r m i s s i o n = T o p i c W r i t e P e r m i s s i o n , 
 
 	 @ F o l l o w U p W r i t e P e r m i s s i o n = F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 F R O M   d b o . C o m m u n i t y   W H E R E   [ I D ] = @ C u r r e n t C o m m u n i t y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^e  C o m m u n i t y     Yge  C o m m u n i t y   
NX[(Wv݋	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . C o m m u n i t y ( S e r i a l , [ N a m e ] , M o d e r a t o r , [ P u b l i c ] , I n A c t i v e M a i n M e n u I c o n M a p , A c t i v e M a i n M e n u I c o n M a p , B a n n e r M a p , B a n n e r C o n t e n t L a y e r , R e a d P e r m i s s i o n , T o p i c W r i t e P e r m i s s i o n , F o l l o w U p W r i t e P e r m i s s i o n )   V A L U E S ( @ S e r i a l , @ N e w C o m m u n i t y N a m e , @ M o d e r a t o r , @ P u b l i c , @ I n A c t i v e M a i n M e n u I c o n M a p , @ A c t i v e M a i n M e n u I c o n M a p , @ B a n n e r M a p , @ B a n n e r C o n t e n t L a y e r , @ R e a d P e r m i s s i o n , @ T o p i c W r i t e P e r m i s s i o n , @ F o l l o w U p W r i t e P e r m i s s i o n ) 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _e  C o m m u n i t y     v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ N e w C o m m u n i t y I D   I N T 
 
 S E L E C T   @ N e w C o m m u n i t y I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e s s i o n   Qv,gh	    
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Xm  C o m m u n i t y C o n t e n t   -NvU_  HQ RdSX[(Wv͑
YU_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . C o m m u n i t y C o n t e n t   W H E R E   C o m m u n i t y I D = @ N e w C o m m u n i t y I D 
 
 
 
 I N S E R T   I N T O   d b o . C o m m u n i t y C o n t e n t 
 
 
 
 	 ( 
 
 	 C o m m u n i t y I D , 
 
 	 C u l t u r e , 
 
 	 T i t l e , 
 
 	 [ D e s c r i p t i o n ] , 
 
 	 H i d d e n , 
 
 
 
 	 C o m m a n d T i t l e T a s k L i s t , 
 
 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 C o m m a n d T i t l e A d d , 
 
 	 C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 C o m m a n d T i t l e Q u e r y , 
 
 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 	 )   
 
 
 
 S E L E C T   
 
 
 
 	 @ N e w C o m m u n i t y I D , 
 
 	 C u l t u r e , 
 
 	 R E P L A C E ( T i t l e , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( [ D e s c r i p t i o n ] , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 H i d d e n , 
 
 
 
 	 R E P L A C E ( C o m m a n d T i t l e T a s k L i s t , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( C o m m a n d T i t l e A d d , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( C o m m a n d T i t l e A d d D e s c r i p t i o n , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( C o m m a n d T i t l e Q u e r y , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 
 
 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( T o p i c C o m m a n d S e t E l i t e T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( T o p i c C o m m a n d S e t T a b o o T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 R E P L A C E ( T o p i c C o m m a n d S e t S t i c k y T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) 
 
 
 
 
 
 F R O M   d b o . C o m m u n i t y C o n t e n t 
 
 W H E R E   C o m m u n i t y I D = @ C u r r e n t C o m m u n i t y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ RdevSve  C o m m u n i t y   Nv  F o r u m 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . F o r u m   W H E R E   C o m m u n i t y I D = @ N e w C o m m u n i t y I D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O(u  C u r s o r 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   F o r u m C u r s o r   C U R S O R   F O R   
 
 
 
 S E L E C T   
 
 
 
 	 [ I D ] , 
 
 	 C o m m u n i t y I D , 
 
 	 S e r i a l , 
 
 	 [ N a m e ] , 
 
 	 M o d e r a t o r , 
 
 	 [ P u b l i c ] , 
 
 	 R e a d P e r m i s s i o n , 
 
 	 T o p i c W r i t e P e r m i s s i o n , 
 
 	 F o l l o w U p W r i t e P e r m i s s i o n 
 
 	 
 
 
 
 F R O M   d b o . F o r u m 
 
 W H E R E   C o m m u n i t y I D = @ C u r r e n t C o m m u n i t y I D 
 
 
 
 D E C L A R E   @ C u r r e n t F o r u m I D   I N T 
 
 D E C L A R E   @ C u r r e n t F o r u m C o m m u n i t y I D   I N T 
 
 D E C L A R E   @ C u r r e n t F o r u m S e r i a l   I N T 
 
 D E C L A R E   @ C u r r e n t F o r u m N a m e   N V A R C H A R ( 5 0 ) 
 
 D E C L A R E   @ C u r r e n t F o r u m M o d e r a t o r   N V A R C H A R ( 1 0 0 0 ) 
 
 D E C L A R E   @ C u r r e n t F o r u m P u b l i c   N V A R C H A R ( 5 0 ) 
 
 D E C L A R E   @ C u r r e n t F o r u m R e a d P e r m i s s i o n   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ C u r r e n t F o r u m T o p i c W r i t e P e r m i s s i o n   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ C u r r e n t F o r u m F o l l o w U p W r i t e P e r m i s s i o n   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 O P E N   F o r u m C u r s o r 
 
 
 
 F E T C H   N E X T   F R O M   F o r u m C u r s o r   I N T O   
 
 
 
 @ C u r r e n t F o r u m I D ,   
 
 @ C u r r e n t F o r u m C o m m u n i t y I D , 
 
 @ C u r r e n t F o r u m S e r i a l ,   
 
 @ C u r r e n t F o r u m N a m e , 
 
 @ C u r r e n t F o r u m M o d e r a t o r , 
 
 @ C u r r e n t F o r u m P u b l i c , 
 
 @ C u r r e n t F o r u m R e a d P e r m i s s i o n , 
 
 @ C u r r e n t F o r u m T o p i c W r i t e P e r m i s s i o n , 
 
 @ C u r r e n t F o r u m F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 
Y6R  F o r u m   
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I N S E R T   I N T O   d b o . F o r u m 
 
 
 
 	 	 ( 
 
 	 	 C o m m u n i t y I D , 
 
 	 	 S e r i a l , 
 
 	 	 [ N a m e ] , 
 
 	 	 M o d e r a t o r , 
 
 	 	 [ P u b l i c ] , 
 
 	 	 R e a d P e r m i s s i o n , 
 
 	 	 T o p i c W r i t e P e r m i s s i o n , 
 
 	 	 F o l l o w U p W r i t e P e r m i s s i o n 
 
 	 	 ) 
 
 
 
 	 V A L U E S   
 
 
 
 	 	 ( 
 
 	 	 @ N e w C o m m u n i t y I D , 
 
 	 	 @ C u r r e n t F o r u m S e r i a l ,   
 
 	 	 R E P L A C E ( @ C u r r e n t F o r u m N a m e , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 @ C u r r e n t F o r u m M o d e r a t o r , 
 
 	 	 @ C u r r e n t F o r u m P u b l i c , 
 
 	 	 @ C u r r e n t F o r u m R e a d P e r m i s s i o n , 
 
 	 	 @ C u r r e n t F o r u m T o p i c W r i t e P e r m i s s i o n , 
 
 	 	 @ C u r r e n t F o r u m F o l l o w U p W r i t e P e r m i s s i o n 
 
 	 	 ) 
 
 
 
 
 
 	 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = _e  F o r u m     v  I D 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E C L A R E   @ N e w F o r u m I D   I N T 
 
 	 S E L E C T   @ N e w F o r u m I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e s s i o n   Qv,gh	    
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = Xm  F o r u m C o n t e n t   HQ RdevSve  F o r u m   Nv  F o r u m C o n t e n t 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E L E T E   F R O M   d b o . F o r u m C o n t e n t   W H E R E   F o r u m I D = @ N e w F o r u m I D 
 
 
 
 	 I N S E R T   I N T O   d b o . F o r u m C o n t e n t 
 
 	 
 
 	 	 ( 
 
 	 	 F o r u m I D , 
 
 	 	 C u l t u r e , 
 
 	 	 T i t l e , 
 
 	 	 [ D e s c r i p t i o n ] , 
 
 	 	 H i d d e n , 
 
 
 
 	 	 C o m m a n d T i t l e T a s k L i s t , 
 
 	 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 	 C o m m a n d T i t l e A d d , 
 
 	 	 C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 	 C o m m a n d T i t l e Q u e r y , 
 
 	 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 	 T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 	 T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 	 T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 	 	 ) 
 
 
 
 	 S E L E C T   
 
 
 
 	 	 @ N e w F o r u m I D , 
 
 	 	 C u l t u r e , 
 
 	 	 R E P L A C E ( T i t l e , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( [ D e s c r i p t i o n ] , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 H i d d e n , 
 
 
 
 	 	 R E P L A C E ( C o m m a n d T i t l e T a s k L i s t , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( C o m m a n d T i t l e A d d , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( C o m m a n d T i t l e A d d D e s c r i p t i o n , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( C o m m a n d T i t l e Q u e r y , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 
 
 	 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( T o p i c C o m m a n d S e t E l i t e T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( T o p i c C o m m a n d S e t T a b o o T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) , 
 
 	 	 R E P L A C E ( T o p i c C o m m a n d S e t S t i c k y T o p i c , @ C u r r e n t C o m m u n i t y I d e n t i t y , @ N e w C o m m u n i t y I d e n t i t y ) 
 
 
 
 	 F R O M   d b o . F o r u m C o n t e n t 
 
 	 W H E R E   F o r u m I D = @ C u r r e n t F o r u m I D 
 
 
 
 
 
 	 F E T C H   N E X T   F R O M   F o r u m C u r s o r   I N T O   
 
 
 
 	 @ C u r r e n t F o r u m I D ,   
 
 	 @ C u r r e n t F o r u m C o m m u n i t y I D , 
 
 	 @ C u r r e n t F o r u m S e r i a l ,   
 
 	 @ C u r r e n t F o r u m N a m e , 
 
 	 @ C u r r e n t F o r u m M o d e r a t o r , 
 
 	 @ C u r r e n t F o r u m P u b l i c , 
 
 	 @ C u r r e n t F o r u m R e a d P e r m i s s i o n , 
 
 	 @ C u r r e n t F o r u m T o p i c W r i t e P e r m i s s i o n , 
 
 	 @ C u r r e n t F o r u m F o l l o w U p W r i t e P e r m i s s i o n 
 
 
 
 E N D 
 
 
 
 
 
 C L O S E   F o r u m C u r s o r 
 
 D E A L L O C A T E   F o r u m C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y C l o n e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . X T o o l O p t i o n I n s e r t S c r i p t s         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ X T o o l O p t i o n I n s e r t S c r i p t s ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ X T o o l O p t i o n I n s e r t S c r i p t s ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~]wQ  -   ]wQ(ueg\  O p t i o n   -Nv<Pub  I N S E R T   ,g(uegۏL|~RYS
 
 - - = = ]wQS(uN|~S(uN _SrGS~ g~(u7b
NSNO(u]wQۏLNUOd\O
 
 - - = = 2 0 0 9 - 0 8 - 0 8   ,g  S P vMR_(u  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . X T o o l O p t i o n I n s e r t S c r i p t s 
 
 
 
 @ F o r S e t u p   I N T 	 	 	 - -   S P   /f&T(uN  S e t u p   z^[N  S e t u p   z^bN \gN  O p t i o n   ۏLQS    ( 1 / 2 ) 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ\  O p t i o n C o n t e n t   -NvU_ Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 P R I N T   N ' D E L E T E   F R O M   d b o . [ O p t i o n ] ' 
 
 P R I N T   N ' ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 4NeSϑ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 d e c l a r e   @ I D   i n t 
 
 d e c l a r e   @ C a t   n v a r c h a r ( 1 0 0 ) 
 
 d e c l a r e   @ R i g h t I n d e n t   i n t 
 
 d e c l a r e   @ K e y   n v a r c h a r ( 1 0 0 ) 
 
 d e c l a r e   @ V a l u e   n v a r c h a r ( 4 0 0 0 ) 
 
 d e c l a r e   @ L e g e n d   n v a r c h a r ( 5 0 ) 
 
 d e c l a r e   @ N u m b e r O n l y   n v a r c h a r ( 5 0 ) 
 
 d e c l a r e   @ T e x t A r e a   n v a r c h a r ( 5 0 ) 
 
 d e c l a r e   @ M u l t i C u l t u r e   n v a r c h a r ( 5 0 ) 
 
 d e c l a r e   @ F o r T h e m e   n v a r c h a r ( 5 0 ) 
 
 d e c l a r e   @ V a l i d a t i o n   n v a r c h a r ( 5 0 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^  c u r s o r MS  O p t i o n   h-N<Pub  I n s e r t   S c r i p t s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 d e c l a r e   O p t i o n C u r s o r   c u r s o r   f o r   s e l e c t   [ I D ] , C a t , R i g h t I n d e n t , [ K e y ] , C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , V a l u e ) , L e g e n d , N u m b e r O n l y , T e x t A r e a , M u l t i C u l t u r e , F o r T h e m e , V a l i d a t i o n   f r o m   d b o . [ O p t i o n ]   o r d e r   b y   [ I D ] 
 
 o p e n   O p t i o n C u r s o r 
 
 f e t c h   n e x t   f r o m   O p t i o n C u r s o r   i n t o   @ I D , @ C a t , @ R i g h t I n d e n t , @ K e y , @ V a l u e , @ L e g e n d , @ N u m b e r O n l y , @ T e x t A r e a , @ M u l t i C u l t u r e , @ F o r T h e m e , @ V a l i d a t i o n 
 
 
 
 w h i l e   @ @ F e t c h _ S t a t u s = 0 
 
 b e g i n 
 
 	 p r i n t   N ' I N S E R T   I N T O   d b o . [ O p t i o n ]   ' 
 
 	 p r i n t   N ' ( ' 
 
 	 p r i n t   N ' 	 [ I D ] , ' 
 
 	 p r i n t   N ' 	 [ C a t ] , ' 
 
 	 p r i n t   N ' 	 [ R i g h t I n d e n t ] , ' 
 
 	 p r i n t   N ' 	 [ K e y ] , ' 
 
 	 p r i n t   N ' 	 [ V a l u e ] , ' 
 
 	 p r i n t   N ' 	 [ L e g e n d ] , ' 
 
 	 p r i n t   N ' 	 [ N u m b e r O n l y ] , ' 
 
 	 p r i n t   N ' 	 [ T e x t A r e a ] , ' 
 
 	 p r i n t   N ' 	 [ M u l t i C u l t u r e ] , ' 
 
 	 p r i n t   N ' 	 [ F o r T h e m e ] , ' 
 
 	 p r i n t   N ' 	 [ V a l i d a t i o n ] ' 
 
 	 p r i n t   N ' ) ' 
 
 	 p r i n t   N ' V A L U E S ' 
 
 	 p r i n t   N ' ( ' 
 
 	 p r i n t   N ' 	 '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ I D )   +   N ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ C a t , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ R i g h t I n d e n t )   +   N ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ K e y , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ V a l u e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ L e g e n d , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ N u m b e r O n l y , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ T e x t A r e a , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ M u l t i C u l t u r e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ F o r T h e m e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ V a l i d a t i o n , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' ' 
 
 	 p r i n t   N ' ) ' 
 
 	 p r i n t   N ' ' 
 
 
 
 	 f e t c h   n e x t   f r o m   O p t i o n C u r s o r   i n t o   @ I D , @ C a t , @ R i g h t I n d e n t , @ K e y , @ V a l u e , @ L e g e n d , @ N u m b e r O n l y , @ T e x t A r e a , @ M u l t i C u l t u r e , @ F o r T h e m e , @ V a l i d a t i o n 
 
 e n d 
 
 c l o s e   O p t i o n C u r s o r 
 
 d e a l l o c a t e   O p t i o n C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg(uN  S e t u p   ]zRbN \NNSpeQS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ F o r S e t u p = 1 
 
 B E G I N 
 
 	 / * 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' P a g e T e x t u r e C s s ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' 2 ' '   W H E R E   [ K e y ] = N ' ' L a y o u t T e m p l a t e ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' L o g o T e x t u r e C s s ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' L o g o M a p ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' 2 ' '   W H E R E   [ K e y ] = N ' ' M a i n M e n u S e p a r a t o r ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' B a n n e r T e x t u r e C s s ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' B a n n e r M a p ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' B a n n e r R o t a t o r C a n d i d a t e ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' F a s t C o n t e n t T i t l e ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' F a s t C o n t e n t ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' t r u e ' '   W H E R E   [ K e y ] = N ' ' F a s t C o n t e n t H i d d e n ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' M y C s s ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' C o p y r i g h t T e x t u r e C s s ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' C o p y r i g h t I c o n M a p ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' R e g i s t e r W e l c o m e M e s s a g e ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ K e y ] = N ' ' F a s t L i n k ' '   ' 
 
 	 * / 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' ' '   W H E R E   [ C a t ] = N ' ' S M T P ' '   ' 
 
 	 p r i n t   N '   U P D A T E   d b o . [ O p t i o n ]   S E T   [ V a l u e ] = N ' ' z h - c n : {SO, z h - t w : A~Ԛ, e n - u s : E n g l i s h ' '   W H E R E   [ K e y ] = N ' ' C u l t u r e s ' '   ' 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ X T o o l O p t i o n I n s e r t S c r i p t s ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . X T o o l O p t i o n C o n t e n t I n s e r t S c r i p t s         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ X T o o l O p t i o n C o n t e n t I n s e r t S c r i p t s ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ X T o o l O p t i o n C o n t e n t I n s e r t S c r i p t s ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~]wQ  -   ]wQ(ueg\  O p t i o n C o n t e n t   -Nv<Pub  I N S E R T   ,g(uegۏL|~RYS
 
 - - = = ]wQS(uN|~S(uN _SrGS~ g~(u7b
NSNO(u]wQۏLNUOd\O
 
 - - = = 2 0 0 9 - 0 8 - 0 8   S P   vMR_(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . X T o o l O p t i o n C o n t e n t I n s e r t S c r i p t s 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ\  O p t i o n C o n t e n t   -NvU_ Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 P R I N T   N ' D E L E T E   F R O M   d b o . O p t i o n C o n t e n t ' 
 
 P R I N T   N ' ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 4NeSϑ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 d e c l a r e   @ I D   i n t 
 
 d e c l a r e   @ O p t i o n I D   i n t 
 
 d e c l a r e   @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 
 
 d e c l a r e   @ T i t l e   n v a r c h a r ( 2 0 0 ) 
 
 d e c l a r e   @ C a t T i t l e   n v a r c h a r ( 2 0 0 ) 
 
 d e c l a r e   @ D e s c r i p t i o n   n v a r c h a r ( 3 0 0 0 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^  c u r s o r MS  O p t i o n C o n t e n t   h-N<Pub  I n s e r t   S c r i p t s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 d e c l a r e   O p t i o n C o n t e n t C u r s o r   c u r s o r   f o r   s e l e c t   [ I D ] , [ O p t i o n I D ] , [ C u l t u r e ] , [ T i t l e ] , [ C a t T i t l e ] , [ D e s c r i p t i o n ]   f r o m   d b o . [ O p t i o n C o n t e n t ]   o r d e r   b y   [ I D ] 
 
 o p e n   O p t i o n C o n t e n t C u r s o r 
 
 f e t c h   n e x t   f r o m   O p t i o n C o n t e n t C u r s o r   i n t o   @ I D , @ O p t i o n I D , @ C u l t u r e , @ T i t l e , @ C a t T i t l e , @ D e s c r i p t i o n 
 
 
 
 w h i l e   @ @ F e t c h _ S t a t u s = 0 
 
 b e g i n 
 
 	 p r i n t   N ' I N S E R T   I N T O   d b o . [ O p t i o n C o n t e n t ]   ' 
 
 	 p r i n t   N ' ( ' 
 
 	 p r i n t   N ' 	 [ I D ] , ' 
 
 	 p r i n t   N ' 	 [ O p t i o n I D ] , ' 
 
 	 p r i n t   N ' 	 [ C u l t u r e ] , ' 
 
 	 p r i n t   N ' 	 [ T i t l e ] , ' 
 
 	 p r i n t   N ' 	 [ C a t T i t l e ] , ' 
 
 	 p r i n t   N ' 	 [ D e s c r i p t i o n ] ' 
 
 	 p r i n t   N ' ) ' 
 
 	 p r i n t   N ' V A L U E S ' 
 
 	 p r i n t   N ' ( ' 
 
 	 p r i n t   N ' 	 '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ I D )   +   N ' , ' 
 
 	 p r i n t   N ' 	 '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ O p t i o n I D )   +   N ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ C u l t u r e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ T i t l e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ C a t T i t l e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ D e s c r i p t i o n , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' ' 
 
 	 p r i n t   N ' ) ' 
 
 	 p r i n t   N ' ' 
 
 
 
 	 f e t c h   n e x t   f r o m   O p t i o n C o n t e n t C u r s o r   i n t o   @ I D , @ O p t i o n I D , @ C u l t u r e , @ T i t l e , @ C a t T i t l e , @ D e s c r i p t i o n 
 
 e n d 
 
 c l o s e   O p t i o n C o n t e n t C u r s o r 
 
 d e a l l o c a t e   O p t i o n C o n t e n t C u r s o r 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ X T o o l O p t i o n C o n t e n t I n s e r t S c r i p t s ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c M o v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c M o v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c M o v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = yR
Y6R  T o p i c   0R+RvHrb
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c M o v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   i n t , 	 	 	 	 	 - - T o p i c   v  I D 
 
 @ F o r u m L i s t   n v a r c h a r ( 4 0 0 0 ) , 	 	 	 - - 
Y6RyR0RTN  F o r u m 
 
 @ K e e p O r i g i n a l   n v a r c h a r ( 5 0 ) 	 	 	 - - /f&TOYuS^P[t r u e / f a l s e 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S	g|~{tXTMb	gُ*NCgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  F o r u m L i s t   lbc:N  C U R S O R 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m   I N T 
 
 D E C L A R E   F o r u m C u r s o r   C U R S O R   F O R   S E L E C T   [ E l e m e n t ]   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ F o r u m L i s t , N ' , ' ) 
 
 
 
 O P E N   F o r u m C u r s o r 
 
 F E T C H   N E X T   F R O M   F o r u m C u r s o r   I N T O   @ F o r u m 
 
 
 
 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 
Y6RS_MR  T o p i c   U_:NeU_Tew(uev  F o r u m I D ,   P o s t T i m e 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I N S E R T   I N T O   d b o . T o p i c   ( F o r u m I D , T o p i c S t a t u s , [ U s e r ] , P o s t T i m e , T i t l e , C o n t e n t , H i t , A t t a c h m e n t N a m e )   S E L E C T   @ F o r u m , T o p i c S t a t u s , [ U s e r ] , P o s t T i m e , T i t l e , C o n t e n t , H i t , A t t a c h m e n t N a m e   F R O M   d b o . T o p i c   W H E R E   [ I D ] = @ T o p i c I D 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = _e
Y6Rv  T o p i c   I D 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E C L A R E   @ N e w T o p i c I D   I N T 
 
 	 S E L E C T   @ N e w T o p i c I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	    
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 
Y6RS_MR  T o p i c   Nv  F o l l o w U p   U_:NeU_Tew(uev  T o p i c I D 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I N S E R T   I N T O   d b o . F o l l o w U p   ( T o p i c I D , [ U s e r ] , P o s t T i m e , C o n t e n t , A t t a c h m e n t N a m e )   S E L E C T   @ N e w T o p i c I D , [ U s e r ] , P o s t T i m e , C o n t e n t , A t t a c h m e n t N a m e   F R O M   d b o . F o l l o w U p   W H E R E   T o p i c I D = @ T o p i c I D 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~~N*N  C U R S O R 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 F E T C H   N E X T   F R O M   F o r u m C u r s o r   I N T O   @ F o r u m 
 
 E N D 
 
 
 
 C L O S E   F o r u m C u r s o r 
 
 D E A L L O C A T E   F o r u m C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTYg  @ K e e p O r i g i n a l   :N  f a l s e   R RdSY^  T o p i c   h-Nv  T r i g g e r   O Rdv^  F o l l o w U p   U_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   L O W E R ( @ K e e p O r i g i n a l ) = L O W E R ( N ' f a l s e ' ) 
 
 B E G I N 
 
 	 D E L E T E   F R O M   d b o . T o p i c   W H E R E   [ I D ] = @ T o p i c I D     
 
 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c M o v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . X T o o l A d d O p t i o n C o n t e n t I n s e r t S c r i p t s         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ X T o o l A d d O p t i o n C o n t e n t I n s e r t S c r i p t s ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ X T o o l A d d O p t i o n C o n t e n t I n s e r t S c r i p t s ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~]wQub~[eyv  O p t i o n C o n t e n t   RYS  S c r i p t 
 
 - - = = ]wQS(uN|~S(uN _SrGS~ g~(u7b
NSNO(u]wQۏLNUOd\O
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . X T o o l A d d O p t i o n C o n t e n t I n s e r t S c r i p t s 
 
 
 
 @ A d d i t i o n a l C u l t u r e   N V A R C H A R ( 1 0 0 ) 	 	 	 - -   eXeS
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ\  O p t i o n C o n t e n t   -NvU_ Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 P R I N T   N ' D E L E T E   F R O M   d b o . O p t i o n C o n t e n t ' 
 
 P R I N T   N ' ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ߍ*  @ O p t i o n C o n t e n t C o u n t e r 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 d e c l a r e   @ O p t i o n C o n t e n t C o u n t e r   i n t 
 
 s e t   @ O p t i o n C o n t e n t C o u n t e r = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 4NeSϑ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 d e c l a r e   @ O p t i o n I D   i n t 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^  c u r s o r MS  O p t i o n   h-N<P_  O p t i o n   I D   C u r s o r 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 d e c l a r e   O p t i o n C u r s o r   c u r s o r   f o r   s e l e c t   [ I D ]   f r o m   d b o . [ O p t i o n ]   o r d e r   b y   [ I D ] 
 
 o p e n   O p t i o n C u r s o r 
 
 f e t c h   n e x t   f r o m   O p t i o n C u r s o r   i n t o   @ O p t i o n I D 
 
 
 
 w h i l e   @ @ F e t c h _ S t a t u s = 0 
 
 b e g i n 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 4NeSϑ
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 d e c l a r e   @ T h i s O p t i o n C o n t e n t I D   i n t 
 
 	 d e c l a r e   @ T h i s O p t i o n I D   i n t 
 
 	 d e c l a r e   @ T h i s C u l t u r e   n v a r c h a r ( 1 0 0 ) 
 
 	 d e c l a r e   @ T h i s T i t l e   n v a r c h a r ( 2 0 0 ) 
 
 	 d e c l a r e   @ T h i s C a t T i t l e   n v a r c h a r ( 2 0 0 ) 
 
 	 d e c l a r e   @ T h i s D e s c r i p t i o n   n v a r c h a r ( 3 0 0 0 ) 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = R^  c u r s o r MS  O p t i o n C o n t e n t   h-N<Pub  I n s e r t   S c r i p t s 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 d e c l a r e   O p t i o n C o n t e n t C u r s o r   c u r s o r   f o r   s e l e c t   [ I D ] , O p t i o n I D , [ C u l t u r e ] , [ T i t l e ] , [ C a t T i t l e ] , [ D e s c r i p t i o n ]   f r o m   d b o . [ O p t i o n C o n t e n t ]   w h e r e   O p t i o n I D = @ O p t i o n I D   o r d e r   b y   [ I D ] 	 
 
 	 o p e n   O p t i o n C o n t e n t C u r s o r 
 
 	 f e t c h   n e x t   f r o m   O p t i o n C o n t e n t C u r s o r   i n t o   @ T h i s O p t i o n C o n t e n t I D , @ T h i s O p t i o n I D , @ T h i s C u l t u r e , @ T h i s T i t l e , @ T h i s C a t T i t l e , @ T h i s D e s c r i p t i o n 
 
 
 
 	 w h i l e   @ @ F e t c h _ S t a t u s = 0 
 
 	 b e g i n 
 
 	 	 p r i n t   N ' I N S E R T   I N T O   d b o . [ O p t i o n C o n t e n t ]   ' 
 
 	 	 p r i n t   N ' ( ' 
 
 	 	 p r i n t   N ' 	 [ I D ] , ' 
 
 	 	 p r i n t   N ' 	 [ O p t i o n I D ] , ' 
 
 	 	 p r i n t   N ' 	 [ C u l t u r e ] , ' 
 
 	 	 p r i n t   N ' 	 [ T i t l e ] , ' 
 
 	 	 p r i n t   N ' 	 [ C a t T i t l e ] , ' 
 
 	 	 p r i n t   N ' 	 [ D e s c r i p t i o n ] ' 
 
 	 	 p r i n t   N ' ) ' 
 
 	 	 p r i n t   N ' V A L U E S ' 
 
 	 	 p r i n t   N ' ( ' 
 
 	 	 p r i n t   N ' 	 '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ O p t i o n C o n t e n t C o u n t e r )   +   N ' , ' 
 
 	 	 p r i n t   N ' 	 '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ O p t i o n I D )   +   N ' , ' 
 
 	 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ T h i s C u l t u r e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ T h i s T i t l e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ T h i s C a t T i t l e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ T h i s D e s c r i p t i o n , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' ' 
 
 	 	 p r i n t   N ' ) ' 
 
 	 	 p r i n t   N ' ' 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = @ O p t i o n C o n t e n t C o u n t e r + + 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ O p t i o n C o n t e n t C o u n t e r = @ O p t i o n C o n t e n t C o u n t e r + 1 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ~~
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 f e t c h   n e x t   f r o m   O p t i o n C o n t e n t C u r s o r   i n t o   @ T h i s O p t i o n C o n t e n t I D , @ T h i s O p t i o n I D , @ T h i s C u l t u r e , @ T h i s T i t l e , @ T h i s C a t T i t l e , @ T h i s D e s c r i p t i o n 
 
 	 e n d 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~~mReXeSvceQ  S c r i p t 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 p r i n t   N ' - - N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ' 
 
 	 p r i n t   N ' - - F i l l   u p   t h e   T i t l e   a n d   D e s c r i p t i o n   F i e l d   i n   f o l l o w i n g   S c r i p t s   u n d e r   N e w   C u l t u r e   ' 
 
 	 p r i n t   N ' - - N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ' 
 
 	 p r i n t   N ' I N S E R T   I N T O   d b o . [ O p t i o n C o n t e n t ]   ' 
 
 	 p r i n t   N ' ( ' 
 
 	 p r i n t   N ' 	 [ I D ] , ' 
 
 	 p r i n t   N ' 	 [ O p t i o n I D ] , ' 
 
 	 p r i n t   N ' 	 [ C u l t u r e ] , ' 
 
 	 p r i n t   N ' 	 [ T i t l e ] , ' 
 
 	 p r i n t   N ' 	 [ C a t T i t l e ] , ' 
 
 	 p r i n t   N ' 	 [ D e s c r i p t i o n ] ' 
 
 	 p r i n t   N ' ) ' 
 
 	 p r i n t   N ' V A L U E S ' 
 
 	 p r i n t   N ' ( ' 
 
 	 p r i n t   N ' 	 '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ O p t i o n C o n t e n t C o u n t e r )   +   N ' , ' 
 
 	 p r i n t   N ' 	 '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ O p t i o n I D )   +   N ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ A d d i t i o n a l C u l t u r e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' '   +   R E P L A C E ( @ T h i s C a t T i t l e , N ' ' ' ' , N ' ' ' ' ' ' )   +   N ' ' ' , ' 
 
 	 p r i n t   N ' 	 N ' ' ' ' ' 
 
 	 p r i n t   N ' ) ' 
 
 	 p r i n t   N ' - - N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ' 
 
 	 p r i n t   N ' ' 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = Q!k@ O p t i o n C o n t e n t C o u n t e r + + 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ O p t i o n C o n t e n t C o u n t e r = @ O p t i o n C o n t e n t C o u n t e r + 1 
 
 
 
 	 c l o s e   O p t i o n C o n t e n t C u r s o r 
 
 	 d e a l l o c a t e   O p t i o n C o n t e n t C u r s o r 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~~  O p t i o n   C u r s o r 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 f e t c h   n e x t   f r o m   O p t i o n C u r s o r   i n t o   @ O p t i o n I D 
 
 e n d 
 
 c l o s e   O p t i o n C u r s o r 
 
 d e a l l o c a t e   O p t i o n C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ X T o o l A d d O p t i o n C o n t e n t I n s e r t S c r i p t s ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . O p t i o n G e t A l l         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ O p t i o n G e t A l l ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ O p t i o n G e t A l l ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  O p t i o n   h@b	g  K e y   V a l u e   ԏV(W  g l o b a l . a s a x   v  a p p l i c a t i o n _ s t a r t   -N\  o p t i o n   @b	gyvX[0R  A p p l i c a t i o n   hQ@\SϑX[MQk!k(u  o p t i o n   O(upenc^g
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 6 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . O p t i o n G e t A l l 
 
 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   
 
 	 o p t . C a t   A S   C a t , 
 
 	 o p t . [ K e y ]   A S   [ K e y ] , 
 
 	 o p t . V a l u e   A S   V a l u e , 
 
 	 I S N U L L ( o p t . M u l t i C u l t u r e , N ' f a l s e ' )   A S   M u l t i C u l t u r e , 
 
 	 I S N U L L ( o p t . V a l i d a t i o n , N ' ' )   A S   V a l i d a t i o n 
 
 
 
 F R O M   d b o . [ O p t i o n ]   o p t 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ O p t i o n G e t A l l ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e G e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e G e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e G e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = K n o w l e d g e G e t   vRu>f:yHr    (W|~  O p t i o n   -NYg  K n o w l e d g e P a g e S i z e   n:N  0   R
NRu>f:yYg'YN  0 RRu>f:y	
 
 - - = = h  K n o w l e d g e   -Nv  D e d i c a t e d T o   :NzzveP@b	gSOmȉ  :N  a b c , e f g   Rc[[7bSOmȉ  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 0 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e G e t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - P a g e   D i r e t o r y   v  N a m e 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MReS
 
 
 
 @ C u r r e n t P a g e   I N T 	 	 	 	 	 	 - - ux:g6RS_MRu
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _S_MR  P a g e D i r e c t o r y     v  T y p e   <PYg/f  1 RbNTbv~g\O(u  O r d e r   B y   S e r i a l   nfQ[N  S e r i a l   c^	  Yg/f  2   R  O r d e r   B y   U p d a t e T i m e   WNevQ[NS^ec^	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ T y p e   I N T 
 
 S E L E C T   @ T y p e = T y p e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ P a g e D i r e c t o r y N a m e     @b(Wv  P a g e D i r e c t o r y   U_-Nv  P a g e S i z e   <P
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e S i z e   I N T 
 
 S E L E C T   T O P   1   @ P a g e S i z e = P a g e S i z e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ^zRu
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g i n g   T A B L E   
 
 (   
 
 	 P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   
 
 	 [ I D ]   i n t ,   
 
 	 P a g e D i r e c t o r y I D   i n t , 
 
 	 S e r i a l   i n t , 
 
 	 H i d d e n   b i t , 
 
 	 A p p r o v e d   i n t , 
 
 	 A p p r o v e M e s s a g e   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 A p p r o v e d B y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 U p d a t e T i m e   d a t e t i m e , 
 
 	 A u t h o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 K n o w l e d g e T y p e   i n t , 
 
 
 
 	 E d i t o r   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 E d i t o r P e r m i s s i o n   i n t , 
 
 	 
 
 	 K n o w l e d g e C o n t e n t I D   i n t , 
 
 
 
 	 - - T e m p l a t e   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 T i t l e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 - - T i t l e S h o w   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 C o n t e n t   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 T a g   n v a r c h a r ( 5 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 A b s t r a c t   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 
 
 	 H i t C o u n t   i n t , 
 
 	 C o m m e n t s P e r m i s s i o n   i n t , 
 
 	 C o m m e n t s C o u n t   i n t , 
 
 
 
 	 K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t   
 
 )   
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ K n o w l e d g e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' K n o w l e d g e A p p r o v e ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  T y p e = 1 / 2   Q[TbO(u  O R D E R   B Y   S e r i a l   ؏/f  U p d a t e T i m e   NN$NkNxdN  O r d e r   B y   KNYvQ[0We[hQ N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ T y p e = 1 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 	 	 O R D E R   B Y   S e r i a l 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b
0
N/f0  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 
 
 	 	 O R D E R   B Y   S e r i a l 
 
 	 E N D 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b
0
N/f0  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D   n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 
 
 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSS_MRu,{ N*NT gT N*NU_vMOn
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F i r s t R e c o r d   i n t 
 
 D E C L A R E   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 S E T   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 
 
 S E T   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏVS_MRu-NvU_
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   	 
 
 	 * , 
 
 	 P a g e C o u n t = C E I L I N G ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) )   
 
 
 
 F R O M   @ P a g i n g   
 
 W H E R E   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \
0S_MRu0QYԏVvwƋ  C o n t e n t     v  H i t C o u n t   QV  K n o w l e d g e C o n t e n t   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i t C o u n t = I S N U L L ( H i t C o u n t , 0 ) + 1   W H E R E   K n o w l e d g e I D   I N   ( S e l e c t   [ I D ]   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d )   A N D   C u l t u r e = @ C u l t u r e 
 
 U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i t C o u n t = I S N U L L ( H i t C o u n t , 0 ) + 1   W H E R E   [ I D ]   I N   ( S e l e c t   K n o w l e d g e C o n t e n t I D   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  S i t e L o g   -NU_(WHh  S_MR  P a g i n g   ̑b@b	gv  K n o w l e d g e C o n t e n t   S_MR  @ U s e r   OmȉN NN	
 
 - - = = S,g^S_O(u  S P   S i t e L o g S a v e   FO(Wُ̑YgO(u  S P   S i t e L o g S a v e   1\_{O(u'`^8^]v  C u r s o r :NNMQ  C u r o r   d\ObNُ̑vc  I n s e r t 
 
 - - = = la_{hg  @ U s e r   /f&T:Nzzcd*g{vU_(u7b_NOmȉv`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ U s e r < > N ' ' )   A N D   ( @ U s e r   I S   N O T   N U L L ) 
 
 B E G I N 
 
 	 I N S E R T   I N T O   d b o . S i t e L o g   ( [ U s e r ] , A c t i v i t y , T a r g e t I D , A c t i v i t y T i m e )   S E L E C T   @ U s e r , 1 , K n o w l e d g e C o n t e n t I D , G E T D A T E ( )   F R O M   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b~[  @ P a g e D i r e c t o r y N a m e   v  P a g e D i r e c t o r y   I D   T  K n o w l e d g e   v  K n o w l e d g e D i r e c t o r y   
TW[    R(uNR^   ewƋ   c	  
 
 - - = = TeԏVS_MR  P a g e D i r e c t o r y   vgN^\'`T y p e ,   P r e s e n t a t i o n ,   S h o w T i t l e ,   S h o w A u t h o r ,   S h o w U p d a t e T i m e ,   S h o w H i t C o u n t ,   S h o w C o m m e n t s ,   S h o w S t a t i c U r l ,   S h o w K n o w l e d g e H t m l ,   S h o w R e l a t i v e 	NOJTɋ|~YUO  R e n d e r   wƋ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 p a d . [ I D ]   A S   P a g e D i r e c t o r y I D , 
 
 	 p a d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e , 
 
 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y , 
 
 
 
 	 I S N U L L ( p d c . O u t l i n e M o d e , 0 )   A S   O u t l i n e M o d e , 
 
 
 
 	 p d c . T i t l e   A S   T i t l e , 
 
 	 p d c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 p d c . P a g e H e a d e r   A S   P a g e H e a d e r , 
 
 	 p d c . P a g e F o o t e r   A S   P a g e F o o t e r , 
 
 
 
 	 s d c . P a g e H e a d e r   A S   S u b D i r e c t o r y P a g e H e a d e r , 
 
 	 s d c . P a g e F o o t e r   A S     S u b D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 m d c . P a g e H e a d e r   A S   M a i n D i r e c t o r y P a g e H e a d e r , 
 
 	 m d c . P a g e F o o t e r   A S     M a i n D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 p a d . T y p e   A S   T y p e , 
 
 	 p a d . P r e s e n t a t i o n   A S   P r e s e n t a t i o n , 
 
 	 p a d . J u m p T o C o n t e n t   A S   J u m p T o C o n t e n t , 
 
 
 
 	 p a d . S h o w T i t l e   A S   S h o w T i t l e , 
 
 	 p a d . S h o w A u t h o r   A S   S h o w A u t h o r , 
 
 	 p a d . S h o w U p d a t e T i m e   A S   S h o w U p d a t e T i m e , 
 
 	 p a d . S h o w H i t C o u n t   A S   S h o w H i t C o u n t , 
 
 	 p a d . S h o w C o m m e n t s   A S   S h o w C o m m e n t s , 
 
 	 p a d . S h o w S t a t i c U r l   A S   S h o w S t a t i c U r l , 
 
 	 p a d . S h o w K n o w l e d g e H t m l   A S   S h o w K n o w l e d g e H t m l , 
 
 	 p a d . S h o w R e l a t i v e   A S   S h o w R e l a t i v e 
 
 
 
 	 - - p a d . O v e r v i e w   A S   P a g e D i r e c t o r y O v e r v i e w , 
 
 	 - - s d . O v e r v i e w   A S   S u b D i r e c t o r y O v e r v i e w , 
 
 	 - - ( S e l e c t   C O U N T ( d p d . [ I D ] )   F r o m   d b o . P a g e D i r e c t o r y   d p d   W h e r e   d p d . S u b D i r e c t o r y I D = ( s d . [ I D ] ) )   A S   P a g e D i r e c t o r y B r o t h e r s C o u n t , 
 
 	 - - ( S e l e c t   C O U N T ( d s d . [ I D ] )   F r o m   d b o . S u b D i r e c t o r y   d s d   W h e r e   d s d . M a i n D i r e c t o r y I D = ( m d . [ I D ] ) )   A S   S u b D i r e c t o r y B r o t h e r s C o u n t 
 
 	 
 
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y   p a d   
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   O N   p d c . P a g e D i r e c t o r y I D = p a d . [ I D ]   A N D   p d c . C u l t u r e = @ C u l t u r e 
 
 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p a d . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d c . S u b D i r e c t o r y I D = s d . [ I D ] 
 
 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d c . M a i n D i r e c t o r y I D = m d . [ I D ] 
 
 
 
 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e G e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e G e t H o m e P a g e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e G e t H o m e P a g e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e G e t H o m e P a g e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = K n o w l e d g e G e t H o m e P a g e   vRuHr    (W|~  O p t i o n   -NYg  K n o w l e d g e P a g e S i z e   n:N  0   R
NRu>f:yYg'YN  0 RRu>f:y	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 0 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e G e t H o m e P a g e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MReS
 
 
 
 @ C u r r e n t P a g e   I N T 	 	 	 	 	 	 - - ux:g6RS_MRu
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _S_MR  P a g e D i r e c t o r y     v  T y p e   <PYg/f  1 RbNTbv~g\O(u  O r d e r   B y   S e r i a l   nfQ[N  S e r i a l   c^	  Yg/f  2   R  O r d e r   B y   U p d a t e T i m e   WNevQ[NS^ec^	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ T y p e   I N T 
 
 S E L E C T   T O P   1   @ T y p e = T y p e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   H o m e = 1 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  H o m e P a g e   @b(Wv  P a g e D i r e c t o r y   U_-Nv  P a g e S i z e   <P
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e S i z e   I N T 
 
 S E L E C T   T O P   1   @ P a g e S i z e = P a g e S i z e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   H o m e = 1 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ^zRu
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g i n g   T A B L E   
 
 (   
 
 	 P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   
 
 	 [ I D ]   i n t ,   
 
 	 P a g e D i r e c t o r y I D   i n t , 
 
 	 S e r i a l   i n t , 
 
 	 H i d d e n   b i t , 
 
 	 A p p r o v e d   i n t , 
 
 	 A p p r o v e M e s s a g e   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 A p p r o v e d B y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 U p d a t e T i m e   d a t e t i m e , 
 
 	 A u t h o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 K n o w l e d g e T y p e   i n t , 
 
 
 
 	 E d i t o r   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 E d i t o r P e r m i s s i o n   i n t , 
 
 
 
 	 K n o w l e d g e C o n t e n t I D   i n t , 
 
 
 
 	 - - T e m p l a t e   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 T i t l e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 - - T i t l e S h o w   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 C o n t e n t   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 T a g   n v a r c h a r ( 5 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 A b s t r a c t   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 
 
 	 H i t C o u n t   i n t , 
 
 	 C o m m e n t s P e r m i s s i o n   i n t , 
 
 	 C o m m e n t s C o u n t   i n t , 
 
 
 
 	 K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t   
 
 )   
 
 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ K n o w l e d g e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' K n o w l e d g e A p p r o v e ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  T y p e = 1 / 2   Q[TbO(u  O R D E R   B Y   S e r i a l   ؏/f  U p d a t e T i m e   NN$NkNxdN  O r d e r   B y   KNYvQ[0We[hQ N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ T y p e = 1 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 	 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w   
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 W H E R E   n o w . P a g e D i r e c t o r y I D = ( S e l e c t   T o p   1   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   H o m e = 1 )   
 
 
 
 	 	 O R D E R   B Y   S e r i a l 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b
0
N/f0  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w   
 
 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 W H E R E   n o w . P a g e D i r e c t o r y I D = ( S e l e c t   T o p   1   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   H o m e = 1 )   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 
 
 	 	 O R D E R   B Y   S e r i a l 
 
 	 E N D 
 
 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 	 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w   
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 W H E R E   n o w . P a g e D i r e c t o r y I D = ( S e l e c t   T o p   1   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   H o m e = 1 )   
 
 
 
 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b
0
N/f0  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w   
 
 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 W H E R E   n o w . P a g e D i r e c t o r y I D = ( S e l e c t   T o p   1   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   H o m e = 1 )   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 
 
 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSS_MRu,{ N*NT gT N*NU_vMOn
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F i r s t R e c o r d   i n t 
 
 D E C L A R E   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 S E T   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 
 
 S E T   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏVS_MRu-NvU_
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   	 
 
 	 * , 
 
 	 P a g e C o u n t = C E I L I N G ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) )   
 
 
 
 F R O M   @ P a g i n g   
 
 W H E R E   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \
0S_MRu0QYԏVvwƋ  C o n t e n t     v  H i t C o u n t   QV  K n o w l e d g e C o n t e n t   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i t C o u n t = I S N U L L ( H i t C o u n t , 0 ) + 1   W H E R E   K n o w l e d g e I D   I N   ( S e l e c t   [ I D ]   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d )   A N D   C u l t u r e = @ C u l t u r e 
 
 U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i t C o u n t = I S N U L L ( H i t C o u n t , 0 ) + 1   W H E R E   [ I D ]   I N   ( S e l e c t   K n o w l e d g e C o n t e n t I D   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d )   
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  S i t e L o g   -NU_(WHh  S_MR  P a g i n g   ̑b@b	gv  K n o w l e d g e C o n t e n t   S_MR  @ U s e r   OmȉN NN	
 
 - - = = S,g^S_O(u  S P   S i t e L o g S a v e   FO(Wُ̑YgO(u  S P   S i t e L o g S a v e   1\_{O(u'`^8^]v  C u r s o r :NNMQ  C u r o r   d\ObNُ̑vc  I n s e r t 
 
 - - = = la_{hg  @ U s e r   /f&T:Nzzcd*g{vU_(u7b_NOmȉv`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ U s e r < > N ' ' )   A N D   ( @ U s e r   I S   N O T   N U L L ) 
 
 B E G I N 
 
 	 I N S E R T   I N T O   d b o . S i t e L o g   ( [ U s e r ] , A c t i v i t y , T a r g e t I D , A c t i v i t y T i m e )   S E L E C T   @ U s e r , 1 , K n o w l e d g e C o n t e n t I D , G E T D A T E ( )   F R O M   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b~[  @ P a g e D i r e c t o r y N a m e   v  P a g e D i r e c t o r y   I D   T  K n o w l e d g e   v  K n o w l e d g e D i r e c t o r y   
TW[    R(uNR^   ewƋ   c	  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   T O P   1 
 
 
 
 	 p a d . [ I D ]   A S   P a g e D i r e c t o r y I D , 
 
 	 p a d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e , 
 
 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y , 
 
 
 
 	 I S N U L L ( p d c . O u t l i n e M o d e , 0 )   A S   O u t l i n e M o d e , 
 
 
 
 	 p d c . T i t l e   A S   T i t l e , 
 
 	 p d c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 p d c . P a g e H e a d e r   A S   P a g e H e a d e r , 
 
 	 p d c . P a g e F o o t e r   A S   P a g e F o o t e r , 
 
 
 
 	 s d c . P a g e H e a d e r   A S   S u b D i r e c t o r y P a g e H e a d e r , 
 
 	 s d c . P a g e F o o t e r   A S     S u b D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 m d c . P a g e H e a d e r   A S   M a i n D i r e c t o r y P a g e H e a d e r , 
 
 	 m d c . P a g e F o o t e r   A S     M a i n D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 p a d . T y p e   A S   T y p e , 
 
 	 p a d . P r e s e n t a t i o n   A S   P r e s e n t a t i o n , 
 
 	 p a d . J u m p T o C o n t e n t   A S   J u m p T o C o n t e n t , 
 
 
 
 	 p a d . S h o w T i t l e   A S   S h o w T i t l e , 
 
 	 p a d . S h o w A u t h o r   A S   S h o w A u t h o r , 
 
 	 p a d . S h o w U p d a t e T i m e   A S   S h o w U p d a t e T i m e , 
 
 	 p a d . S h o w H i t C o u n t   A S   S h o w H i t C o u n t , 
 
 	 p a d . S h o w C o m m e n t s   A S   S h o w C o m m e n t s , 
 
 	 p a d . S h o w S t a t i c U r l   A S   S h o w S t a t i c U r l , 
 
 	 p a d . S h o w K n o w l e d g e H t m l   A S   S h o w K n o w l e d g e H t m l , 
 
 	 p a d . S h o w R e l a t i v e   A S   S h o w R e l a t i v e 
 
 
 
 	 - - p a d . O v e r v i e w   A S   P a g e D i r e c t o r y O v e r v i e w , 
 
 	 - - s d . O v e r v i e w   A S   S u b D i r e c t o r y O v e r v i e w , 
 
 	 - - ( S e l e c t   C O U N T ( d p d . [ I D ] )   F r o m   d b o . P a g e D i r e c t o r y   d p d   W h e r e   d p d . S u b D i r e c t o r y I D = ( s d . [ I D ] ) )   A S   P a g e D i r e c t o r y B r o t h e r s C o u n t , 
 
 	 - - ( S e l e c t   C O U N T ( d s d . [ I D ] )   F r o m   d b o . S u b D i r e c t o r y   d s d   W h e r e   d s d . M a i n D i r e c t o r y I D = ( m d . [ I D ] ) )   A S   S u b D i r e c t o r y B r o t h e r s C o u n t 
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y   p a d 
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   O N   p d c . P a g e D i r e c t o r y I D = p a d . [ I D ]   A N D   p d c . C u l t u r e = @ C u l t u r e 
 
 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p a d . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d c . S u b D i r e c t o r y I D = s d . [ I D ] 
 
 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d c . M a i n D i r e c t o r y I D = m d . [ I D ] 
 
 
 
 W H E R E   p a d . H o m e = 1 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e G e t H o m e P a g e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U n i q u e N u m b e r G e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U n i q u e N u m b e r G e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U n i q u e N u m b e r G e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  U n i q u e N u m b e r   hQS_MR ge  N u m b e r     N u m b e r   \(W  A S P X   z(ueg:Nev  M a i n D i r e c t o r y ,   S u b D i r e c t o r y ,   P u g e D i r e c t o r y ,   C o m m u n i t y ,   F o r u m   }T
T
 
 - - = = 6qTbNzsS\ُ*N  N u m b e r   +   1 NN N!k
 
 - - = = bNvvv/fONUOePN  U n i q u e N u m b e r   h_v/fr NeNv N*N  N u m b e r O|~-NTy  < x x x > D i r e c t o r y ,   C o m m u n i t y ,   F o r u m   }T
T
N͑
Y
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 1 - 0 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U n i q u e N u m b e r G e t 
 
 
 
 @ N u m b e r   I N T   O U T 	 	 	 - - ԏVv~g
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ N u m b e r = [ N u m b e r ]   F R O M   d b o . [ U n i q u e N u m b e r ] 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSfe
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ U n i q u e N u m b e r ]     S E T   [ N u m b e r ] = [ N u m b e r ] + 1 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U n i q u e N u m b e r G e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y M o v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y M o v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y M o v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = yR  S u b D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y M o v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e I t e m   i n t , 	 	 	 	 - - S_MR  S u b D i r e c t o r y   v  I D 
 
 
 
 @ K n o w l e d g e D i r e c t o r y T a r g e t   n v a r c h a r ( 2 0 0 ) , 	 - - yR0RT~pM a i n D i r e c t o r y   -   /U N  	
 
 @ K n o w l e d g e I t e m T a r g e t   i n t , 	 	 	 - - yR0RT N*NpI D 	
 
 
 
 @ C l o n e   i n t 	 	 	 	 	 - - /f&T
Y6R1 / 0 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' S u b D i r e c t o r y ' , @ K n o w l e d g e I t e m , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 I F   @ C l o n e = 0   
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = yR
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   M a i n D i r e c t o r y I D = @ K n o w l e d g e I t e m T a r g e t   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = :Ne
Y6Rv  S u b D i r e c t o r y   w N*Ne
TW[
TW[
N͑
Y	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ U n i q u e N u m b e r   I N T 
 
 	 	 E X E C   d b o . U n i q u e N u m b e r G e t   @ U n i q u e N u m b e r   O U T 
 
 
 
 	 	 D E C L A R E   @ N e w S u b D i r e c t o r y N a m e   N V A R C H A R ( 5 0 ) 
 
 	 	 S E T   @ N e w S u b D i r e c t o r y N a m e = N ' s '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ U n i q u e N u m b e r ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 
Y6R  S u b D i r e c t o r y 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . S u b D i r e c t o r y ( M a i n D i r e c t o r y I D , S e r i a l , [ N a m e ] , N e w W i n d o w , O v e r v i e w , W i z a r d , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n )   S E L E C T   @ K n o w l e d g e I t e m T a r g e t , S e r i a l , @ N e w S u b D i r e c t o r y N a m e , N e w W i n d o w , O v e r v i e w , W i z a r d , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n   F R O M   d b o . S u b D i r e c t o r y   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = _e
Y6Rv  S u b D i r e c t o r y   v  I D     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ N e w S u b D i r e c t o r y I D   I N T     
 
 	 	 S E L E C T   @ N e w S u b D i r e c t o r y I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	        
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 
Y6R  S u b D i r e c t o r y   C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . S u b D i r e c t o r y C o n t e n t   ( S u b D i r e c t o r y I D , C u l t u r e , T i t l e , [ D e s c r i p t i o n ] , W i z a r d P r e v i o u s T i t l e , W i z a r d N e x t T i t l e , H i d d e n , H i d d e n I n N a v i g a t i o n O n l y , P a g e H e a d e r , P a g e F o o t e r , U r l , T h i s I s L i n k )   S E L E C T     @ N e w S u b D i r e c t o r y I D , C u l t u r e , T i t l e , [ D e s c r i p t i o n ] , W i z a r d P r e v i o u s T i t l e , W i z a r d N e x t T i t l e , H i d d e n , H i d d e n I n N a v i g a t i o n O n l y , P a g e H e a d e r , P a g e F o o t e r , U r l , T h i s I s L i n k     F R O M   d b o . S u b D i r e c t o r y C o n t e n t   W H E R E   S u b D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = (u  P a g e D i r e c t o r y M o v e   S P   eg
Y6R  P a g e D i r e c t o r y   T  P a g e D i r e c t o r y C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = \S_MR    S u b D i r e c t o r y I D   Nv  P a g e D i r e c t o r y   U_lbc:N  C U R S O R     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ P a g e D i r e c t o r y I D   I N T     
 
 	 	 D E C L A R E   P a g e D i r e c t o r y M o v e C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ]   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   S u b D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 	 	 O P E N   P a g e D i r e c t o r y M o v e C u r s o r     
 
 	 	 F E T C H   N E X T   F R O M   P a g e D i r e c t o r y M o v e C u r s o r   I N T O   @ P a g e D i r e c t o r y I D     
 
     
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0     
 
 	 	 B E G I N     
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 - - = = (u  S P   P a g e D i r e c t o r y M o v e 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 E X E C   d b o . P a g e D i r e c t o r y M o v e   @ U s e r , @ P a g e D i r e c t o r y I D , N ' S u b D i r e c t o r y ' ,   @ N e w S u b D i r e c t o r y I D ,   1 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 - - = = ~~N*N  C U R S O R     
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 F E T C H   N E X T   F R O M   P a g e D i r e c t o r y M o v e C u r s o r   I N T O   @ P a g e D i r e c t o r y I D     
 
 	 	 E N D     
 
     
 
 	 	 C L O S E   P a g e D i r e c t o r y M o v e C u r s o r     
 
 	 	 D E A L L O C A T E   P a g e D i r e c t o r y M o v e C u r s o r     
 
 
 
 	 E N D 
 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y M o v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y M o v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y M o v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y M o v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = yR  P a g e D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y M o v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e I t e m   i n t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  I D 
 
 
 
 @ K n o w l e d g e D i r e c t o r y T a r g e t   n v a r c h a r ( 2 0 0 ) , 	 - - yR0RT~pM a i n D i r e c t o r y   |   S u b D i r e c t o r y   	
 
 @ K n o w l e d g e I t e m T a r g e t   i n t , 	 	 	 - - yR0RT N*NpI D 	
 
 
 
 @ C l o n e   i n t 	 	 	 	 	 - - /f&T
Y6R1 / 0 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' P a g e D i r e c t o r y ' , @ K n o w l e d g e I t e m , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/fyR
N/fKQ	NyRv  P a g e D i r e c t o r y   /fvQ6r  S u b D i r e c t o r y   Nv/U N  P a g e D i r e c t o r y R>NccQ  l	cvMRv:g6Rُy`b_SuvS'`/f
NX[(WvV:N  S u b D i r e c t o r y   yN^	g N*N  O v e r v i e w P a g e D i r e c t o r y 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ C l o n e = 0 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = YgS_MRsS\yRv  P a g e D i r e c t o r y   /fvQ6r  S u b D i r e c t o r y   Nv/U NU_>N
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E C L A R E   @ S u b D i r e c t o r y I D   I N T 
 
 	 S E L E C T   @ S u b D i r e c t o r y I D = p d . S u b D i r e c t o r y I D   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . [ I D ] = @ K n o w l e d g e I t e m 
 
 	 
 
 	 D E C L A R E   @ C o u n t   I N T 
 
 	 S E L E C T   @ C o u n t = C O U N T ( p d . [ I D ] )   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D 
 
 	 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = Yg/f/U Nv  P a g e D i r e c t o r y   yvR>N&TRRck8^ Rd
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F   @ C o u n t < = 1 
 
 	 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = >N
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 R A I S E R R O R ( N ' `sS\yRvuvU_/fvQ
N~vU_P[vU_	N/U NN~agv
NSNyR' , 1 6 , 1 ) 
 
 	 E N D 
 
 
 
 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z     
 
 
 
     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = RyR0R  M a i n D i r e c t o r y   |   S u b D i r e c t o r y     $Ny`b_{yR0Rv  T a r g e t   S u b D i r e c t o r y   v  I D     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 D E C L A R E   @ M o v e T o S u b D i r e c t o r y I D   I N T     
 
     
 
 I F   @ K n o w l e d g e D i r e c t o r y T a r g e t = N ' M a i n D i r e c t o r y '     
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = Yg/f\  P a g e D i r e c t o r y   yR0R  M a i n D i r e c t o r y   L e v e l RbN (W  M a i n D i r e c t o r y   Nbs^m N*N  S u b D i r e c t o r y   vQ  T i t l e   I{^\'`~b  P a g e D i r e c t o r y   v	\  M o v e   vP a g e D i r e c t o r y   c0Rُ*NeXv  S u b D i r e c t o r y   NTe\  P a g e D i r e c t o r y     n:N  O v e r v i e w 
 
 	 	 - - = = R^KNMRHQRYS NN^\'`
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ N e w S u b D i r e c t o r y S e r i a l   I N T 
 
 	 	 S E L E C T   @ N e w S u b D i r e c t o r y S e r i a l = M A X ( s d . S e r i a l ) + 1   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . M a i n D i r e c t o r y I D = @ K n o w l e d g e I t e m T a r g e t 
 
 
 
 	 	 D E C L A R E   @ N e w S u b D i r e c t o r y U n i q u e N u m b e r   I N T 
 
 	 	 E X E C   d b o . U n i q u e N u m b e r G e t   @ N e w S u b D i r e c t o r y U n i q u e N u m b e r   O U T 
 
 
 
 	 	 D E C L A R E   @ N e w S u b D i r e c t o r y N a m e   N V A R C H A R ( 1 0 0 ) 
 
 	 	 S E L E C T   @ N e w S u b D i r e c t o r y N a m e = N ' s '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ N e w S u b D i r e c t o r y U n i q u e N u m b e r ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = =  _YR^ُ*N  S u b D i r e c t o r y 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ o N e w S u b D i r e c t o r y I D   I N T 
 
 	 	 E X E C   d b o . S u b D i r e c t o r y S a v e   @ U s e r , @ K n o w l e d g e I t e m T a r g e t , @ N e w S u b D i r e c t o r y S e r i a l , @ N e w S u b D i r e c t o r y N a m e , N ' ' , 0 , 0 , 0 , N ' ' , N ' ' , N ' ' , @ o N e w S u b D i r e c t o r y I D   O U T 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = =  _YR^ُ*N  S u b D i r e c t o r y   NT*Nyv  S u b D i r e c t o r y C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ C u l t u r e   N V A R C H A R ( 1 0 0 )     
 
 	 	 D E C L A R E   C u l t u r e s _ C u r s o r   C U R S O R   F O R   S E L E C T   C u l t u r e   F R O M   d b o . U D F _ P u b l i c C u l t u r e s ( )     
 
 	 	 O P E N   C u l t u r e s _ C u r s o r     
 
 	 	 F E T C H   N E X T   F R O M   C u l t u r e s _ C u r s o r   I N T O   @ C u l t u r e     
 
 	 	     
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S = 0     
 
 
 
 	 	 B E G I N     
 
 
 
 	 	 	   - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	   - - = = S_MRyyR  P a g e D i r e c t o r y   v  T i t l e ,   D e s c r i p t i o n 
 
 	 	 	   - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 D E C L A R E   @ N e w S u b D i r e c t o r y C o n t e n t T i t l e   N V A R C H A R ( 2 0 0 ) 
 
 	 	 	 D E C L A R E   @ N e w S u b D i r e c t o r y C o n t e n t D e s c r i p t i o n   N V A R C H A R ( 1 0 0 0 ) 
 
 	 	 	 S E L E C T   @ N e w S u b D i r e c t o r y C o n t e n t T i t l e = p d c . T i t l e ,   @ N e w S u b D i r e c t o r y C o n t e n t D e s c r i p t i o n = p d c . [ D e s c r i p t i o n ]   F R O M   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   W H E R E   p d c . P a g e D i r e c t o r y I D = @ K n o w l e d g e I t e m   A N D   p d c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 	   - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	   - - = = R^S_MRyNeR^v  S u b D i r e c t o r y   v  S u b D i r e c t o r y C o n t e n t 
 
 	 	 	   - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 D E C L A R E   @ o N e w S u b D i r e c t o r y C o n t e n t I D   I N T 
 
 	 	 	 E X E C   d b o . S u b D i r e c t o r y C o n t e n t S a v e   @ U s e r , @ o N e w S u b D i r e c t o r y I D , @ N e w S u b D i r e c t o r y C o n t e n t T i t l e , @ N e w S u b D i r e c t o r y C o n t e n t D e s c r i p t i o n , N ' ' , N ' ' , 0 , 0 , N ' ' , N ' ' , N ' G e t K n o w l e d g e . a s p x ' , 0 , @ C u l t u r e , @ o N e w S u b D i r e c t o r y C o n t e n t I D 
 
 
 
 	 	 	   - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	   - - = = N N*Ny    
 
 	 	 	   - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	   F E T C H   N E X T   F R O M   C u l t u r e s _ C u r s o r   I N T O   @ C u l t u r e     
 
 	 	     
 
 	 	 E N D     
 
 	 	     
 
 	 	 C L O S E     C u l t u r e s _ C u r s o r     
 
 	 	 D E A L L O C A T E     C u l t u r e s _ C u r s o r     
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = eR^vُ*N  S u b D i r e c t o r y   v  I D   \O:N  @ M o v e T o S u b D i r e c t o r y I D 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 S E L E C T   @ M o v e T o S u b D i r e c t o r y I D = @ o N e w S u b D i r e c t o r y I D 
 
 
 
 	 E N D 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y T a r g e t = N ' S u b D i r e c t o r y '     
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = vcS  @ K n o w l e d g e I t e m T a r g e t   \O:N  @ o N e w S u b D i r e c t o r y I D 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 S E L E C T   @ M o v e T o S u b D i r e c t o r y I D = @ K n o w l e d g e I t e m T a r g e t 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = R  
0  yR  /   KQ0    $Ny`b_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 I F   @ C l o n e = 0   
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 
0yR0
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S u b D i r e c t o r y I D = @ M o v e T o S u b D i r e c t o r y I D   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg,g  P a g e D i r e c t o r y   yRvvv0W  L e v e l   /f  M a i n D i r e c t o r y RgbL NN  P a g e D i r e c t o r y S e t O v e r v i e w   vS_N\,g  P a g e D i r e c t o r y   cGS0R  M a i n D i r e c t o r y   N	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ K n o w l e d g e D i r e c t o r y T a r g e t = N ' M a i n D i r e c t o r y '     
 
 
 
 	 	 B E G I N 
 
 	 	 	 E X E C   d b o . P a g e D i r e c t o r y S e t O v e r v i e w   @ U s e r , @ K n o w l e d g e I t e m 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 
0KQ0
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = :Ne
Y6Rv  P a g e D i r e c t o r y   w N*Ne
TW[
TW[
N͑
Y	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ N e w P a g e D i r e c t o r y U n i q u e N u m b e r   I N T 
 
 	 	 E X E C   d b o . U n i q u e N u m b e r G e t   @ N e w P a g e D i r e c t o r y U n i q u e N u m b e r   O U T 
 
 
 
 	 	 D E C L A R E   @ N e w P a g e D i r e c t o r y N a m e   N V A R C H A R ( 5 0 ) 
 
 	 	 S E T   @ N e w P a g e D i r e c t o r y N a m e = N ' p '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ N e w P a g e D i r e c t o r y U n i q u e N u m b e r ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 
Y6R  P a g e D i r e c t o r y 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . P a g e D i r e c t o r y ( S u b D i r e c t o r y I D , S e r i a l , [ N a m e ] , P a g e S i z e , N e w W i n d o w , O v e r v i e w , F a s t A c c e s s , H o m e , R i g h t I n d e n t , j Q u e r y , L o g o H i d e , M a i n M e n u H i d e , B a n n e r H i d e , B r e a d c r u m b H i d e , P a g e M e n u H i d e , P a g e B a r H i d e , C o p y r i g h t H i d e , T y p e , P r e s e n t a t i o n , J u m p T o C o n t e n t , S h o w T i t l e , S h o w A u t h o r , S h o w U p d a t e T i m e , S h o w H i t C o u n t , S h o w C o m m e n t s , S h o w S t a t i c U r l , S h o w K n o w l e d g e H t m l , S h o w R e l a t i v e , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n )   S E L E C T   @ M o v e T o S u b D i r e c t o r y I D , S e r i a l , @ N e w P a g e D i r e c t o r y N a m e , P a g e S i z e , N e w W i n d o w , O v e r v i e w , F a s t A c c e s s , 0 , R i g h t I n d e n t , j Q u e r y , L o g o H i d e , M a i n M e n u H i d e , B a n n e r H i d e , B r e a d c r u m b H i d e , P a g e M e n u H i d e , P a g e B a r H i d e , C o p y r i g h t H i d e , T y p e , P r e s e n t a t i o n , J u m p T o C o n t e n t , S h o w T i t l e , S h o w A u t h o r , S h o w U p d a t e T i m e , S h o w H i t C o u n t , S h o w C o m m e n t s , S h o w S t a t i c U r l , S h o w K n o w l e d g e H t m l , S h o w R e l a t i v e , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n     F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = _e
Y6Rv  P a g e D i r e c t o r y   v  I D     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ N e w P a g e D i r e c t o r y I D   I N T     
 
 	 	 S E L E C T   @ N e w P a g e D i r e c t o r y I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	        
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg,g  P a g e D i r e c t o r y   
Y6Rvvv0W  L e v e l   /f  M a i n D i r e c t o r y RgbL NN  P a g e D i r e c t o r y S e t O v e r v i e w   vS_N\,g  P a g e D i r e c t o r y   cGS0R  M a i n D i r e c t o r y   N	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ K n o w l e d g e D i r e c t o r y T a r g e t = N ' M a i n D i r e c t o r y '     
 
 	 	 
 
 	 	 B E G I N 
 
 	 	 	 E X E C   d b o . P a g e D i r e c t o r y S e t O v e r v i e w   @ U s e r , @ N e w P a g e D i r e c t o r y I D 
 
 	 	 E N D 
 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 
Y6R  P a g e D i r e c t o r y   C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . P a g e D i r e c t o r y C o n t e n t   ( P a g e D i r e c t o r y I D , C u l t u r e , S e o T i t l e , S e o D e s c r i p t i o n , S e o K e y w o r d s , T i t l e , [ D e s c r i p t i o n ] , T e m p l a t e , H i d d e n , H i d d e n I n N a v i g a t i o n O n l y , P a g e H e a d e r , P a g e F o o t e r , U r l , T h i s I s L i n k )   S E L E C T     @ N e w P a g e D i r e c t o r y I D , C u l t u r e , S e o T i t l e , S e o D e s c r i p t i o n , S e o K e y w o r d s , T i t l e , [ D e s c r i p t i o n ] , T e m p l a t e , H i d d e n , H i d d e n I n N a v i g a t i o n O n l y , P a g e H e a d e r , P a g e F o o t e r , U r l , T h i s I s L i n k     F R O M   d b o . P a g e D i r e c t o r y C o n t e n t   W H E R E   P a g e D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = (u  K n o w l e d g e M o v e   S P   eg
Y6R  K n o w l e d g e   T  K n o w l e d g e C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = \S_MR    P a g e D i r e c t o r y I D   Nv  K n o w l e d g e   U_lbc:N  C U R S O R     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ K n o w l e d g e I D   I N T     
 
 	 	 D E C L A R E   K n o w l e d g e M o v e C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ]   F R O M   d b o . K n o w l e d g e   W H E R E   P a g e D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 	 	 O P E N   K n o w l e d g e M o v e C u r s o r     
 
 	 	 F E T C H   N E X T   F R O M   K n o w l e d g e M o v e C u r s o r   I N T O   @ K n o w l e d g e I D     
 
     
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0     
 
 	 	 B E G I N     
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 - - = = (u  S P   K n o w l e d g e M o v e 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 E X E C   d b o . K n o w l e d g e M o v e   @ U s e r ,   @ K n o w l e d g e I D ,   N ' P a g e D i r e c t o r y ' , @ N e w P a g e D i r e c t o r y I D ,   1 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 - - = = ~~N*N  C U R S O R     
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 F E T C H   N E X T   F R O M   K n o w l e d g e M o v e C u r s o r   I N T O   @ K n o w l e d g e I D     
 
 	 	 E N D     
 
     
 
 	 	 C L O S E   K n o w l e d g e M o v e C u r s o r     
 
 	 	 D E A L L O C A T E   K n o w l e d g e M o v e C u r s o r     
 
 
 
 	 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y M o v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e M o v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e M o v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e M o v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = yR  K n o w l e d g e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e M o v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e I t e m   i n t , 	 	 	 	 	 - - S_MRyRv  K n o w l e d g e     v  I D 
 
 
 
 @ K n o w l e d g e D i r e c t o r y T a r g e t   n v a r c h a r ( 2 0 0 ) , 	 	 - - yR0RT~pM a i n D i r e c t o r y   |   S u b D i r e c t o r y   |   P a g e D i r e c t o r y 	
 
 @ K n o w l e d g e I t e m T a r g e t   i n t , 	 	 	 	 - - yR0RT N*NpI D 	
 
 
 
 @ C l o n e   i n t 	 	 	 	 	 	 - - /f&T
Y6R1 / 0 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' K n o w l e d g e ' , @ K n o w l e d g e I t e m , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = RyR0R  M a i n D i r e c t o r y   |   S u b D i r e c t o r y   |   P a g e D i r e c t o r y   	Ny`b_{yR0Rv  T a r g e t   P a g e D i r e c t o r y   v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e D i r e c t o r y I D   I N T 
 
 
 
 I F   @ K n o w l e d g e D i r e c t o r y T a r g e t = N ' M a i n D i r e c t o r y ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQ\ՋԏV  M a i n D i r e c t o r y   [^v  O v e r v i e w P a g e D i r e c t o r y I D YgI{N  0   fS_MR  M a i n D i r e c t o r y   N
NX[(W  O v e r v i e w S u b D i r e c t o r y   T  O v e r v i e w P a g e D i r e c t o r y R R^KN
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( @ K n o w l e d g e D i r e c t o r y T a r g e t , @ K n o w l e d g e I t e m T a r g e t ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = YgS_MR  M a i n D i r e c t o r y   N
NX[(W  O v e r v i e w S u b D i r e c t o r y   T  O v e r v i e w P a g e D i r e c t o r y R R^KN
NX[(Wvh_/f  d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( )   ԏV  0 	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ P a g e D i r e c t o r y I D = 0 
 
 
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = R^  O v e r v i e w S u b D i r e c t o r y   T  O v e r v i e w P a g e D i r e c t o r y 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 D E C L A R E   @ o N e w S u b D i r e c t o r y I D   I N T 
 
 	 	 	 D E C L A R E   @ o N e w S u b D i r e c t o r y C o n t e n t I D   I N T 
 
 
 
 	 	 	 S E L E C T   @ o N e w S u b D i r e c t o r y I D = 0 
 
 	 	 	 S E L E C T   @ o N e w S u b D i r e c t o r y C o n t e n t I D = 0 
 
 
 
 	 	 	 E X E C   d b o . M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y   @ U s e r , @ K n o w l e d g e I t e m T a r g e t , N ' ' , @ o N e w S u b D i r e c t o r y I D   O U T 
 
 	 	 	 E X E C   d b o . M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y C o n t e n t   @ U s e r , @ o N e w S u b D i r e c t o r y I D , @ o N e w S u b D i r e c t o r y C o n t e n t I D   O U T 
 
 
 
 	 	 	 D E C L A R E   @ o N e w P a g e D i r e c t o r y I D   I N T 
 
 	 	 	 D E C L A R E   @ o N e w P a g e D i r e c t o r y C o n t e n t I D   I N T 
 
 
 
 	 	 	 S E L E C T   @ o N e w P a g e D i r e c t o r y I D = 0 
 
 	 	 	 S E L E C T   @ o N e w P a g e D i r e c t o r y C o n t e n t I D = 0 
 
 
 
 	 	 	 E X E C   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y   @ U s e r , @ o N e w S u b D i r e c t o r y I D , N ' ' , @ o N e w P a g e D i r e c t o r y I D   O U T 
 
 	 	 	 E X E C   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y C o n t e n t   @ U s e r , @ o N e w P a g e D i r e c t o r y I D , @ o N e w P a g e D i r e c t o r y C o n t e n t I D   O U T 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Q!kS  O v e r v i e w P a g e D i r e c t o r y I D 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 S E L E C T   @ P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( @ K n o w l e d g e D i r e c t o r y T a r g e t , @ K n o w l e d g e I t e m T a r g e t ) 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y T a r g e t = N ' S u b D i r e c t o r y ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQ\ՋԏV  S u b D i r e c t o r y   [^v  O v e r v i e w P a g e D i r e c t o r y I D YgI{N  0   fS_MR  S u b D i r e c t o r y   N
NX[(W  O v e r v i e w P a g e D i r e c t o r y R R^KN
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( @ K n o w l e d g e D i r e c t o r y T a r g e t , @ K n o w l e d g e I t e m T a r g e t ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = YgS_MR  S u b D i r e c t o r y   N
NX[(W    O v e r v i e w P a g e D i r e c t o r y R R^KN
NX[(Wvh_/f  d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( )   ԏV  0 	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ P a g e D i r e c t o r y I D = 0 
 
 
 
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = R^  O v e r v i e w S u b D i r e c t o r y   T  O v e r v i e w P a g e D i r e c t o r y 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 D E C L A R E   @ o N e w P a g e D i r e c t o r y I D 2   I N T 
 
 	 	 	 D E C L A R E   @ o N e w P a g e D i r e c t o r y C o n t e n t I D 2   I N T 
 
 
 
 	 	 	 S E L E C T   @ o N e w P a g e D i r e c t o r y I D 2 = 0 
 
 	 	 	 S E L E C T   @ o N e w P a g e D i r e c t o r y C o n t e n t I D 2 = 0 
 
 
 
 	 	 	 E X E C   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y   @ U s e r , @ K n o w l e d g e I t e m T a r g e t , N ' ' , @ o N e w P a g e D i r e c t o r y I D 2   O U T 
 
 	 	 	 E X E C   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y C o n t e n t   @ U s e r , @ o N e w P a g e D i r e c t o r y I D 2 , @ o N e w P a g e D i r e c t o r y C o n t e n t I D 2   O U T 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Q!kS  O v e r v i e w P a g e D i r e c t o r y I D 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 S E L E C T   @ P a g e D i r e c t o r y I D = d b o . U D F _ G e t O v e r v i e w P a g e D i r e c t o r y ( @ K n o w l e d g e D i r e c t o r y T a r g e t , @ K n o w l e d g e I t e m T a r g e t ) 
 
 	 	 E N D 
 
 	 E N D 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y T a r g e t = N ' P a g e D i r e c t o r y ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 S E L E C T   @ P a g e D i r e c t o r y I D = @ K n o w l e d g e I t e m T a r g e t 
 
 
 
 	 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = /f&TKQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ C l o n e = 0   
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = yR
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . K n o w l e d g e   S E T   P a g e D i r e c t o r y I D = @ P a g e D i r e c t o r y I D   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 
Y6R  K n o w l e d g e 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . K n o w l e d g e   ( P a g e D i r e c t o r y I D , S e r i a l , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n , U p d a t e T i m e , A u t h o r , K n o w l e d g e T y p e )   S E L E C T   @ P a g e D i r e c t o r y I D , S e r i a l , E d i t o r , D e d i c a t e d T o , C o m m e n t s P e r m i s s i o n , U p d a t e T i m e , A u t h o r , K n o w l e d g e T y p e   F R O M   d b o . K n o w l e d g e   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = _e
Y6Rv  K n o w l e d g e   I D     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ N e w K n o w l e d g e I D   I N T     
 
 	 	 S E L E C T   @ N e w K n o w l e d g e I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	        
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \  @ K n o w l e d g e I t e m   Nv  K n o w l e d g e C o n t e n t   	eQ  C U R S O R 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ K n o w l e d g e C o n t e n t I D   I N T 
 
 	 	 D E C L A R E   K n o w l e d g e C o n t e n t _ C u r s o r   C U R S O R   F O R   S E L E C T   n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   n o w c   W H E R E   n o w c . K n o w l e d g e I D = @ K n o w l e d g e I t e m 
 
 	 	 
 
 	 	 O P E N   K n o w l e d g e C o n t e n t _ C u r s o r 
 
 	 	 F E T C H   N E X T   F R O M   K n o w l e d g e C o n t e n t _ C u r s o r   I N T O   @ K n o w l e d g e C o n t e n t I D 
 
 
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 	 	 B E G I N 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = 
Y6RS_MR  @ K n o w l e d g e C o n t e n t I D   Nv    K n o w l e d g e C o n t e n t 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - I N S E R T   I N T O   d b o . K n o w l e d g e C o n t e n t   ( K n o w l e d g e I D , C u l t u r e , T e m p l a t e , T i t l e , T i t l e S h o w ,     C o n t e n t , T a g ,   H i d d e n ,   A p p r o v e d ,   A p p r o v e M e s s a g e ,   A p p r o v e d B y ,   A b s t r a c t , H i t C o u n t )   S E L E C T   @ N e w K n o w l e d g e I D , C u l t u r e , T e m p l a t e , T i t l e , T i t l e S h o w ,     C o n t e n t , T a g ,   H i d d e n ,   A p p r o v e d ,   A p p r o v e M e s s a g e ,   A p p r o v e d B y ,   A b s t r a c t , 0   F R O M   d b o . K n o w l e d g e C o n t e n t   W H E R E   [ I D ] = @ K n o w l e d g e C o n t e n t I D 
 
 	 	 	 I N S E R T   I N T O   d b o . K n o w l e d g e C o n t e n t   ( K n o w l e d g e I D , C u l t u r e , T i t l e ,   C o n t e n t , T a g ,   H i d d e n ,   A p p r o v e d ,   A p p r o v e M e s s a g e ,   A p p r o v e d B y ,   A b s t r a c t , H i t C o u n t )   S E L E C T   @ N e w K n o w l e d g e I D , C u l t u r e , T i t l e ,   C o n t e n t , T a g ,   H i d d e n ,   A p p r o v e d ,   A p p r o v e M e s s a g e ,   A p p r o v e d B y ,   A b s t r a c t , 0   F R O M   d b o . K n o w l e d g e C o n t e n t   W H E R E   [ I D ] = @ K n o w l e d g e C o n t e n t I D 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = _e
Y6Rv  K n o w l e d g e C o n t e n t   I D     
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 D E C L A R E   @ N e w K n o w l e d g e C o n t e n t I D   I N T     
 
 	 	 	 S E L E C T   @ N e w K n o w l e d g e C o n t e n t I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e s s i o n   Qv,gh	        
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = 
Y6R  K n o w l e d g e C o m m e n t s   
N_N	
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = 
Y6R  K n o w l e d g e T a g s   
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I N S E R T   I N T O   d b o . K n o w l e d g e T a g s ( K n o w l e d g e C o n t e n t I D , T a g )   S E L E C T   @ N e w K n o w l e d g e C o n t e n t I D , T a g   F R O M   d b o . K n o w l e d g e T a g s   W H E R E   K n o w l e d g e C o n t e n t I D = @ K n o w l e d g e C o n t e n t I D 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = F E T C H   N E X T 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 F E T C H   N E X T   F R O M   K n o w l e d g e C o n t e n t _ C u r s o r   I N T O   @ K n o w l e d g e C o n t e n t I D 
 
 	 	 E N D 
 
 
 
 	 	 C L O S E   K n o w l e d g e C o n t e n t _ C u r s o r 
 
 	 	 D E A L L O C A T E   K n o w l e d g e C o n t e n t _ C u r s o r 
 
 
 
 	 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e M o v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o r u m M o v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o r u m M o v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o r u m M o v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = yR  F o r u m 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o r u m M o v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C o m m u n i t y I t e m   i n t , 	 	 	 - - S_MR  C o m m u n i t y   /   F o r u m     v  I D 
 
 @ C o m m u n i t y D i r e c t o r y T a r g e t   i n t , 	 	 - - yR0RT*N
N~pI D 	
 
 @ C l o n e   i n t 	 	 	 	 - - /f&T
Y6R1 / 0 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 I F   @ C l o n e = 0   
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = yR
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . F o r u m   S E T   C o m m u n i t y I D = @ C o m m u n i t y D i r e c t o r y T a r g e t   W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = :Ne
Y6Rv  F o r u m   n N*Ne
TW[  
NO(uT N*N
TW[	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ U n i q u e N u m b e r   I N T 
 
 	 	 E X E C   d b o . U n i q u e N u m b e r G e t   @ U n i q u e N u m b e r   O U T 
 
 
 
 	 	 D E C L A R E   @ N e w F o r u m N a m e   N V A R C H A R ( 5 0 ) 
 
 	 	 S E T   @ N e w F o r u m N a m e = N ' f '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ U n i q u e N u m b e r ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 
Y6R  F o r u m 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . F o r u m   ( C o m m u n i t y I D , S e r i a l , [ N a m e ] , M o d e r a t o r , [ P u b l i c ] , R e a d P e r m i s s i o n , T o p i c W r i t e P e r m i s s i o n , F o l l o w U p W r i t e P e r m i s s i o n )   S E L E C T     @ C o m m u n i t y D i r e c t o r y T a r g e t , S e r i a l , @ N e w F o r u m N a m e , M o d e r a t o r , [ P u b l i c ] , R e a d P e r m i s s i o n , T o p i c W r i t e P e r m i s s i o n , F o l l o w U p W r i t e P e r m i s s i o n   F R O M   d b o . F o r u m   W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = _e
Y6Rv  F o r u m   I D     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ N e w F o r u m I D   I N T     
 
 	 	 S E L E C T   @ N e w F o r u m I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	        
 
 
 
 	 	 D E C L A R E   @ N e w F o r u m I D S t r i n g   N V A R C H A R ( 4 0 0 0 ) 
 
 	 	 S E T   @ N e w F o r u m I D S t r i n g = C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , @ N e w F o r u m I D ) 	 	     
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 
Y6R  F o r u m   C o n t e n t 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   d b o . F o r u m C o n t e n t   
 
 
 
 	 	 ( 
 
 	 	 	 F o r u m I D , 
 
 	 	 	 C u l t u r e , 
 
 	 	 	 T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] , 
 
 	 	 	 H i d d e n , 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t , 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e A d d , 
 
 	 	 	 C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n , 
 
 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t S t i c k y T o p i c 
 
 	 	 )   
 
 
 
 	 	 S E L E C T     
 
 
 
 	 	 	 @ N e w F o r u m I D , 
 
 	 	 	 C u l t u r e , 
 
 	 	 	 T i t l e , 
 
 	 	 	 [ D e s c r i p t i o n ] , 
 
 	 	 	 H i d d e n , 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t , 
 
 	 	 	 C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e A d d , 
 
 	 	 	 C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y , 
 
 	 	 	 C o m m a n d T i t l e Q u e r y D e s c r i p t i o n   , 
 
 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E m p t y T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S o l i d T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n H o t T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n E l i t e T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n T a b o o T o p i c , 
 
 	 	 	 T o p i c S t a t u s C u s t o m i z a t i o n S t i c k y T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t E l i t e T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t T a b o o T o p i c , 
 
 	 	 	 T o p i c C o m m a n d S e t S t i c k y T o p i c   
 
 
 
 	 	 F R O M   d b o . F o r u m C o n t e n t   
 
 	 	 W H E R E   F o r u m I D = @ C o m m u n i t y I t e m 
 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 	 	 - - = = (u  T o p i c M o v e   S P   eg
Y6R  T o p i c   T  F o l l o w u p 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = \S_MR    F o r u m I D   Nv  T o p i c   U_lbc:N  C U R S O R     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ T o p i c I D   I N T     
 
 	 	 D E C L A R E   T o p i c C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ]   F R O M   d b o . T o p i c   W H E R E   F o r u m I D = @ C o m m u n i t y I t e m 
 
 	 	 O P E N   T o p i c C u r s o r     
 
 	 	 F E T C H   N E X T   F R O M   T o p i c C u r s o r   I N T O   @ T o p i c I D     
 
     
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0     
 
 	 	 B E G I N     
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 - - = = (u  S P   T o p i c M o v e 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 E X E C   d b o . T o p i c M o v e   @ U s e r ,   @ T o p i c I D ,   @ N e w F o r u m I D S t r i n g ,   N ' t r u e ' 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 - - = = ~~N*N  C U R S O R     
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 	 F E T C H   N E X T   F R O M   T o p i c C u r s o r   I N T O   @ T o p i c I D     
 
 	 	 E N D     
 
     
 
 	 	 C L O S E   T o p i c C u r s o r     
 
 	 	 D E A L L O C A T E   T o p i c C u r s o r     
 
 
 
 
 
 
 
 
 
 	 	 / * 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = 
Y6R  T o p i c 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 I N S E R T   I N T O   d b o . T o p i c   ( F o r u m I D , T o p i c S t a t u s , [ U s e r ] , P o s t T i m e , T i t l e , C o n t e n t , H i t , A t t a c h m e n t N a m e )   S E L E C T   @ N e w F o r u m I D , T o p i c S t a t u s , [ U s e r ] , P o s t T i m e , T i t l e , C o n t e n t , H i t , A t t a c h m e n t N a m e   F R O M   d b o . T o p i c   W H E R E   F o r u m I D = @ C o m m u n i t y I t e m     
 
     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = _e
Y6Rv  T o p i c   I D     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 D E C L A R E   @ N e w T o p i c I D   I N T     
 
 	 	 S E L E C T   @ N e w T o p i c I D = S C O P E _ I D E N T I T Y ( )   - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	        
 
     
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 - - = = 
Y6R  F o l l o w U p   
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 	 	 I N S E R T   I N T O   d b o . F o l l o w U p   ( T o p i c I D , [ U s e r ] , P o s t T i m e , C o n t e n t , A t t a c h m e n t N a m e )   S E L E C T   @ N e w T o p i c I D , [ U s e r ] , P o s t T i m e , C o n t e n t , A t t a c h m e n t N a m e   F R O M   d b o . F o l l o w U p   W H E R E   T o p i c I D   I N   ( S e l e c t   T o p i c I D   F r o m   d b o . T o p i c   W h e r e   F o r u m I D = @ C o m m u n i t y I t e m )   	 	 
 
 	 	 * / 
 
 	 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o r u m M o v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e G e t S i n g l e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e G e t S i n g l e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e G e t S i n g l e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = K n o w l e d g e G e t   vUS*N  K n o w l e d g e   Hr    
 
 - - = = h  K n o w l e d g e   -Nv  D e d i c a t e d T o   :NzzveP@b	gSOmȉ:N  *   R@b	g[7bSOmȉ  :N  a b c , e f g   Rc[[7bSOmȉ  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2     C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 0 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e G e t S i n g l e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - P a g e   D i r e t o r y   v  N a m e 
 
 @ K n o w l e d g e I D   i n t , 	 	 	 	 	 	 - - S_MRUS*NwƋ
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 	 	 - - S_MReS
 
 
 
 A S 
 
     
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ K n o w l e d g e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' K n o w l e d g e A p p r o v e ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 
 
 	 	 1   A S   P a g i n g I D , 	 	 	 	 - - ԏV~^\:NNT  K n o w l e d g e G e t   Oc Nv^l	g[EaIN
 
 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y , 
 
 	 
 
 	 	 1   A S   P a g e C o u n t 	 	 	 	 - - ԏV~^\NT  K n o w l e d g e G e t   Oc N  [ESSԏV Nu	
 
 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 W H E R E   n o w . [ I D ] = @ K n o w l e d g e I D 
 
 
 
 	 O R D E R   B Y   S e r i a l 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b
N/f  A d m i n   E d i t o r 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 
 
 	 	 1   A S   P a g i n g I D , 	 	 	 	 - - ԏV~^\:NNT  K n o w l e d g e G e t   Oc Nv^l	g[EaIN
 
 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 
 
 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y , 
 
 	 
 
 	 	 1   A S   P a g e C o u n t 	 	 	 	 - - ԏV~^\NT  K n o w l e d g e G e t   Oc N  [ESSԏV Nu	
 
 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 W H E R E   n o w . [ I D ] = @ K n o w l e d g e I D   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )       A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 
 
 	 O R D E R   B Y   S e r i a l 
 
 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \
0S_MRu0QYԏVvwƋ  C o n t e n t     v  H i t C o u n t   QV  K n o w l e d g e C o n t e n t   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i t C o u n t = I S N U L L ( H i t C o u n t , 0 ) + 1   W H E R E   K n o w l e d g e I D = @ K n o w l e d g e I D     A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  S i t e L o g   -NU_(WHh  9hnc  @ K n o w l e d g e I D   T  @ C u l t u r e   ԏVS_MR  K n o w l e d g e C o n t e n t I D 
 
 - - = = S,g^S_O(u  S P   S i t e L o g S a v e   FO(Wُ̑:NNTOY  K n o w l e d g e G e t < x x x >    NwegbNO(u O~v    I n s e r t 
 
 - - = = la_{hg  @ U s e r   /f&T:Nzzcd*g{vU_(u7b_NOmȉv`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ U s e r < > N ' ' )   A N D   ( @ U s e r   I S   N O T   N U L L ) 
 
 B E G I N 
 
 	 I N S E R T   I N T O   d b o . S i t e L o g   ( [ U s e r ] , A c t i v i t y , T a r g e t I D , A c t i v i t y T i m e )   S E L E C T   @ U s e r , 1 , n o w c . [ I D ] , G E T D A T E ( )   F R O M   d b o . K n o w l e d g e C o n t e n t   n o w c   W h e r e   n o w c . K n o w l e d g e I D = @ K n o w l e d g e I D     A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b~[  @ P a g e D i r e c t o r y N a m e   v  P a g e D i r e c t o r y   I D   T  K n o w l e d g e   v  K n o w l e d g e D i r e c t o r y   
TW[    R(uNR^   ewƋ   c	  
 
 - - = = TeԏVS_MR  P a g e D i r e c t o r y   vgN^\'`T y p e ,   P r e s e n t a t i o n ,   S h o w T i t l e ,   S h o w A u t h o r ,   S h o w U p d a t e T i m e ,   S h o w H i t C o u n t ,   S h o w C o m m e n t s ,   S h o w S t a t i c U r l ,   S h o w K n o w l e d g e H t m l ,   S h o w R e l a t i v e 	NOJTɋ|~YUO  R e n d e r   wƋ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 p a d . [ I D ]   A S   P a g e D i r e c t o r y I D , 
 
 	 p a d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e , 
 
 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y , 
 
 
 
 	 I S N U L L ( p d c . O u t l i n e M o d e , 0 )   A S   O u t l i n e M o d e , 
 
 
 
 	 p d c . T i t l e   A S   T i t l e , 
 
 	 p d c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 p d c . P a g e H e a d e r   A S   P a g e H e a d e r , 
 
 	 p d c . P a g e F o o t e r   A S   P a g e F o o t e r , 
 
 
 
 	 s d c . P a g e H e a d e r   A S   S u b D i r e c t o r y P a g e H e a d e r , 
 
 	 s d c . P a g e F o o t e r   A S     S u b D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 m d c . P a g e H e a d e r   A S   M a i n D i r e c t o r y P a g e H e a d e r , 
 
 	 m d c . P a g e F o o t e r   A S     M a i n D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 p a d . T y p e   A S   T y p e , 
 
 	 p a d . P r e s e n t a t i o n   A S   P r e s e n t a t i o n , 
 
 	 p a d . J u m p T o C o n t e n t   A S   J u m p T o C o n t e n t , 
 
 
 
 	 p a d . S h o w T i t l e   A S   S h o w T i t l e , 
 
 	 p a d . S h o w A u t h o r   A S   S h o w A u t h o r , 
 
 	 p a d . S h o w U p d a t e T i m e   A S   S h o w U p d a t e T i m e , 
 
 	 p a d . S h o w H i t C o u n t   A S   S h o w H i t C o u n t , 
 
 	 p a d . S h o w C o m m e n t s   A S   S h o w C o m m e n t s , 
 
 	 p a d . S h o w S t a t i c U r l   A S   S h o w S t a t i c U r l , 
 
 	 p a d . S h o w K n o w l e d g e H t m l   A S   S h o w K n o w l e d g e H t m l , 
 
 	 p a d . S h o w R e l a t i v e   A S   S h o w R e l a t i v e 
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y   p a d   
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   O N   p d c . P a g e D i r e c t o r y I D = p a d . [ I D ]   A N D   p d c . C u l t u r e = @ C u l t u r e 
 
 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p a d . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d c . S u b D i r e c t o r y I D = s d . [ I D ] 
 
 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d c . M a i n D i r e c t o r y I D = m d . [ I D ] 
 
 
 
 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e G e t S i n g l e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e T a g G e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e T a g G e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e T a g G e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  K n o w l e d g e ,   K n o w l e d g e C o n t e n t   ~T-NԏV  T a g   RhNSk*N  T a g   [^v  C o n t e n t   pev
 
 - - = = (uNg wƋvOagh~{NOpQTۏeQf~vwƋR{|
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 9 - 0 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e T a g G e t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - P a g e   D i r e t o r y   v  N a m e 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 	 	 - - S_MReS
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ K n o w l e d g e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' K n o w l e d g e A p p r o v e ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1               
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = YgS_MR(u7b
0/f0  A d m i n   E d i t o r 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ԏVc[  P a g e D i r e c t o r y N a m e c[  C u l t u r e   Nv    K n o w l e d g e C o n t e n t   -N@b	g  T a g   vR+Rpe
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 	 
 
 	 	 I S N U L L ( n o w t . T a g , N ' ' )   A S   T a g , 
 
 	 	 C O U N T ( I S N U L L ( n o w t . T a g , N ' ' ) )   A S   C o n t e n t C o u n t 
 
 	 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e T a g s   n o w t   O N   n o w t . K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 
 
 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 	 
 
 	 G R O U P   B Y   I S N U L L ( n o w t . T a g , N ' ' ) 
 
 
 
 	 O R D E R   B Y   T a g   
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = YgS_MR(u7b
0
N/f0  A d m i n   E d i t o r 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ԏVc[  P a g e D i r e c t o r y N a m e c[  C u l t u r e   Nv    K n o w l e d g e C o n t e n t   -N@b	g  T a g   vR+Rpe
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 	 
 
 	 	 I S N U L L ( n o w t . T a g , N ' ' )   A S   T a g , 
 
 	 	 C O U N T ( I S N U L L ( n o w t . T a g , N ' ' ) )   A S   C o n t e n t C o u n t 
 
 	 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e T a g s   n o w t   O N   n o w t . K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 
 
 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 	 - - W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' '   o r   n o w . D e d i c a t e d T o   i s   N U L L   o r   R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' * '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) = 1 )       A N D     n o w c . H i d d e n < > 1 
 
 	 
 
 	 G R O U P   B Y   I S N U L L ( n o w t . T a g , N ' ' ) 
 
 
 
 	 O R D E R   B Y   T a g   
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e T a g G e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e T i m e T a g G e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e T i m e T a g G e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e T i m e T a g G e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  K n o w l e d g e ,   K n o w l e d g e C o n t e n t   ~T-NԏV  U p d a t e T i m e   T a g   RhNSk*N  T a g   [^v  C o n t e n t   pev
 
 - - = = ԏV@b	gt^NgN~TNv  C o n t e n t   pev
 
 - - = = (uegg   B l o g   beI{WNevwƋveh~{
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 9 - 0 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e T i m e T a g G e t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - P a g e   D i r e t o r y   v  N a m e 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 	 	 - - S_MReS
 
 
 
 A S 
 
     
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = [N  U o d a t e T i m e   :N  N u l l   v`b_O(u  G e t d a t e ( )   fbc  (Wck_|~-Nُy`b_^
NOSu	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ T o d a y   D A T E T I M E 
 
 S E T   @ T o d a y = G E T D A T E ( ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ K n o w l e d g e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' K n o w l e d g e A p p r o v e ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 I F   d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1                   
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = YgS_MR(u7b
0/f0  A d m i n   E d i t o r 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = c[  P a g e D i r e c t o r y N a m e N  p d     v{|W:NWNev  p d     -   T y p e = 2 	c[  C u l t u r e   Nv    K n o w l e d g e   -N@b	g  U p d a t e T i m e     vR+Rpe
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 	 
 
 	 	 C O N V E R T ( N V A R C H A R ( 2 0 ) , Y E A R ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) )   A S   T i t l e , 
 
 	 	 C O N V E R T ( N V A R C H A R ( 2 0 ) , M O N T H ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) )   A S   T a g , 
 
 	 	 C O U N T ( C O N V E R T ( N V A R C H A R ( 2 0 ) , M O N T H ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) ) )   A S   C o n t e n t C o u n t 
 
 	 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 
 
 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   p a d . T y p e = 2 
 
 	 
 
 	 G R O U P   B Y   C O N V E R T ( N V A R C H A R ( 2 0 ) , Y E A R ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) ) ,   C O N V E R T ( N V A R C H A R ( 2 0 ) , M O N T H ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) ) 
 
 
 
 	 O R D E R   B Y   T i t l e   D E S C , T a g   D E S C 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = YgS_MR(u7b
0
N/f0  A d m i n   E d i t o r 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = c[  P a g e D i r e c t o r y N a m e N  p d     v{|W:NWNev  p d     -   T y p e = 2 	c[  C u l t u r e   Nv    K n o w l e d g e   -N@b	g  U p d a t e T i m e     vR+Rpe
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T   T O P   1 0 0   P E R C E N T 
 
 	 
 
 	 	 C O N V E R T ( N V A R C H A R ( 2 0 ) , Y E A R ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) )   A S   T i t l e , 
 
 	 	 C O N V E R T ( N V A R C H A R ( 2 0 ) , M O N T H ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) )   A S   T a g , 
 
 	 	 C O U N T ( C O N V E R T ( N V A R C H A R ( 2 0 ) , M O N T H ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) ) )   A S   C o n t e n t C o u n t 
 
 	 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 
 
 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   p a d . T y p e = 2   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 	 
 
 	 - - W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   p a d . T y p e = 2   A N D   ( R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' '   o r   n o w . D e d i c a t e d T o   i s   N U L L   o r   R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' * '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) = 1 )     A N D   d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) < > 1         A N D     n o w c . H i d d e n < > 1 
 
 	 - - W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   p a d . T y p e = 2   A N D   ( R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' '   o r   n o w . D e d i c a t e d T o   i s   N U L L   o r   R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' * '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) = 1 )     A N D   d b o . U D F _ U s e r C l i e n t ( @ U s e r ) = 1   A N D   d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1         A N D     n o w c . H i d d e n < > 1 
 
 	 
 
 	 G R O U P   B Y   C O N V E R T ( N V A R C H A R ( 2 0 ) , Y E A R ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) ) ,   C O N V E R T ( N V A R C H A R ( 2 0 ) , M O N T H ( I S N U L L ( n o w . U p d a t e T i m e , @ T o d a y ) ) ) 
 
 
 
 	 O R D E R   B Y   T i t l e   D E S C , T a g   D E S C 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e T i m e T a g G e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e G e t B y T a g         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e G e t B y T a g ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e G e t B y T a g ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = K n o w l e d g e G e t   v  B y T a g   Hr    \  K n o w l e d g e G e t   v~gQ(u  T a g   ۏLǏn	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 0 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e G e t B y T a g 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - P a g e   D i r e t o r y   v  N a m e 
 
 @ T a g   n v a r c h a r ( 5 0 0 ) , 	 	 	 	 	 	 - - O(uv  T a g   ۏLǏn	
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MReS
 
 
 
 @ C u r r e n t P a g e   I N T 	 	 	 	 	 	 - - ux:g6RS_MRu
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _S_MR  P a g e D i r e c t o r y     v  T y p e   <PYg/f  1 RbNTbv~g\O(u  O r d e r   B y   S e r i a l   nfQ[N  S e r i a l   c^	  Yg/f  2   R  O r d e r   B y   U p d a t e T i m e   WNevQ[NS^ec^	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ T y p e   I N T 
 
 S E L E C T   @ T y p e = T y p e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ P a g e D i r e c t o r y N a m e     @b(Wv  P a g e D i r e c t o r y   U_-Nv  P a g e S i z e   <P
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e S i z e   I N T 
 
 S E L E C T   T O P   1   @ P a g e S i z e = P a g e S i z e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ^zRu
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g i n g   T A B L E   
 
 (   
 
 	 P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   
 
 	 [ I D ]   i n t ,   
 
 	 P a g e D i r e c t o r y I D   i n t , 
 
 	 S e r i a l   i n t , 
 
 	 H i d d e n   b i t , 
 
 	 A p p r o v e d   i n t , 
 
 	 A p p r o v e M e s s a g e   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 A p p r o v e d B y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 U p d a t e T i m e   d a t e t i m e , 
 
 	 A u t h o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 K n o w l e d g e T y p e   i n t , 
 
 
 
 	 E d i t o r   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 E d i t o r P e r m i s s i o n   i n t , 
 
 
 
 	 K n o w l e d g e C o n t e n t I D   i n t , 
 
 
 
 	 - - T e m p l a t e   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 T i t l e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 - - T i t l e S h o w   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 C o n t e n t   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 T a g   n v a r c h a r ( 5 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 A b s t r a c t   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 
 
 	 H i t C o u n t   i n t , 
 
 	 C o m m e n t s P e r m i s s i o n   i n t , 
 
 	 C o m m e n t s C o u n t   i n t , 
 
 
 
 	 K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t   
 
 )   
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ K n o w l e d g e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' K n o w l e d g e A p p r o v e ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  T y p e = 1 / 2   Q[TbO(u  O R D E R   B Y   S e r i a l   ؏/f  U p d a t e T i m e   NN$NkNxdN  O r d e r   B y   KNYvQ[0We[hQ N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ T y p e = 1 
 
 
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = MR(u7b/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = R  @ T a g   
0/f0
0&T0:Nzz$Ny`b_  N/U N:S+R(WN  @ T a g   agNS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ T a g < > N ' ' 
 
 	 	 
 
 	 	 B E G I N 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = S_MR`b_@ T y p e = 1     |       U s e r A d m i n = 1       |       @ T a g < > N ' ' 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 	 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 	 
 
 	 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 
 
 	 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 	 
 
 	 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 	 
 
 	 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( @ T a g   I n   ( s e l e c t   T a g   f r o m   d b o . K n o w l e d g e T a g s   w h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] ) ) 
 
 	 
 
 	 	 	 O R D E R   B Y   S e r i a l 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = S_MR`b_@ T y p e = 1     |       U s e r A d m i n = 1       |       @ T a g = N ' ' 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 	 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 	 
 
 	 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 
 
 	 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 	 
 
 	 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 	 
 
 	 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( N o t   E x i s t s   ( s e l e c t   T a g   f r o m   d b o . K n o w l e d g e T a g s   w h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] ) ) 
 
 	 
 
 	 	 	 O R D E R   B Y   S e r i a l 
 
 	 	 E N D 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = MR(u7b
N/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = R  @ T a g   
0/f0
0&T0:Nzz$Ny`b_  N/U N:S+R(WN  @ T a g   agNS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ T a g < > N ' ' 
 
 	 	 
 
 	 	 B E G I N 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = S_MR`b_@ T y p e = 1     |       U s e r A d m i n < > 1       |       @ T a g < > N ' ' 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 	 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 	 
 
 	 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 
 
 	 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 	 
 
 	 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 	 	 
 
 	 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( @ T a g   I n   ( s e l e c t   T a g   f r o m   d b o . K n o w l e d g e T a g s   w h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] ) )     A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 	 
 
 	 	 	 O R D E R   B Y   S e r i a l 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = S_MR`b_@ T y p e = 1     |       U s e r A d m i n < > 1       |       @ T a g = N ' ' 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 	 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 	 
 
 	 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 
 
 	 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 	 
 
 	 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 	 	 
 
 	 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( N o t   E x i s t s   ( s e l e c t   T a g   f r o m   d b o . K n o w l e d g e T a g s   w h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] ) )     A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 	 
 
 	 	 	 O R D E R   B Y   S e r i a l 
 
 
 
 	 	 E N D 
 
 	 E N D 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = MR(u7b/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = R  @ T a g   
0/f0
0&T0:Nzz$Ny`b_  N/U N:S+R(WN  @ T a g   agNS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ T a g < > N ' ' 
 
 	 	 
 
 	 	 B E G I N 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = S_MR`b_@ T y p e < > 1     |       U s e r A d m i n = 1       |       @ T a g < > N ' ' 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 	 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 	 
 
 	 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 
 
 	 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 	 
 
 	 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 	 
 
 	 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( @ T a g   I n   ( s e l e c t   T a g   f r o m   d b o . K n o w l e d g e T a g s   w h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] ) ) 
 
 	 
 
 	 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = S_MR`b_@ T y p e < > 1     |       U s e r A d m i n = 1       |       @ T a g = N ' ' 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 	 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 	 
 
 	 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 
 
 	 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 	 
 
 	 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 	 
 
 	 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( N o t   E x i s t s   ( s e l e c t   T a g   f r o m   d b o . K n o w l e d g e T a g s   w h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] ) ) 
 
 	 
 
 	 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 
 
 	 	 E N D 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = MR(u7b
N/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = R  @ T a g   
0/f0
0&T0:Nzz$Ny`b_  N/U N:S+R(WN  @ T a g   agNS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ T a g < > N ' ' 
 
 	 	 
 
 	 	 B E G I N 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = S_MR`b_@ T y p e < > 1     |       U s e r A d m i n < > 1       |       @ T a g < > N ' ' 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 	 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 	 
 
 	 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 
 
 	 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 	 
 
 	 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 	 	 
 
 	 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( @ T a g   I n   ( s e l e c t   T a g   f r o m   d b o . K n o w l e d g e T a g s   w h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] ) )     A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 	 
 
 	 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = S_MR`b_@ T y p e < > 1     |       U s e r A d m i n < > 1       |       @ T a g = N ' ' 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 	 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 	 
 
 	 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 
 
 	 	 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 	 
 
 	 	 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 	 	 
 
 	 	 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( N o t   E x i s t s   ( s e l e c t   T a g   f r o m   d b o . K n o w l e d g e T a g s   w h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] ) )     A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 	 
 
 	 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 
 
 	 	 E N D 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSS_MRu,{ N*NT gT N*NU_vMOn
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F i r s t R e c o r d   i n t 
 
 D E C L A R E   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 S E T   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 
 
 S E T   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏVS_MRu-NvU_
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   	 
 
 	 * , 
 
 	 P a g e C o u n t = C E I L I N G ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) )   
 
 
 
 F R O M   @ P a g i n g   
 
 W H E R E   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \
0S_MRu0QYԏVvwƋ  C o n t e n t     v  H i t C o u n t   QV  K n o w l e d g e C o n t e n t   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i t C o u n t = I S N U L L ( H i t C o u n t , 0 ) + 1   W H E R E   K n o w l e d g e I D   I N   ( S e l e c t   [ I D ]   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d )   A N D   C u l t u r e = @ C u l t u r e 
 
 U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i t C o u n t = I S N U L L ( H i t C o u n t , 0 ) + 1   W H E R E   [ I D ]   I N   ( S e l e c t   K n o w l e d g e C o n t e n t I D   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  S i t e L o g   -NU_(WHh  S_MR  P a g i n g   ̑b@b	gv  K n o w l e d g e C o n t e n t   S_MR  @ U s e r   OmȉN NN	
 
 - - = = S,g^S_O(u  S P   S i t e L o g S a v e   FO(Wُ̑YgO(u  S P   S i t e L o g S a v e   1\_{O(u'`^8^]v  C u r s o r :NNMQ  C u r o r   d\ObNُ̑vc  I n s e r t 
 
 - - = = la_{hg  @ U s e r   /f&T:Nzzcd*g{vU_(u7b_NOmȉv`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ U s e r < > N ' ' )   A N D   ( @ U s e r   I S   N O T   N U L L ) 
 
 B E G I N 
 
 	 I N S E R T   I N T O   d b o . S i t e L o g   ( [ U s e r ] , A c t i v i t y , T a r g e t I D , A c t i v i t y T i m e )   S E L E C T   @ U s e r , 1 , K n o w l e d g e C o n t e n t I D , G E T D A T E ( )   F R O M   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b~[  @ P a g e D i r e c t o r y N a m e   v  P a g e D i r e c t o r y   I D   T  K n o w l e d g e   v  K n o w l e d g e D i r e c t o r y   
TW[    R(uNR^   ewƋ   c	  
 
 - - = = TeԏVS_MR  P a g e D i r e c t o r y   vgN^\'`T y p e ,   P r e s e n t a t i o n ,   S h o w T i t l e ,   S h o w A u t h o r ,   S h o w U p d a t e T i m e ,   S h o w H i t C o u n t ,   S h o w C o m m e n t s ,   S h o w S t a t i c U r l ,   S h o w K n o w l e d g e H t m l ,   S h o w R e l a t i v e 	NOJTɋ|~YUO  R e n d e r   wƋ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 p a d . [ I D ]   A S   P a g e D i r e c t o r y I D , 
 
 	 p a d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e , 
 
 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y , 
 
 
 
 	 I S N U L L ( p d c . O u t l i n e M o d e , 0 )   A S   O u t l i n e M o d e , 
 
 
 
 	 p d c . T i t l e   A S   T i t l e , 
 
 	 p d c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 p d c . P a g e H e a d e r   A S   P a g e H e a d e r , 
 
 	 p d c . P a g e F o o t e r   A S   P a g e F o o t e r , 
 
 
 
 	 s d c . P a g e H e a d e r   A S   S u b D i r e c t o r y P a g e H e a d e r , 
 
 	 s d c . P a g e F o o t e r   A S     S u b D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 m d c . P a g e H e a d e r   A S   M a i n D i r e c t o r y P a g e H e a d e r , 
 
 	 m d c . P a g e F o o t e r   A S     M a i n D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 p a d . T y p e   A S   T y p e , 
 
 	 p a d . P r e s e n t a t i o n   A S   P r e s e n t a t i o n , 
 
 	 p a d . J u m p T o C o n t e n t   A S   J u m p T o C o n t e n t , 
 
 
 
 	 p a d . S h o w T i t l e   A S   S h o w T i t l e , 
 
 	 p a d . S h o w A u t h o r   A S   S h o w A u t h o r , 
 
 	 p a d . S h o w U p d a t e T i m e   A S   S h o w U p d a t e T i m e , 
 
 	 p a d . S h o w H i t C o u n t   A S   S h o w H i t C o u n t , 
 
 	 p a d . S h o w C o m m e n t s   A S   S h o w C o m m e n t s , 
 
 	 p a d . S h o w S t a t i c U r l   A S   S h o w S t a t i c U r l , 
 
 	 p a d . S h o w K n o w l e d g e H t m l   A S   S h o w K n o w l e d g e H t m l , 
 
 
 	 p a d . S h o w R e l a t i v e   A S   S h o w R e l a t i v e 
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y   p a d   
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   O N   p d c . P a g e D i r e c t o r y I D = p a d . [ I D ]   A N D   p d c . C u l t u r e = @ C u l t u r e 
 
 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p a d . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d c . S u b D i r e c t o r y I D = s d . [ I D ] 
 
 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d c . M a i n D i r e c t o r y I D = m d . [ I D ] 
 
 
 
 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e G e t B y T a g ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e G e t B y T i m e T a g         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e G e t B y T i m e T a g ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e G e t B y T i m e T a g ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = K n o w l e d g e G e t   v  B y T i m e T a g   Hr    \  K n o w l e d g e G e t   v~gQ(u  T i m e T a g   ۏLǏn	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 0 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e G e t B y T i m e T a g 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - P a g e   D i r e t o r y   v  N a m e 
 
 @ T i m e T a g Y e a r   i n t , 	 	 	 	 	 	 - - O(uv  T i m e T a g   ۏLǏn	
 
 @ T i m e T a g M o n t h   i n t , 	 	 	 	 	 	 - - O(uv  T i m e T a g   ۏLǏn	
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MReS
 
 
 
 @ C u r r e n t P a g e   I N T 	 	 	 	 	 	 - - ux:g6RS_MRu
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ P a g e D i r e c t o r y N a m e     @b(Wv  P a g e D i r e c t o r y   U_-Nv  P a g e S i z e   <P
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e S i z e   I N T 
 
 S E L E C T   T O P   1   @ P a g e S i z e = P a g e S i z e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ^zRu
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g i n g   T A B L E   
 
 (   
 
 	 P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   
 
 	 [ I D ]   i n t ,   
 
 	 P a g e D i r e c t o r y I D   i n t , 
 
 	 S e r i a l   i n t , 
 
 	 H i d d e n   b i t , 
 
 	 A p p r o v e d   i n t , 
 
 	 A p p r o v e M e s s a g e   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 A p p r o v e d B y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 U p d a t e T i m e   d a t e t i m e , 
 
 	 A u t h o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 K n o w l e d g e T y p e   i n t , 
 
 
 
 	 E d i t o r   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 E d i t o r P e r m i s s i o n   i n t , 
 
 
 
 	 K n o w l e d g e C o n t e n t I D   i n t , 
 
 
 
 	 - - T e m p l a t e   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 T i t l e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 - - T i t l e S h o w   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 C o n t e n t   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 T a g   n v a r c h a r ( 5 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 A b s t r a c t   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 
 
 	 H i t C o u n t   i n t , 
 
 	 C o m m e n t s P e r m i s s i o n   i n t , 
 
 	 C o m m e n t s C o u n t   i n t , 
 
 
 
 	 K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t   
 
 )   
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ K n o w l e d g e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' K n o w l e d g e A p p r o v e ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r   
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 S E L E C T 
 
 
 
 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 
 
 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   Y E A R ( n o w . U p d a t e T i m e ) = @ T i m e T a g Y e a r   A N D   M O N T H ( n o w . U p d a t e T i m e ) = @ T i m e T a g M o n t h   
 
 
 
 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N   
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b
0
N/f0  A d m i n   E d i t o r   
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 	 S E L E C T 
 
 
 
 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e M e s s a g e , N ' ' )   A S   A p p r o v e M e s s a g e , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d B y , N ' ' )   A S   A p p r o v e d B y , 
 
 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 n o w . K n o w l e d g e T y p e   A S   K n o w l e d g e T y p e , 
 
 
 
 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 
 
 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 ) + 1   A S   H i t C o u n t , 
 
 	 	 d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( n o w . [ I D ] , @ U s e r )   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t , 
 
 
 
 	 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y 
 
 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 
 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   Y E A R ( n o w . U p d a t e T i m e ) = @ T i m e T a g Y e a r   A N D   M O N T H ( n o w . U p d a t e T i m e ) = @ T i m e T a g M o n t h   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )       A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 
 
 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSS_MRu,{ N*NT gT N*NU_vMOn
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F i r s t R e c o r d   i n t 
 
 D E C L A R E   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 S E T   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 
 
 S E T   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏVS_MRu-NvU_
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   	 
 
 	 * , 
 
 	 P a g e C o u n t = C E I L I N G ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) )   
 
 
 
 F R O M   @ P a g i n g   
 
 W H E R E   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \
0S_MRu0QYԏVvwƋ  C o n t e n t     v  H i t C o u n t   QV  K n o w l e d g e C o n t e n t   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i t C o u n t = I S N U L L ( H i t C o u n t , 0 ) + 1   W H E R E   K n o w l e d g e I D   I N   ( S e l e c t   [ I D ]   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d )   A N D   C u l t u r e = @ C u l t u r e 
 
 U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i t C o u n t = I S N U L L ( H i t C o u n t , 0 ) + 1   W H E R E   [ I D ]   I N   ( S e l e c t   K n o w l e d g e C o n t e n t I D   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  S i t e L o g   -NU_(WHh  S_MR  P a g i n g   ̑b@b	gv  K n o w l e d g e C o n t e n t   S_MR  @ U s e r   OmȉN NN	
 
 - - = = S,g^S_O(u  S P   S i t e L o g S a v e   FO(Wُ̑YgO(u  S P   S i t e L o g S a v e   1\_{O(u'`^8^]v  C u r s o r :NNMQ  C u r o r   d\ObNُ̑vc  I n s e r t 
 
 - - = = la_{hg  @ U s e r   /f&T:Nzzcd*g{vU_(u7b_NOmȉv`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ U s e r < > N ' ' )   A N D   ( @ U s e r   I S   N O T   N U L L ) 
 
 B E G I N 
 
 	 I N S E R T   I N T O   d b o . S i t e L o g   ( [ U s e r ] , A c t i v i t y , T a r g e t I D , A c t i v i t y T i m e )   S E L E C T   @ U s e r , 1 , K n o w l e d g e C o n t e n t I D , G E T D A T E ( )   F R O M   @ P a g i n g   W h e r e   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b~[  @ P a g e D i r e c t o r y N a m e   v  P a g e D i r e c t o r y   I D   T  K n o w l e d g e   v  K n o w l e d g e D i r e c t o r y   
TW[    R(uNR^   ewƋ   c	  
 
 - - = = TeԏVS_MR  P a g e D i r e c t o r y   vgN^\'`T y p e ,   P r e s e n t a t i o n ,   S h o w T i t l e ,   S h o w A u t h o r ,   S h o w U p d a t e T i m e ,   S h o w H i t C o u n t ,   S h o w C o m m e n t s ,   S h o w S t a t i c U r l ,   S h o w K n o w l e d g e H t m l ,   S h o w R e l a t i v e 	NOJTɋ|~YUO  R e n d e r   wƋ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 p a d . [ I D ]   A S   P a g e D i r e c t o r y I D , 
 
 	 p a d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e , 
 
 	 N ' K n o w l e d g e '   A S   K n o w l e d g e D i r e c t o r y , 
 
 
 
 	 I S N U L L ( p d c . O u t l i n e M o d e , 0 )   A S   O u t l i n e M o d e , 
 
 
 
 	 p d c . T i t l e   A S   T i t l e , 
 
 	 p d c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 p d c . P a g e H e a d e r   A S   P a g e H e a d e r , 
 
 	 p d c . P a g e F o o t e r   A S   P a g e F o o t e r , 
 
 
 
 	 s d c . P a g e H e a d e r   A S   S u b D i r e c t o r y P a g e H e a d e r , 
 
 	 s d c . P a g e F o o t e r   A S     S u b D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 m d c . P a g e H e a d e r   A S   M a i n D i r e c t o r y P a g e H e a d e r , 
 
 	 m d c . P a g e F o o t e r   A S     M a i n D i r e c t o r y P a g e F o o t e r , 
 
 
 
 	 p a d . T y p e   A S   T y p e , 
 
 	 p a d . P r e s e n t a t i o n   A S   P r e s e n t a t i o n , 
 
 	 p a d . J u m p T o C o n t e n t   A S   J u m p T o C o n t e n t , 
 
 
 
 	 p a d . S h o w T i t l e   A S   S h o w T i t l e , 
 
 	 p a d . S h o w A u t h o r   A S   S h o w A u t h o r , 
 
 	 p a d . S h o w U p d a t e T i m e   A S   S h o w U p d a t e T i m e , 
 
 	 p a d . S h o w H i t C o u n t   A S   S h o w H i t C o u n t , 
 
 	 p a d . S h o w C o m m e n t s   A S   S h o w C o m m e n t s , 
 
 	 p a d . S h o w S t a t i c U r l   A S   S h o w S t a t i c U r l , 
 
 	 p a d . S h o w K n o w l e d g e H t m l   A S   S h o w K n o w l e d g e H t m l , 
 
 	 p a d . S h o w R e l a t i v e   A S   S h o w R e l a t i v e 
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y   p a d   
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   O N   p d c . P a g e D i r e c t o r y I D = p a d . [ I D ]   A N D   p d c . C u l t u r e = @ C u l t u r e 
 
 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p a d . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d c . S u b D i r e c t o r y I D = s d . [ I D ] 
 
 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d c . M a i n D i r e c t o r y I D = m d . [ I D ] 
 
 
 
 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e G e t B y T i m e T a g ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o m m e n t s G e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o m m e n t s G e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o m m e n t s G e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~[  K n o w l e d g e C o n t e n t I D   ԏV[^v  K n o w l e d g e C o m m e n t s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 5 - 1 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o m m e n t s G e t 
 
 
 
 @ K n o w l e d g e I D   i n t , 	 	 	 	 	 	 - - S_MRUS*NwƋ
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MReS
 
 
 
 @ P a g e S i z e   I N T , 	 	 	 	 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T 	 	 	 	 	 	 - - ux:g6RS_MRu
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^ N*N  t a b l e   Sϑ[~~gNO(WTbۏLRuYt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   N O C O U N T   O N 
 
 
 
 D E C L A R E   @ P a g i n g   T A B L E 
 
 ( 
 
 	 P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) , 
 
 	 [ I D ]   i n t , 
 
 	 K n o w l e d g e C o n t e n t I D   i n t , 
 
 	 C o m m e n t s T i m e   d a t e t i m e , 
 
 	 C o m m e n t s U s e r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 C o m m e n t s C o n t e n t   n v a r c h a r ( 1 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t 
 
 ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b~[  @ P a g e D i r e c t o r y N a m e   N@b	g  K n o w l e d g e   vQ[  R(uN>f:ywƋ_N(uN[wƋۏL RdO9ecvR^	
 
 - - = = S_MR(u7be^  A d m i n   _N^  C l i e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   @ P a g i n g 
 
 
 
 S E L E C T 
 
 
 
 	 n o w c o . [ I D ]   A S   [ I D ] , 
 
 	 n o w c o . K n o w l e d g e C o n t e n t I D   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 n o w c o . C o m m e n t s T i m e   A S   C o m m e n t s T i m e , 
 
 	 n o w c o . C o m m e n t s U s e r   A S   C o m m e n t s U s e r , 
 
 	 n o w c o . C o m m e n t s C o n t e n t   A S   C o m m e n t s C o n t e n t 
 
 
 
 F R O M   d b o . K n o w l e d g e C o m m e n t s   n o w c o 
 
 
 
 W H E R E   n o w c o . K n o w l e d g e C o n t e n t I D   I N   ( S e l e c t   [ I D ]   F r o m   d b o . K n o w l e d g e C o n t e n t   W h e r e   K n o w l e d g e I D = @ K n o w l e d g e I D   A N D   C u l t u r e = @ C u l t u r e ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = {  @ P a g e C o u n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e C o u n t   I N T 
 
 S E L E C T   @ P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) ) 
 
 
 
 I F   @ C u r r e n t P a g e > @ P a g e C o u n t 
 
 B E G I N 
 
 	 S E L E C T   @ C u r r e n t P a g e = @ P a g e C o u n t 
 
 E N D 
 
 
 
 I F   @ C u r r e n t P a g e < 1 
 
 B E G I N 
 
 	 S E L E C T   @ C u r r e n t P a g e = 1 
 
 E N D 
 
 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F i r s t R e c o r d   I N T 
 
 D E C L A R E   @ L a s t R e c o r d   I N T 
 
 	 	 
 
 S E T   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 S E T   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   
 
 
 
 	 * , 
 
 
 
 	 P a g e C o u n t = @ P a g e C o u n t 
 
 
 
 F R O M   @ P a g i n g   W H E R E   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o m m e n t s G e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o m m e n t s S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o m m e n t s S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o m m e n t s S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  K n o w l e d g e C o m m e n t s     
 
 - - = = dNS^ċQ[KNY؏S^ċ(u7bT[xbN(Wċs:Wُ7hYt
 
 - - = = YgS_MR  K n o w l e d g e   
NAQċRs:WS9h
NcOċLub
 
 - - = = YgS_MR  K n o w l e d g e   AQNaNċRs:WcOċLubT(u7b
TLub
 
 - - = = YgS_MR  K n o w l e d g e   SAQ~[(u7b*   Nh@b	g[7bu s e r 1 , u s e r 2 , u s e r 3   h:y~[Rh(u7b	ċRHQwwS_MR/f&T]~{vFNYg]{vFRScOċLub
N (u7b
T[xYgl	g{vFR؏cO(u7b
T[xLub
 
 - - = = [N]~{vFv`b_|~ꁨR~b0RS_MR(u7bv(u7b
T[x OǏegl	g{vFRO(uS^v(u7b
T[x
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 5 - 1 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o m m e n t s S a v e 
 
 
 
 @ K n o w l e d g e I D   i n t , 	 	 	 	 	 	 - - ~[  K n o w l e d g e     v  I D   bN\9hncُ*NSpeNS  C u l t u r e   Spe_  K n o w l e d g e C o n t e n t I D 
 
 @ C u l t u r e   N V A R C H A R ( 1 0 0 ) , 	 	 	 	 	 - - ~[wƋv  C u l t u r e 
 
 
 
 @ U s e r   N V A R C H A R ( 5 0 ) , 	 	 	 	 	 	 - - ċ(u7b
T
 
 @ P a s s w o r d   N V A R C H A R ( 2 0 0 ) , 	 	 	 	 	 - - ċ(u7bv  P a s s w o r d 
 
 @ C o m m e n t s C o n t e n t   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 	 - - ċQ[
 
 
 
 @ P a g e S i z e   I N T , 	 	 	 	 	 	 - - ċux:\[  eg  O p t i o n 	
 
 @ P a g e C o u n t   I N T   O U T 	 	 	 	 	 	 - - ċvMRv;`upe  NOmRċT[MO0R gT Nu gT N*N  C o m m e n t s   Y	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ K n o w l e d g e I D   NS  @ C u l t u r e   _  K n o w l e d g e C o n t e n t I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e C o n t e n t I D   I N T 
 
 
 
 S E L E C T   @ K n o w l e d g e C o n t e n t I D = [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   W H E R E   K n o w l e d g e I D = @ K n o w l e d g e I D   A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . K n o w l e d g e C o m m e n t s A u t h e n t i c a t i o n S a v e   @ K n o w l e d g e C o n t e n t I D ,   @ U s e r , @ P a s s w o r d , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLOX[
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   d b o . K n o w l e d g e C o m m e n t s   ( K n o w l e d g e C o n t e n t I D , C o m m e n t s T i m e , C o m m e n t s U s e r , C o m m e n t s C o n t e n t )   V A L U E S   ( @ K n o w l e d g e C o n t e n t I D , G E T D A T E ( ) , @ U s e r , @ C o m m e n t s C o n t e n t ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[TԏVev  P a g e C o u n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   K n o w l e d g e C o m m e n t s   w h e r e   K n o w l e d g e C o n t e n t I D = @ K n o w l e d g e C o n t e n t I D ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHh(W  @ K n o w l e d g e C o n t e n t I D   NmRNċ	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   7 ,   @ K n o w l e d g e C o n t e n t I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o m m e n t s S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o m m e n t s A u t h e n t i c a t i o n S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o m m e n t s A u t h e n t i c a t i o n S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o m m e n t s A u t h e n t i c a t i o n S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b[~[  K n o w l e d g e   vċCgP  (u  U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n 	
 
 - - = = 9hnc  @ K n o w l e d g e C o n t e n t I D   _  K n o w l e d g e I D SNwSc[  K n o w l e d g e   /f&TAQċRNN  4   y`b_
 
 - - = = Yg  U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n   ԏV  0 RlNHNSv
NAQċ  
 
 - - = = Yg  U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n   ԏV  1 RNUONSNċ
N ۏLNHN O
Negv(u7b
TS/f:N~  C o m m e n t s U s e r   
 
 - - = = Yg  U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n   ԏV  2 RfS_MR  K n o w l e d g e   SAQ~[(u7bċ*   b  U s e r 1 , U s e r 2 , U s e r 3   hfhQ萢[7b~[Rh[7bb  a d m i n 	v^NS_MR(u7b]~{vFُ̑ OǏegv(u7b
T[x/fN{vF(u7bOo`-N_vFON6q NN[Ǐ	
 
 - - = = Yg  U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n   ԏV  3 RfS_MR  K n o w l e d g e   SAQ~[(u7bċ*   b  U s e r 1 , U s e r 2 , U s e r 3   hfhQ萢[7b~[Rh[7bb  a d m i n 	v^NS_MR(u7b\*g{vFُ̑ OǏegv(u7b
T[x/f(u7b4NeeQv Yg(u7b4NeN1\
NǏ	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o m m e n t s A u t h e n t i c a t i o n S a v e 
 
 
 
 @ K n o w l e d g e C o n t e n t I D   I N T , 	 	 - - c[v  K n o w l e d g e C o n t e n t   v  I D 
 
 @ U s e r   N V A R C H A R ( 5 0 ) , 	 	 	 - - ċ(u7b
T
 
 @ P a s s w o r d   N V A R C H A R ( 2 0 0 ) , 	 	 - - ċ(u7bv  P a s s w o r d 
 
 
 
 @ o P a s s   I N T   O U T 	 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  @ K n o w l e d g e C o n t e n t I D   ԏV  K n o w l e d g e I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e I D   I N T 
 
 S E L E C T   @ K n o w l e d g e I D = K n o w l e d g e I D   F R O M   d b o . K n o w l e d g e C o n t e n t   W H E R E   [ I D ] = @ K n o w l e d g e C o n t e n t I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ      
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 - - x x (u  U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n   hgS_MR(u7b[S_MRwƋ/f&T	gċCgP
 
 - - x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
 
 I F   d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( @ K n o w l e d g e I D , @ U s e r ) = 0 
 
 
 
 	 B E G I N 
 
 	 	 S E T   @ o P a s s = 0 
 
 	 	 R A I S E R R O R ( N ' C o m m e n t s   n o t   a l l o w e d   f o r   t h i s   a r t i c l e . ' , 1 6 , 1 ) 
 
 	 	 R E T U R N 
 
 	 E N D 
 
 
 
 E L S E   I F   ( d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( @ K n o w l e d g e I D , @ U s e r ) = 2 )   O R   ( d b o . U D F _ K n o w l e d g e C o m m e n t s P e r m i s s i o n ( @ K n o w l e d g e I D , @ U s e r ) = 3 ) 
 
 
 
 	 B E G I N 
 
 	 	 I F   N O T   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . U s e r s   W h e r e   [ N a m e ] = @ U s e r   A n d   [ P a s s w o r d ] = @ P a s s w o r d ) 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ o P a s s = 0 
 
 	 	 	 R A I S E R R O R ( N ' U s e r   n a m e   o r   p a s s w o r d   i n v a l i d .   ' , 1 6 , 1 ) 
 
 	 	 	 R E T U R N 
 
 	 	 E N D 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o m m e n t s A u t h e n t i c a t i o n S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o m m e n t s D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o m m e n t s D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o m m e n t s D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  K n o w l e d g e C o m m e n t s     
 
 - - = =  CgPhgS $R[S_MR{vFbb^\N  A d m i n   sSS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 5 - 1 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o m m e n t s D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 @ K n o w l e d g e C o m m e n t s I D   i n t , 	 	 	 	 	 - - \ Rdv  C o m m e n t s   v  I D 
 
 
 
 @ P a g e S i z e   i n t , 	 	 	 	 	 	 	 - - O(uSpe{ RdgbLTP a g e C o u n t   <PNO(W Rds:Wux[MO  kY RdeMON,{5 u RdTYON4 uRbN:_uxV0R,{4 u	
 
 @ P a g e C o u n t   i n t   O U T 	 	 	 	 	 	 - -  RdTv;`upe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ K n o w l e d g e C o m m e n t s I D   _  K n o w l e d g e I D   NOO(u  S P   A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   $ReS_MR(u7b/f&T	gCgP Rd
 
 - - = = vQ-N  @ K n o w l e d g e C o n t e n t I D   /fTb  S i t e L o g S a v e   O(uv
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e I D   I N T 
 
 D E C L A R E   @ K n o w l e d g e C o n t e n t I D   I N T 
 
 
 
 S E L E C T   @ K n o w l e d g e I D = n o w . [ I D ]   ,   @ K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] 
 
 
 
 F R O M   d b o . K n o w l e d g e   n o w   
 
 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ] 
 
 L E F T   J O I N   d b o . K n o w l e d g e C o m m e n t s   n o w c o m   O N   n o w c o m . K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] 
 
 
 
 W H E R E   n o w c o m . [ I D ] = @ K n o w l e d g e C o m m e n t s I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' K n o w l e d g e ' , @ K n o w l e d g e I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbL Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . K n o w l e d g e C o m m e n t s   W H E R E   [ I D ] = @ K n o w l e d g e C o m m e n t s I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[TԏVev  P a g e C o u n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   K n o w l e d g e C o m m e n t s   w h e r e   K n o w l e d g e C o n t e n t I D = @ K n o w l e d g e C o n t e n t I D ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHh(W  @ K n o w l e d g e C o n t e n t I D   N RdNċ	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   2 0 ,   @ K n o w l e d g e C o n t e n t I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o m m e n t s D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e R e f e r e n c e P         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e R e f e r e n c e P ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e R e f e r e n c e P ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O(u  P a g e D i r e c t o r y   I D   [wƋۏL_(u  S P   K n o w l e d g e R e f e r e n c e K   /f  9hnc  K n o w l e d g e   I D   ۏL_(u	
 
 - - = = laُ̑O(uN  U N I O N   A L L     V:N	S~g-N	g  n t e x t   penc{|WYg
NO(u  U N I O N   A L L   |~ObJT  n t e x t   penc{|W
NS(uN  S E L E C T   D I S T I N C T   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 9 - 0 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e R e f e r e n c e P 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y I D   i n t , 	 	 	 	 	 	 - - P a g e   D i r e t o r y   v  I D 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 	 - - S_MReS
 
 @ T o p N   I N T 	 	 	 	 	 	 	 - - ԏV gяv  N   agU_
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R`  S Q L   S  O(uR`SNN:NN[s  T o p N   RV:N  S Q L   2 0 0 0   ؏
N/ecSϑb__v  T o p N   GS~0R  S Q L   2 0 0 5   NT1\SNN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 ) 
 
 S E T   @ D y n S Q L = N ' ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _S_MR  P a g e D i r e c t o r y     v  T y p e   <PYg/f  1 RbNTbv~g\O(u  O r d e r   B y   S e r i a l   nfQ[N  S e r i a l   c^	  Yg/f  2   R  O r d e r   B y   U p d a t e T i m e   WNevQ[NS^ec^	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ O r d e r B y   N V A R C H A R ( 2 0 0 ) 
 
 D E C L A R E   @ T y p e   I N T 
 
 S E L E C T   @ T y p e = T y p e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ I D ] = @ P a g e D i r e c t o r y I D 
 
 
 
 I F   @ T y p e = 1 
 
 
 
 	 B E G I N 
 
 	 	 S E T   @ O r d e r B y = N ' O R D E R   B Y   S e r i a l ' 
 
 	 E N D 
 
 E L S E 
 
 	 B E G I N 
 
 	 	 S E T   @ O r d e r B y = N ' O R D E R   B Y   U p d a t e T i m e   D E S C ' 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ K n o w l e d g e A p p r o v e   n v a r c h a r ( 5 0 )   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   @ K n o w l e d g e A p p r o v e = c o n v e r t ( n v a r c h a r ( 5 0 ) , o p t . [ V a l u e ] )   F r o m   d b o . [ O p t i o n ]   o p t   W h e r e   o p t . [ K e y ] = N ' ' K n o w l e d g e A p p r o v e ' '   ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc(u7b/f&T  A d m i n   E d i t o r     Q
NT~g
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N ' 
 
 
 
 I F   d b o . U D F _ U s e r A d m i n E d i t o r ( N ' ' '     +   @ U s e r     +   N ' ' ' ) = 1 
 
 
 
 B E G I N 
 
 
 
 	 S E L E C T   T O P     '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ T o p N )     +   N '   
 
 
 
 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 p a d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e , 
 
 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d , 1 )   A S   A p p r o v e d , 
 
 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( ' ' '   +   @ U s e r   +   N ' ' ' , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 )   A S   H i t C o u n t , 
 
 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t 
 
 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = N ' ' '   +   @ C u l t u r e   +   N ' ' ' 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 
 
 	 W H E R E   p a d . [ I D ] = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ P a g e D i r e c t o r y I D )   +   N '     
 
 
 
 	 '   +   @ O r d e r B y   +   N ' 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 S E L E C T   T O P     '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ T o p N )     +   N '   
 
 
 
 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 p a d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e , 
 
 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( n o w c . A p p r o v e d , 1 )   A S   A p p r o v e d , 
 
 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( ' ' '   +   @ U s e r   +   N ' ' ' , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 - - n o w c . T e m p l a t e   A S   T e m p l a t e , 
 
 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 - - n o w c . T i t l e S h o w   A S   T i t l e S h o w , 
 
 	 	 n o w c . C o n t e n t   A S   C o n t e n t , 
 
 	 	 n o w c . T a g   A S   T a g , 
 
 	 	 n o w c . A b s t r a c t   A S   A b s t r a c t , 
 
 
 
 	 	 I S N U L L ( n o w c . H i t C o u n t , 0 )   A S   H i t C o u n t , 
 
 	 	 ( S e l e c t   C o u n t ( [ I D ] )   F r o m   d b o . K n o w l e d g e C o m m e n t s   W h e r e   K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] )   A S   C o m m e n t s C o u n t 
 
 
 
 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = N ' ' '   +   @ C u l t u r e   +   N ' ' ' 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 
 
 	 W H E R E   p a d . [ I D ] = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ P a g e D i r e c t o r y I D )   +   N '   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' ' , ' ' , N ' ' ' ' ) = N ' ' ' '       o r     d b o . U D F _ U s e r D e d i c a t e d T o ( N ' ' '   +   @ U s e r     +   N ' ' ' , n o w p . D e d i c a t e d T o ) = 1 )     A N D   n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' ' f a l s e ' ' )   
 
 
 
 	 '   +   @ O r d e r B y   +   N ' 
 
 E N D 
 
 
 
 ' 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTgbLR`  S Q L   S  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e R e f e r e n c e P ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e H i d e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e H i d e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e H i d e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \~[  K n o w l e d g e   agvυ    wQSO:Nc[  C u l t u r e   Nv    M a i n D i r e c t o r y C o n t e n t ,   S u b D i r e c t o r y C o n t e n t ,   P a g e D i r e c t o r y C o n t e n t ,   K n o w l e d g e C o n t e n t 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 8 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e H i d e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - \υv  K n o w l e d g e     agvvv  D i r e c t o r y 
 
 @ K n o w l e d g e I t e m   i n t , 	 	 	 	 - - \υv  K n o w l e d g e     agvv  I D 
 
 @ C u l t u r e   n v a r c h a r ( 5 0 ) 	 	 	 	 - - c[  C u l t u r e 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , @ K n o w l e d g e D i r e c t o r y , @ K n o w l e d g e I t e m , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  K n o w l e d g e D i r e c t o r y   
NTۏLYt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' M a i n D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = υ;NvU_
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . M a i n D i r e c t o r y C o n t e n t   S E T   H i d d e n = 1     W H E R E   [ M a i n D i r e c t o r y I D ] = @ K n o w l e d g e I t e m     A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eN;NvU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 0 ,   @ K n o w l e d g e I t e m 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' S u b D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = υP[vU_
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . S u b D i r e c t o r y C o n t e n t   S E T   H i d d e n = 1     W H E R E   [ S u b D i r e c t o r y I D ] = @ K n o w l e d g e I t e m     A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eNP[vU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 1 ,   @ K n o w l e d g e I t e m 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' P a g e D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = υuvU_
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . P a g e D i r e c t o r y C o n t e n t   S E T   H i d d e n = 1     W H E R E   [ P a g e D i r e c t o r y I D ] = @ K n o w l e d g e I t e m     A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eNuvU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 2 ,   @ K n o w l e d g e I t e m 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' K n o w l e d g e ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = υQ[
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i d d e n = 1     W H E R E   [ K n o w l e d g e I D ] = @ K n o w l e d g e I t e m   A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eNuvU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 3 ,   @ K n o w l e d g e I t e m 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e H i d e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e S h o w         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e S h o w ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e S h o w ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \~[  K n o w l e d g e   agv>f:ySmυ	  wQSOc~[    C u l t u r e   Nv    M a i n D i r e c t o r y C o n t e n t ,   S u b D i r e c t o r y C o n t e n t ,   P a g e D i r e c t o r y C o n t e n t ,   K n o w l e d g e C o n t e n t 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e S h o w 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - \υv  K n o w l e d g e     agvvv  D i r e c t o r y 
 
 @ K n o w l e d g e I t e m   i n t , 	 	 	 	 - - \υv  K n o w l e d g e     agvv  I D 
 
 @ C u l t u r e   n v a r c h a r ( 5 0 ) 	 	 	 	 - - ~[  C u l t u r e 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , @ K n o w l e d g e D i r e c t o r y , @ K n o w l e d g e I t e m , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  K n o w l e d g e D i r e c t o r y   
NTۏLYt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' M a i n D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = >f:y;NvU_  lS_  H i d d e n   ^\'`ndveP[^v  H i d d e n I n N a v i g a t i o n O n l y   _NnZi0H i d d e n I n N a v i g a t i o n O n l y   S	g(W  H i d d e n = 1   vePMb	gHe	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . M a i n D i r e c t o r y C o n t e n t   S E T   H i d d e n = 0 , H i d d e n I n N a v i g a t i o n O n l y = 0     W H E R E   [ M a i n D i r e c t o r y I D ] = @ K n o w l e d g e I t e m   A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eN;NvU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 0 ,   @ K n o w l e d g e I t e m 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' S u b D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = >f:yP[vU_  lS_  H i d d e n   ^\'`ndveP[^v  H i d d e n I n N a v i g a t i o n O n l y   _NnZi0H i d d e n I n N a v i g a t i o n O n l y   S	g(W  H i d d e n = 1   vePMb	gHe	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . S u b D i r e c t o r y C o n t e n t   S E T   H i d d e n = 0 , H i d d e n I n N a v i g a t i o n O n l y = 0     W H E R E   [ S u b D i r e c t o r y I D ] = @ K n o w l e d g e I t e m   A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eNP[vU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 1 ,   @ K n o w l e d g e I t e m 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' P a g e D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = >f:yuvU_  lS_  H i d d e n   ^\'`ndveP[^v  H i d d e n I n N a v i g a t i o n O n l y   _NnZi0H i d d e n I n N a v i g a t i o n O n l y   S	g(W  H i d d e n = 1   vePMb	gHe	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . P a g e D i r e c t o r y C o n t e n t   S E T   H i d d e n = 0 , H i d d e n I n N a v i g a t i o n O n l y = 0     W H E R E   [ P a g e D i r e c t o r y I D ] = @ K n o w l e d g e I t e m   A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eNuvU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 2 ,   @ K n o w l e d g e I t e m 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' K n o w l e d g e ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = >f:yQ[
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i d d e n = 0     W H E R E   [ K n o w l e d g e I D ] = @ K n o w l e d g e I t e m   A N D   C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eNQ[	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 3 ,   @ K n o w l e d g e I t e m 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e S h o w ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y S h o w         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y S h o w ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y S h o w ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \~[  C o m m u n i t y   agv>f:ySmυ	    wQSOcv/f~[  C u l t u r e   Nv  C o m m u n i t y C o n t e n t   T  F o r u m C o n t e n t 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 8 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y S h o w 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C o m m u n i t y D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - \υv  C o m m u n i t y     agvvv  D i r e c t o r y 
 
 @ C o m m u n i t y I t e m   i n t , 	 	 	 	 - - \υv  C o m m u n i t y     agvv  I D 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 - - c[  C u l t u r e 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  C o m m u n i t y D i r e c t o r y   
NTۏLYt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   L O W E R ( R T R I M ( L T R I M ( @ C o m m u n i t y D i r e c t o r y ) ) ) = L O W E R ( N ' C o m m u n i t y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 U P D A T E   d b o . C o m m u n i t y C o n t e n t   S E T   H i d d e n = 0     W H E R E   [ C o m m u n i t y I D ] = @ C o m m u n i t y I t e m   A N D   C u l t u r e = @ C u l t u r e 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ C o m m u n i t y D i r e c t o r y ) ) ) = L O W E R ( N ' F o r u m ' ) 
 
 
 
 	 B E G I N 
 
 	 	 U P D A T E   d b o . F o r u m C o n t e n t   S E T   H i d d e n = 0   W H E R E   [ F o r u m I D ] = @ C o m m u n i t y I t e m   A N D   C u l t u r e = @ C u l t u r e 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y S h o w ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y H i d e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y H i d e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y H i d e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \~[  C o m m u n i t y   agvυ  wQSOc~[  C u l t u r e   Nv  C o m m u n i t y C o n t e n t ,   F o r u m C o n t e n t 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 8 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y H i d e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C o m m u n i t y D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - \υv  C o m m u n i t y     agvvv  D i r e c t o r y 
 
 @ C o m m u n i t y I t e m   i n t , 	 	 	 	 - - \υv  C o m m u n i t y     agvv  I D 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 - - ~[  C u l t u r e 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  C o m m u n i t y D i r e c t o r y   
NTۏLYt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   L O W E R ( R T R I M ( L T R I M ( @ C o m m u n i t y D i r e c t o r y ) ) ) = L O W E R ( N ' C o m m u n i t y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 U P D A T E   d b o . C o m m u n i t y C o n t e n t   S E T   H i d d e n = 1     W H E R E   [ C o m m u n i t y I D ] = @ C o m m u n i t y I t e m   A N D   C u l t u r e = @ C u l t u r e 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ C o m m u n i t y D i r e c t o r y ) ) ) = L O W E R ( N ' F o r u m ' ) 
 
 
 
 	 B E G I N 
 
 	 	 U P D A T E   d b o . F o r u m C o n t e n t   S E T   H i d d e n = 1     W H E R E   [ F o r u m I D ] = @ C o m m u n i t y I t e m   A N D   C u l t u r e = @ C u l t u r e 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y H i d e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e H o m e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e H o m e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e H o m e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \~[  K n o w l e d g e     [/f  P a g e D i r e c t o r y 	  n:Nu
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 8 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e H o m e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - \n:Nuv  K n o w l e d g e     agvvv  D i r e c t o r y   [:N  P a g e D i r e c t o r y 	
 
 @ K n o w l e d g e I t e m   i n t 	 	 	 	 - - \n:Nuv  K n o w l e d g e     agvv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg     A d m i n   b  C h i e f E d i t o r   CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 - - E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , @ K n o w l e d g e D i r e c t o r y , @ K n o w l e d g e I t e m , @ o P a s s   O U T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  K n o w l e d g e D i r e c t o r y   
NTۏLYt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' P a g e D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = V:N|~-NTeS	g N*Nu/f  H o m e   P a g e @bNbNHQ\]~/f  H o m e   P a g e   vyvv  H o m e   h_nd
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   H o m e = 0   W H E R E   H o m e = 1 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = n
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   H o m e = 1     W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHhO9eNuvU_	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 2 ,   @ K n o w l e d g e I t e m 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e H o m e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e G e t T i t l e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e G e t T i t l e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e G e t T i t l e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e   I D   N  _  K n o w l e d g e C o n t e n t   h-Nc[eSNv  T i t l e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e G e t T i t l e 
 
 
 
 @ K n o w l e d g e I D   I N T , 	 	 	 	 - - K n o w l e d g e   U_  I D 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - S_MReS
 
 
 
 @ T i t l e   n v a r c h a r ( 2 0 0 0 )   O U T 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ T i t l e = n o w c . T i t l e 
 
 
 
 F R O M   d b o . K n o w l e d g e C o n t e n t   n o w c 
 
 
 
 W H E R E   n o w c . K n o w l e d g e I D = @ K n o w l e d g e I D   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e G e t T i t l e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e T e m p l a t e G e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e T e m p l a t e G e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e T e m p l a t e G e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =   S P   vvv/f(Wck_  R e n d e r   K n o w l e d g e   MR=\S_L i g h t   W e i g h t   0WԏV  T e m p l a t e   
TW[NO(W  P a g e   H e a d e r   -NlQ  T e m p l a t e   SS+Tv  c s s   eN
 
 - - = = YgcOv  @ P a g e D i r e c t o r y N a m e   ^zz\ԏV  H o m e   P a g e   uv  T e m p l a t e   
TW[
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 8 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e T e m p l a t e G e t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - P a g e   D i r e t o r y   v  N a m e 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 	 	 - - S_MReS
 
 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgcOv  @ P a g e D i r e c t o r y N a m e   :NzzfbN^gԏVv/fuv  T e m p l a t e   
TW[ُebN guv  P a g e D i r e c t o r y N a m e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( L E N ( R T R I M ( L T R I M ( @ P a g e D i r e c t o r y N a m e ) ) ) = 0 ) 
 
 
 
 B E G I N 
 
 	 S E L E C T   @ P a g e D i r e c t o r y N a m e = p d . [ N a m e ]   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . H o m e = 1 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTԏVS_MR  @ P a g e D i r e c t o r y N a m e   [^v  P a g e D i r e c t o r y   (Wc[  @ C u l t u r e   Nv  P a g e D i r e c t o r y C o n t e n t   -Nv  T e m p l a t e   
T
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   
 
 
 
 	 p d c . T e m p l a t e   A S   T e m p l a t e 
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y C o n t e n t   p d c 
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p d   O N   p d . [ I D ] = p d c . P a g e D i r e c t o r y I D 
 
 
 
 W H E R E   p d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   p d c . [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e T e m p l a t e G e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e O r d e r         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e O r d e r ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e O r d e r ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \c[  M a i n D i r e c t o r y ,   S u b D i r e c t o r y ,   P a g e D i r e c t o r y ,   K n o w l e d g e   ۏL
Ny/ Ny
 
 - - = = St
 
 - - = = 1 .   HQ\~[wƋagvv
N~wƋagvNv@b	gagv	Qeg_hQDQ_agv	S_6q	c  S e r i a l   c^	
 
 - - = = 2 .   \[Nv  S e r i a l   ͑e^zN  1    _Y/}R	ُ7hSNScvQ-Nvom
 
 - - = = Yg/f
Ny
 
 - - = = 3 .   ~b0Rc[agvNS[vMRbvagvS e r i a l   k[\  1   vagv  -     bN
Nb]~͑^N  S e r i a l 	
 
 - - = = 4 .   \c[agvv  S e r i a l   - 1     MReagvv  S e r i a l   + 1   
 
 - - = = Yg/fNy
 
 - - = = 3 .   ~b0Rc[agvNS[vTbvagvS e r i a l   k['Y  1   vagv  -     bN
Nb]~͑^N  S e r i a l 	
 
 - - = = 4 .   \c[agvv  S e r i a l   + 1   Teagvv  S e r i a l   - 1   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 2 - 3 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e O r d e r 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - \
Ny/ Nyv  K n o w l e d g e     agvvv  D i r e c t o r y 
 
 @ K n o w l e d g e I t e m   i n t , 	 	 	 	 - - \
Ny/ Nyv  K n o w l e d g e     agvv  I D 
 
 @ A c t i o n   i n t 	 	 	 	 	 - - 
Ny؏/fNy    
Ny/f  - 1   Ny/f  + 1 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , @ K n o w l e d g e D i r e c t o r y , @ K n o w l e d g e I t e m , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = lQ(uSϑ  I D ,   S e r i a l ,   N e w S e r i a l ,   G i v e n I t e m N e w S e r i a l ,   P a r e n t I D   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ I D   I N T ,   @ S e r i a l   I N T ,   @ N e w S e r i a l   I N T ,     @ G i v e n I t e m N e w S e r i a l   I N T ,   @ P a r e n t I D   I N T ,   @ O v e r v i e w I D   I N T 
 
 S E T   @ N e w S e r i a l = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  K n o w l e d g e D i r e c t o r y   
NTۏLYt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' M a i n D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O(u  C U R S O R   ͑e^z  S e r i a l   ScSeg  S e r i a l   -Nvom	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   M a i n D i r e c t o r y C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . M a i n D i r e c t o r y     O R D E R   B Y   S e r i a l 
 
 
 
 	 	 O P E N   M a i n D i r e c t o r y C u r s o r 
 
 	 	 F E T C H   N E X T   F R O M   M a i n D i r e c t o r y C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . M a i n D i r e c t o r y   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ I D 
 
 	 	 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 	 	 F E T C H   N E X T   F R O M   M a i n D i r e c t o r y C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 	 	 E N D 
 
 
 
 	 	 C L O S E   M a i n D i r e c t o r y C u r s o r 
 
 	 	 D E A L L O C A T E   M a i n D i r e c t o r y C u r s o r 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = _c[yvv  S e r i a l 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ G i v e n I t e m N e w S e r i a l = S e r i a l   F R O M   d b o . M a i n D i r e c t o r y   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc/f
Ny؏/fNyYtvv$N*Nagv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ A c t i o n = - 1 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   - 1 [MRbvyvv  S e r i a l   +   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . M a i n D i r e c t o r y   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l - 1 ) 
 
 	 	 	 	 U P D A T E   d b o . M a i n D i r e c t o r y   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   +   1 [Tbvyvv  S e r i a l   -   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . M a i n D i r e c t o r y   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l + 1 ) 
 
 	 	 	 	 U P D A T E   d b o . M a i n D i r e c t o r y   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 	 E N D 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' S u b D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQ_S_MRagvv6ragv  I D   Nb(u	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ P a r e n t I D = M a i n D i r e c t o r y I D   F R O M   d b o . S u b D i r e c t o r y   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O(u  C U R S O R   ͑e^z  S e r i a l   ScSeg  S e r i a l   -Nvom	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   S u b D i r e c t o r y C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . S u b D i r e c t o r y   W H E R E   M a i n D i r e c t o r y I D = @ P a r e n t I D       O R D E R   B Y   S e r i a l 
 
 
 
 	 	 O P E N   S u b D i r e c t o r y C u r s o r 
 
 	 	 F E T C H   N E X T   F R O M   S u b D i r e c t o r y C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ I D 
 
 	 	 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 	 	 F E T C H   N E X T   F R O M   S u b D i r e c t o r y C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 	 	 E N D 
 
 
 
 	 	 C L O S E   S u b D i r e c t o r y C u r s o r 
 
 	 	 D E A L L O C A T E   S u b D i r e c t o r y C u r s o r 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = _c[yvv  S e r i a l 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ G i v e n I t e m N e w S e r i a l = S e r i a l   F R O M   d b o . S u b D i r e c t o r y   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc/f
Ny؏/fNyYtvv$N*Nagv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ A c t i o n = - 1 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   - 1 [MRbvyvv  S e r i a l   +   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l - 1   A N D     M a i n D i r e c t o r y I D = @ P a r e n t I D ) 
 
 	 	 	 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   +   1 [Tbvyvv  S e r i a l   -   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l + 1   A N D     M a i n D i r e c t o r y I D = @ P a r e n t I D ) 
 
 	 	 	 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  gT(u  S P   S u b D i r e c t o r y S e t O v e r v i e w   \S_MR  M a i n D i r e c t o r y   Nv  O v e r v i e w   S u b D i r e c t o r y   Qn NM  O v e r v i e w   n  O v e r v i e w   SN:_L[,g  M a i n D i r e c t o r y   Nv  S u b D i r e c t o r y   ͑ec^$cczzTeMQ  O v e r v i e w   yvv  S e r i a l   	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . S u b D i r e c t o r y   W H E R E   O v e r v i e w = 1   A N D   M a i n D i r e c t o r y I D = @ P a r e n t I D ) 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   @ O v e r v i e w I D = [ I D ]   F R O M   d b o . S u b D i r e c t o r y   W H E R E   O v e r v i e w = 1   A N D   M a i n D i r e c t o r y I D = @ P a r e n t I D 
 
 	 	 	 E X E C   d b o . S u b D i r e c t o r y S e t O v e r v i e w   @ U s e r , @ O v e r v i e w I D 	 
 
 	 	 E N D 	 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' P a g e D i r e c t o r y ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQ_S_MRagvv6ragv  I D   Nb(u	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ P a r e n t I D = S u b D i r e c t o r y I D   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O(u  C U R S O R   ͑e^z  S e r i a l   ScSeg  S e r i a l   -Nvom	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   P a g e D i r e c t o r y C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   S u b D i r e c t o r y I D = @ P a r e n t I D       O R D E R   B Y   S e r i a l 
 
 
 
 	 	 O P E N   P a g e D i r e c t o r y C u r s o r 
 
 	 	 F E T C H   N E X T   F R O M   P a g e D i r e c t o r y C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ I D 
 
 	 	 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 	 	 F E T C H   N E X T   F R O M   P a g e D i r e c t o r y C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 	 	 E N D 
 
 
 
 	 	 C L O S E   P a g e D i r e c t o r y C u r s o r 
 
 	 	 D E A L L O C A T E   P a g e D i r e c t o r y C u r s o r 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = _c[yvv  S e r i a l 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ G i v e n I t e m N e w S e r i a l = S e r i a l   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc/f
Ny؏/fNyYtvv$N*Nagv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ A c t i o n = - 1 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   - 1 [MRbvyvv  S e r i a l   +   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l - 1   A N D     S u b D i r e c t o r y I D = @ P a r e n t I D ) 
 
 	 	 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   +   1 [Tbvyvv  S e r i a l   -   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l + 1   A N D     S u b D i r e c t o r y I D = @ P a r e n t I D ) 
 
 	 	 	 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  gT(u  S P   P a g e D i r e c t o r y S e t O v e r v i e w   \S_MR  S u b D i r e c t o r y   Nv  O v e r v i e w   P a g e D i r e c t o r y   Qn NM  O v e r v i e w   n  O v e r v i e w   SN:_L[,g  S u b D i r e c t o r y   Nv  P a g e D i r e c t o r y   ͑ec^$cczzTeMQ  O v e r v i e w   yvv  S e r i a l   	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   W H E R E   O v e r v i e w = 1   A N D   S u b D i r e c t o r y I D = @ P a r e n t I D ) 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   @ O v e r v i e w I D = [ I D ]   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   O v e r v i e w = 1   A N D   S u b D i r e c t o r y I D = @ P a r e n t I D 
 
 	 	 	 E X E C   d b o . P a g e D i r e c t o r y S e t O v e r v i e w   @ U s e r , @ O v e r v i e w I D 	 
 
 	 	 E N D 	 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ K n o w l e d g e D i r e c t o r y ) ) ) = L O W E R ( N ' K n o w l e d g e ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQ_S_MRagvv6ragv  I D   Nb(u	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ P a r e n t I D = P a g e D i r e c t o r y I D   F R O M   d b o . K n o w l e d g e   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O(u  C U R S O R   ͑e^z  S e r i a l   ScSeg  S e r i a l   -Nvom	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   K n o w l e d g e C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . K n o w l e d g e   W H E R E   P a g e D i r e c t o r y I D = @ P a r e n t I D       O R D E R   B Y   S e r i a l 
 
 
 
 	 	 O P E N   K n o w l e d g e C u r s o r 
 
 	 	 F E T C H   N E X T   F R O M   K n o w l e d g e C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . K n o w l e d g e   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ I D 
 
 	 	 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 	 	 F E T C H   N E X T   F R O M   K n o w l e d g e C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 	 	 E N D 
 
 
 
 	 	 C L O S E   K n o w l e d g e C u r s o r 
 
 	 	 D E A L L O C A T E   K n o w l e d g e C u r s o r 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = _c[yvv  S e r i a l 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ G i v e n I t e m N e w S e r i a l = S e r i a l   F R O M   d b o . K n o w l e d g e   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc/f
Ny؏/fNyYtvv$N*Nagv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ A c t i o n = - 1 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   - 1 [MRbvyvv  S e r i a l   +   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . K n o w l e d g e   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . K n o w l e d g e   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l - 1   A N D     P a g e D i r e c t o r y I D = @ P a r e n t I D ) 
 
 	 	 	 	 U P D A T E   d b o . K n o w l e d g e   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   +   1 [Tbvyvv  S e r i a l   -   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . K n o w l e d g e   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . K n o w l e d g e   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l + 1   A N D     P a g e D i r e c t o r y I D = @ P a r e n t I D ) 
 
 	 	 	 	 U P D A T E   d b o . K n o w l e d g e   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 	 E N D 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e O r d e r ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y O r d e r         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y O r d e r ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y O r d e r ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \c[  C o m m u n i t y ,   F o r u m   ۏL
Ny/ Ny
 
 - - = = St
 
 - - = = 1 .   HQ\~[  C o m m u n i t y   /   F o r u m   agvv
N~wƋagvNv@b	gagv	Qeg_hQDQ_agv	S_6q	c  S e r i a l   c^	
 
 - - = = 2 .   \[Nv  S e r i a l   ͑e^zN  1    _Y/}R	ُ7hSNScvQ-Nvom
 
 - - = = Yg/f
Ny
 
 - - = = 3 .   ~b0Rc[agvNS[vMRbvagvS e r i a l   k[\  1   vagv  -     bN
Nb]~͑^N  S e r i a l 	
 
 - - = = 4 .   \c[agvv  S e r i a l   - 1     MReagvv  S e r i a l   + 1   
 
 - - = = Yg/fNy
 
 - - = = 3 .   ~b0Rc[agvNS[vTbvagvS e r i a l   k['Y  1   vagv  -     bN
Nb]~͑^N  S e r i a l 	
 
 - - = = 4 .   \c[agvv  S e r i a l   + 1   Teagvv  S e r i a l   - 1   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y O r d e r 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C o m m u n i t y D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - \
Ny/ Nyv  C o m m u n i t y / F o r u m     agvvv  D i r e c t o r y 
 
 @ C o m m u n i t y I t e m   i n t , 	 	 	 	 - - \
Ny/ Nyv  C o m m u n i t y / F o r u m     agvv  I D 
 
 @ A c t i o n   i n t 	 	 	 	 	 - - 
Ny؏/fNy    
Ny/f  - 1   Ny/f  + 1 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = lQ(uSϑ  I D ,   S e r i a l ,   N e w S e r i a l ,   G i v e n I t e m N e w S e r i a l ,   P a r e n t I D   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ I D   I N T ,   @ S e r i a l   I N T ,   @ N e w S e r i a l   I N T ,     @ G i v e n I t e m N e w S e r i a l   I N T ,   @ P a r e n t I D   I N T 
 
 S E T   @ N e w S e r i a l = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  C o m m u n i t y D i r e c t o r y   
NTۏLYt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   L O W E R ( R T R I M ( L T R I M ( @ C o m m u n i t y D i r e c t o r y ) ) ) = L O W E R ( N ' C o m m u n i t y ' ) 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O(u  C U R S O R   ͑e^z  S e r i a l   ScSeg  S e r i a l   -Nvom	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   C o m m u n i t y C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . C o m m u n i t y     O R D E R   B Y   S e r i a l 
 
 
 
 	 	 O P E N   C o m m u n i t y C u r s o r 
 
 	 	 F E T C H   N E X T   F R O M   C o m m u n i t y C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . C o m m u n i t y   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ I D 
 
 	 	 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 	 	 F E T C H   N E X T   F R O M   C o m m u n i t y C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 	 	 E N D 
 
 
 
 	 	 C L O S E   C o m m u n i t y C u r s o r 
 
 	 	 D E A L L O C A T E   C o m m u n i t y C u r s o r 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = _c[yvv  S e r i a l 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ G i v e n I t e m N e w S e r i a l = S e r i a l   F R O M   d b o . C o m m u n i t y   W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc/f
Ny؏/fNyYtvv$N*Nagv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ A c t i o n = - 1 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   - 1 [MRbvyvv  S e r i a l   +   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . C o m m u n i t y   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . C o m m u n i t y   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l - 1 ) 
 
 	 	 	 	 U P D A T E   d b o . C o m m u n i t y   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   +   1 [Tbvyvv  S e r i a l   -   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . C o m m u n i t y   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . C o m m u n i t y   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l + 1 ) 
 
 	 	 	 	 U P D A T E   d b o . C o m m u n i t y   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 	 	 	 E N D 
 
 	 E N D 
 
 
 
 E L S E   I F   L O W E R ( R T R I M ( L T R I M ( @ C o m m u n i t y D i r e c t o r y ) ) ) = L O W E R ( N ' F o r u m ' ) 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQ_S_MRagvv6ragv  I D   Nb(u	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ P a r e n t I D = C o m m u n i t y I D   F R O M   d b o . F o r u m   W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O(u  C U R S O R   ͑e^z  S e r i a l   ScSeg  S e r i a l   -Nvom	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   F o r u m C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . F o r u m     W H E R E   C o m m u n i t y I D = @ P a r e n t I D       O R D E R   B Y   S e r i a l 
 
 
 
 	 	 O P E N   F o r u m C u r s o r 
 
 	 	 F E T C H   N E X T   F R O M   F o r u m C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 
 
 	 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . F o r u m   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ I D 
 
 	 	 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 	 	 F E T C H   N E X T   F R O M   F o r u m C u r s o r     I N T O   @ I D , @ S e r i a l 
 
 	 	 E N D 
 
 
 
 	 	 C L O S E   F o r u m C u r s o r 
 
 	 	 D E A L L O C A T E   F o r u m C u r s o r 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = _c[yvv  S e r i a l 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ G i v e n I t e m N e w S e r i a l = S e r i a l   F R O M   d b o . F o r u m   W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc/f
Ny؏/fNyYtvv$N*Nagv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ A c t i o n = - 1 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   - 1 [MRbvyvv  S e r i a l   +   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . F o r u m   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . F o r u m   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l - 1   A N D     C o m m u n i t y I D = @ P a r e n t I D ) 
 
 	 	 	 	 U P D A T E   d b o . F o r u m   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = \c[yvv  S e r i a l   +   1 [Tbvyvv  S e r i a l   -   1 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 U P D A T E   d b o . F o r u m   S E T   S e r i a l = S e r i a l - 1   W H E R E   [ I D ] = ( S e l e c t   [ I D ]   F r o m   d b o . F o r u m   W h e r e   S e r i a l = @ G i v e n I t e m N e w S e r i a l + 1   A N D     C o m m u n i t y I D = @ P a r e n t I D ) 
 
 	 	 	 	 U P D A T E   d b o . F o r u m   S E T   S e r i a l = S e r i a l + 1   W H E R E   [ I D ] = @ C o m m u n i t y I t e m 
 
 	 	 	 E N D 
 
 	 E N D 
 
 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y O r d e r ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S e a P a r a m e t e r S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S e a P a r a m e t e r S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S e a P a r a m e t e r S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  S e a P a r a m e t e r   -Nv  G o o g l e V e r i f i c a t i o n ,   Y a h o o V e r i f i c a t i o n ,   G o o g l e A n a l y t i c s C o d e     Spe
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S e a P a r a m e t e r S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ G o o g l e V e r i f i c a t i o n   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - Spe  G o o g l e V e r i f i c a t i o n   v<P
 
 @ Y a h o o V e r i f i c a t i o n   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - Spe  Y a h o o V e r i f i c a t i o n   v<P
 
 @ G o o g l e A n a l y t i c s C o d e   n v a r c h a r ( 2 0 0 0 ) 	 	 	 - - Spe  G o o g l e A n a l y t i c s C o d e   v<P
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = fe  G o o g l e V e r i f i c a t i o n   	gR9eKNeRmR	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ G o o g l e V e r i f i c a t i o n < > N U L L )   A N D   ( @ G o o g l e V e r i f i c a t i o n   I S   N O T   N U L L ) 
 
 
 
 B E G I N 
 
 	 I F   N O T   E X I S T S   ( S e l e c t   [ V a l u e ]   F r o m   d b o . S e a P a r a m e t e r   W h e r e   [ P a r a m e t e r ] = N ' G o o g l e V e r i f i c a t i o n ' ) 
 
 
 
 	 	 B E G I N 
 
 	 	 	 I N S E R T   I N T O   d b o . S e a P a r a m e t e r   ( [ I D ] , [ P a r a m e t e r ] , [ V a l u e ] )   V A L U E S   ( 1 , N ' G o o g l e V e r i f i c a t i o n ' , @ G o o g l e V e r i f i c a t i o n ) 
 
 	 	 E N D 
 
 	 E L S E 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . S e a P a r a m e t e r   S E T   [ V a l u e ] = @ G o o g l e V e r i f i c a t i o n   W H E R E   [ P a r a m e t e r ] = N ' G o o g l e V e r i f i c a t i o n ' 
 
 	 	 E N D 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = fe  Y a h o o V e r i f i c a t i o n   	gR9eKNeRmR	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ Y a h o o V e r i f i c a t i o n < > N U L L )   A N D   ( @ Y a h o o V e r i f i c a t i o n   I S   N O T   N U L L ) 
 
 
 
 B E G I N 
 
 	 I F   N O T   E X I S T S   ( S e l e c t   [ V a l u e ]   F r o m   d b o . S e a P a r a m e t e r   W h e r e   [ P a r a m e t e r ] = N ' Y a h o o V e r i f i c a t i o n ' ) 
 
 
 
 	 	 B E G I N 
 
 	 	 	 I N S E R T   I N T O   d b o . S e a P a r a m e t e r   ( [ I D ] , [ P a r a m e t e r ] , [ V a l u e ] )   V A L U E S   ( 2 , N ' Y a h o o V e r i f i c a t i o n ' , @ Y a h o o V e r i f i c a t i o n ) 
 
 	 	 E N D 
 
 	 E L S E 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . S e a P a r a m e t e r   S E T   [ V a l u e ] = @ Y a h o o V e r i f i c a t i o n   W H E R E   [ P a r a m e t e r ] = N ' Y a h o o V e r i f i c a t i o n ' 
 
 	 	 E N D 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = fe  G o o g l e A n a l y t i c s C o d e   	gR9eKNeRmR	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ G o o g l e A n a l y t i c s C o d e < > N U L L )   A N D   ( @ G o o g l e A n a l y t i c s C o d e   I S   N O T   N U L L ) 
 
 
 
 B E G I N 
 
 	 I F   N O T   E X I S T S   ( S e l e c t   [ V a l u e ]   F r o m   d b o . S e a P a r a m e t e r   W h e r e   [ P a r a m e t e r ] = N ' G o o g l e A n a l y t i c s C o d e ' ) 
 
 
 
 	 	 B E G I N 
 
 	 	 	 I N S E R T   I N T O   d b o . S e a P a r a m e t e r   ( [ I D ] , [ P a r a m e t e r ] , [ V a l u e ] )   V A L U E S   ( 3 , N ' G o o g l e A n a l y t i c s C o d e ' , @ G o o g l e A n a l y t i c s C o d e ) 
 
 	 	 E N D 
 
 	 E L S E 
 
 	 	 B E G I N 
 
 	 	 	 U P D A T E   d b o . S e a P a r a m e t e r   S E T   [ V a l u e ] = @ G o o g l e A n a l y t i c s C o d e   W H E R E   [ P a r a m e t e r ] = N ' G o o g l e A n a l y t i c s C o d e ' 
 
 	 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S e a P a r a m e t e r S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S e a P a r a m e t e r S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S e a P a r a m e t e r S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S e a P a r a m e t e r S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV  S e a P a r a m e t e r   -Nv  G o o g l e V e r i f i c a t i o n ,   Y a h o o V e r i f i c a t i o n   Spe
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S e a P a r a m e t e r S e l e c t 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
N(uV:NbNO(u  B u l t i n C o n n e c t i o n S t r i n g 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	S
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   *   F R O M   d b o . S e a P a r a m e t e r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S e a P a r a m e t e r S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o n t e n t E x i s t s U n d e r M a i n D i r e c t o r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o n t e n t E x i s t s U n d e r M a i n D i r e c t o r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o n t e n t E x i s t s U n d e r M a i n D i r e c t o r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MReSNc[  M a i n D i r e c t o r y   yvN/f&TX[(W  C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8 
 
 - - = =   S P   vMR]l	g[E(uYSN RdN  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o n t e n t E x i s t s U n d e r M a i n D i r e c t o r y 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 5 0 ) , 	 	 - - S_MReS
 
 @ I t e m   I N T , 	 	 	 - - c[v  M a i n D i r e c t o r y     yvv  I D 
 
 @ o E x i s t s   I N T   O U T 	 	 - - QSpeX[(WԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP
NX[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o E x i s t s = 0 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = /f&TX[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S E L E C T   n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   n o w c   W H E R E   n o w c . K n o w l e d g e I D   I N   ( S e l e c t   n o w . [ I D ]   F r o m   d b o . K n o w l e d g e   n o w   W h e r e   n o w . P a g e D i r e c t o r y I D   I n   ( s e l e c t   p d . [ I D ]   f r o m   d b o . P a g e D i r e c t o r y   p d   w h e r e   p d . S u b D i r e c t o r y I D   i n   ( s e l e c t   s d . [ I D ]   f r o m   d b o . S u b D i r e c t o r y   s d   w h e r e   s d . M a i n D i r e c t o r y I D = @ I t e m ) ) )   A N D   n o w c . C u l t u r e = @ C u l t u r e   A N D   L E N ( L T R I M ( R T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w c . C o n t e n t ) ) ) ) > 0 ) 
 
 B E G I N 
 
 	 S E T   @ o E x i s t s = 1 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o n t e n t E x i s t s U n d e r M a i n D i r e c t o r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o n t e n t E x i s t s U n d e r S u b D i r e c t o r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o n t e n t E x i s t s U n d e r S u b D i r e c t o r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o n t e n t E x i s t s U n d e r S u b D i r e c t o r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MReSNc[  S u b D i r e c t o r y   yvN/f&TX[(W  C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8 
 
 - - = =   S P   vMR]l	g[E(uYSN RdN  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o n t e n t E x i s t s U n d e r S u b D i r e c t o r y 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 5 0 ) , 	 	 - - S_MReS
 
 @ I t e m   I N T , 	 	 	 - - c[v  S u b D i r e c t o r y     yvv  I D 
 
 @ o E x i s t s   I N T   O U T 	 	 - - QSpeX[(WԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP
NX[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o E x i s t s = 0 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = /f&TX[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S E L E C T   n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   n o w c   W H E R E   n o w c . K n o w l e d g e I D   I N   ( S e l e c t   n o w . [ I D ]   F r o m   d b o . K n o w l e d g e   n o w   W h e r e   n o w . P a g e D i r e c t o r y I D   I n   ( s e l e c t   p d . [ I D ]   f r o m   d b o . P a g e D i r e c t o r y   p d   w h e r e   p d . S u b D i r e c t o r y I D = @ I t e m ) )   A N D   n o w c . C u l t u r e = @ C u l t u r e   A N D   L E N ( L T R I M ( R T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w c . C o n t e n t ) ) ) ) > 0 ) 
 
 B E G I N 
 
 	 S E T   @ o E x i s t s = 1 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o n t e n t E x i s t s U n d e r S u b D i r e c t o r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o n t e n t E x i s t s U n d e r P a g e D i r e c t o r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o n t e n t E x i s t s U n d e r P a g e D i r e c t o r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o n t e n t E x i s t s U n d e r P a g e D i r e c t o r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MReSNc[  P a g e D i r e c t o r y   yvN/f&TX[(W  C o n t e n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8 
 
 - - = =   S P   vMR]l	g[E(uYSN RdN  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o n t e n t E x i s t s U n d e r P a g e D i r e c t o r y 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 5 0 ) , 	 	 - - S_MReS
 
 @ I t e m   I N T , 	 	 	 - - c[v  P a g e D i r e c t o r y     yvv  I D 
 
 @ o E x i s t s   I N T   O U T 	 	 - - QSpeX[(WԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP
NX[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o E x i s t s = 0 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = /f&TX[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S E L E C T   n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   n o w c   W H E R E   n o w c . K n o w l e d g e I D   I N   ( S e l e c t   n o w . [ I D ]   F r o m   d b o . K n o w l e d g e   n o w   W h e r e   n o w . P a g e D i r e c t o r y I D = @ I t e m )   A N D   n o w c . C u l t u r e = @ C u l t u r e   A N D   L E N ( L T R I M ( R T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w c . C o n t e n t ) ) ) ) > 0 ) 
 
 B E G I N 
 
 	 S E T   @ o E x i s t s = 1 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o n t e n t E x i s t s U n d e r P a g e D i r e c t o r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e R e l a t i v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e R e l a t i v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e R e l a t i v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~Q  T a g S/f   ,     _vY  T a g   Rh	NhQz@b	gQ[-N[~bsQTvQ[
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 9 - 0 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e R e l a t i v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e C o n t e n t I D   i n t , 	 	 	 	 	 - - S_MR  K n o w l e d g e C o n t e n t     v  I D   bNԏV  K n o w l e d g e R e l a t i v e   vePcdS_MR  K n o w l e d g e C o n t e n t   ]	
 
 @ T a g   n v a r c h a r ( 5 0 0 ) , 	 	 	 	 	 	 - - O(uv  T a g   ۏLǏn	
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 	 	 - - S_MReS
 
 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ K n o w l e d g e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' K n o w l e d g e A p p r o v e ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 I F   d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1           
 
 
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = YgS_MR(u7b
0/f0  A d m i n   E d i t o r 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T   D I S T I N C T   T O P   5 
 
 	 	 
 
 	 	 p d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e , 
 
 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 n o w c . K n o w l e d g e I D   A S   K n o w l e d g e I D , 
 
 	 	 n o w c . C u l t u r e   A S   C u l t u r e , 
 
 	 	 n o w c . T i t l e   A S   T i t l e 
 
 	 
 
 	 F R O M   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' )   t a g 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e T a g s   n o w t   o n   t a g . E l e m e n t = n o w t . T a g 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   o n   n o w c . [ I D ] = n o w t . K n o w l e d g e C o n t e n t I D 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e   n o w   o n   n o w . [ I D ] = n o w c . K n o w l e d g e I D 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p d   o n   p d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 
 
 	 W H E R E   n o w c . [ I D ] < > @ K n o w l e d g e C o n t e n t I D   A N D   n o w c . C u l t u r e = @ C u l t u r e   
 
 
 
 	 O R D E R   B Y   U p d a t e T i m e 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = YgS_MR(u7b
0
N/f0  A d m i n   E d i t o r 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T   D I S T I N C T   T O P   5 
 
 	 	 
 
 	 	 p d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e , 
 
 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 n o w c . K n o w l e d g e I D   A S   K n o w l e d g e I D , 
 
 	 	 n o w c . C u l t u r e   A S   C u l t u r e , 
 
 	 	 n o w c . T i t l e   A S   T i t l e 
 
 	 
 
 	 F R O M   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' )   t a g 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e T a g s   n o w t   o n   t a g . E l e m e n t = n o w t . T a g 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   o n   n o w c . [ I D ] = n o w t . K n o w l e d g e C o n t e n t I D 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e   n o w   o n   n o w . [ I D ] = n o w c . K n o w l e d g e I D 
 
 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p d   o n   p d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 
 
 	 W H E R E   n o w c . [ I D ] < > @ K n o w l e d g e C o n t e n t I D   A N D   n o w c . C u l t u r e = @ C u l t u r e   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 	 
 
 	 - - W H E R E   n o w c . [ I D ] < > @ K n o w l e d g e C o n t e n t I D   A N D   n o w c . C u l t u r e = @ C u l t u r e   A N D   ( R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' '   o r   n o w . D e d i c a t e d T o   i s   N U L L   o r   R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' * '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) = 1 )     A N D   d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) < > 1   A N D     n o w c . H i d d e n < > 1 
 
 	 - - W H E R E   n o w c . [ I D ] < > @ K n o w l e d g e C o n t e n t I D   A N D   n o w c . C u l t u r e = @ C u l t u r e   A N D   ( R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' '   o r   n o w . D e d i c a t e d T o   i s   N U L L   o r   R T R I M ( L T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) ) = N ' * '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . D e d i c a t e d T o ) ) = 1 )     A N D   d b o . U D F _ U s e r C l i e n t ( @ U s e r ) = 1   A N D   d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1   A N D     n o w c . H i d d e n < > 1 
 
 
 
 	 O R D E R   B Y   U p d a t e T i m e 
 
 
 
 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e R e l a t i v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c T a b l e C o l u m n C h a r a c t e r M a x i m u m L e n g t h         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c T a b l e C o l u m n C h a r a c t e r M a x i m u m L e n g t h ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c T a b l e C o l u m n C h a r a c t e r M a x i m u m L e n g t h ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Sc[hvc[Rvpenc[IN^
 
 - - = =  N,(ueg_g*Nhvg*Ne,g{|WRvpenc^:NN(W  A S P X   z[pencۏL^hKm2bk	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 8 - 1 0 - 2 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c T a b l e C o l u m n C h a r a c t e r M a x i m u m L e n g t h 
 
 
 
 @ T a b l e N a m e   n v a r c h a r ( 1 2 8 ) ,   	 	 	 - - c[h
 
 @ C o l u m n N a m e   n v a r c h a r ( 1 2 8 ) , 	 	 	 - - c[R
 
 
 
 @ R e t u r n V a l u e   i n t   O U T 	 	 	 	 - - ԏV<P
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 
 
 	 @ R e t u r n V a l u e = C H A R A C T E R _ M A X I M U M _ L E N G T H   
 
 
 
 F R O M   I N F O R M A T I O N _ S C H E M A . [ C O L U M N S ]   
 
 
 
 W H E R E   T A B L E _ N A M E = @ T a b l e N a m e   A N D   C O L U M N _ N A M E = @ C o l u m n N a m e 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 R E T U R N   @ R e t u r n V a l u e 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c T a b l e C o l u m n C h a r a c t e r M a x i m u m L e n g t h ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . O p t i o n S e l e c t B y C a t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ O p t i o n S e l e c t B y C a t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ O p t i o n S e l e c t B y C a t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S  O p t i o n   hc[  C a t   Nv@b	gU_  S_MR  C u l t u r e   N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . O p t i o n S e l e c t B y C a t 
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) ,   	 	 	 - - S_MReS
 
 @ C a t   n v a r c h a r ( 1 0 0 ) 	 	 	 - - c[  C a t 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQbN[~[v  C u l t u r e   ۏLhgww  O p t i o n C o n t e n t   -N/f&TS+T  C u l t u r e Yg
NS+TbN:_  @ C u l t u r e   O(u؞v  e n - u s 2bk(u7bO(u
N/ecvLub ۏeQ|~{t  |   |~	y
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   N O T   E X I S T S   ( S e l e c t   o p c . [ I D ]   F r o m   d b o . O p t i o n C o n t e n t   o p c   W h e r e   o p c . C u l t u r e = @ C u l t u r e ) 
 
 B E G I N 
 
 	 S E L E C T   @ C u l t u r e = N ' e n - u s ' 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV@b	g  O p t i o n   U_J o i n   S_MReSNv  O p t i o n C o n t e n t   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   
 
 
 
 	 o p t . [ I D ]   A S   [ I D ] , 
 
 	 o p t . C a t   A S   C a t , 
 
 	 o p t . R i g h t I n d e n t   A S   R i g h t I n d e n t , 
 
 	 o p t . [ K e y ]   A S   [ K e y ] , 
 
 	 o p t . V a l u e   A S   V a l u e , 
 
 	 o p t . L e g e n d   A S   L e g e n d , 
 
 	 o p t . N u m b e r O n l y   A S   N u m b e r O n l y , 
 
 	 o p t . T e x t A r e a   A S   T e x t A r e a , 
 
 	 o p t . M u l t i C u l t u r e   A S   M u l t i C u l t u r e , 
 
 	 o p t . F o r T h e m e   A S   F o r T h e m e , 
 
 	 o p t . V a l i d a t i o n   A S   V a l i d a t i o n , 
 
 	 o p c . T i t l e   A S   T i t l e , 
 
 	 o p c . C a t T i t l e   A S   C a t T i t l e , 
 
 	 o p c . [ D e s c r i p t i o n ]   A s   [ D e s c r i p t i o n ] 
 
 
 
 F R O M   d b o . [ O p t i o n ]   o p t   
 
 L E F T   J O I N   d b o . O p t i o n C o n t e n t   o p c   O N   o p c . O p t i o n I D = o p t . [ I D ] 
 
 
 
 W H E R E   o p c . C u l t u r e = @ C u l t u r e   A N D   o p t . C a t = @ C a t 
 
 
 
 O R D E R   B Y   o p t . [ I D ] 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ O p t i o n S e l e c t B y C a t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y S e t O v e r v i e w         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y S e t O v e r v i e w ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y S e t O v e r v i e w ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \c[  P a g e D i r e c t o r y   yvv  O v e r v i e w   ^\'`n:N  t r u e 
 
 - - = =  HQ\c[  P a g e D i r e c t o r y   v@b	gDQ_yv  ( T N*N  S u b D i r e c t o r y   N)   v  O v e r v i e w   ^\'`n:N  f a l s e 
 
 - - = = c@w\@b	gDQ_yvN  2    _Y	cSHQ!k^͑eMn  S e r i a l 
 
 - - = =  gT\c[  P a g e D i r e c t o r y   v  S e r i a l   n:N  1   v^\vQ  O v e r v i e w   n:N  t r u e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 2 - 3 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y S e t O v e r v i e w 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y I D   i n t 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' P a g e D i r e c t o r y ' , @ P a g e D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ9hncS_MR  @ P a g e D i r e c t o r y I D   _[^v  S u b D i r e c t o r y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ S u b D i r e c t o r y I D   I N T 
 
 S E L E C T   @ S u b D i r e c t o r y I D = S u b D i r e c t o r y I D   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ I D ] = @ P a g e D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR  S u b D i r e c t o r y I D   Nv@b	g  P a g e D i r e c t o r y   -NSv  O v e r v i e w   ^\'`Sc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   O v e r v i e w = 0   W H E R E   S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   A N D   O v e r v i e w = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR  S u b D i r e c t o r y I D   Nv@b	g  P a g e D i r e c t o r y   ͑ec^9hncSHQv  S e r i a l 	N2  _Y
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r s o r I D   I N T 
 
 D E C L A R E   @ C u r s o r S e r i a l   I N T 
 
 D E C L A R E   @ N e w S e r i a l   I N T 
 
 S E T   @ N e w S e r i a l = 2 
 
 
 
 D E C L A R E   P a g e D i r e c t o r y C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   O R D E R   B Y   S e r i a l 
 
 	 
 
 O P E N   P a g e D i r e c t o r y C u r s o r 
 
 F E T C H   N E X T   F R O M   P a g e D i r e c t o r y C u r s o r     I N T O   @ C u r s o r I D , @ C u r s o r S e r i a l 
 
 
 
 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 B E G I N 
 
 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ C u r s o r I D 
 
 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 F E T C H   N E X T   F R O M   P a g e D i r e c t o r y C u r s o r     I N T O   @ C u r s o r I D , @ C u r s o r S e r i a l 
 
 E N D 
 
 
 
 C L O S E   P a g e D i r e c t o r y C u r s o r 
 
 D E A L L O C A T E   P a g e D i r e c t o r y C u r s o r 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gT\S_MRc[  O v e r v i e w = t r u e   v  P a g e D i r e c t o r y   v  S e r i a l   n:N  1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = 1 ,   O v e r v i e w = 1     W H E R E   [ I D ] = @ P a g e D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Qeg NMN  1    _YNO$cczz
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ N e w S e r i a l = 1 
 
 
 
 D E C L A R E   P a g e D i r e c t o r y C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   O R D E R   B Y   S e r i a l 
 
 	 
 
 O P E N   P a g e D i r e c t o r y C u r s o r 
 
 F E T C H   N E X T   F R O M   P a g e D i r e c t o r y C u r s o r     I N T O   @ C u r s o r I D , @ C u r s o r S e r i a l 
 
 
 
 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 B E G I N 
 
 	 U P D A T E   d b o . P a g e D i r e c t o r y   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ C u r s o r I D 
 
 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 F E T C H   N E X T   F R O M   P a g e D i r e c t o r y C u r s o r     I N T O   @ C u r s o r I D , @ C u r s o r S e r i a l 
 
 E N D 
 
 
 
 C L O S E   P a g e D i r e c t o r y C u r s o r 
 
 D E A L L O C A T E   P a g e D i r e c t o r y C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9eNuvU_	
 
 - - = = f
N/T(uV:N  P a g e D i r e c t o r y M o d i f y   O(u,g  S P O[͑
Y	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 2 ,   @ P a g e D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y S e t O v e r v i e w ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y S e t O v e r v i e w         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y S e t O v e r v i e w ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y S e t O v e r v i e w ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \c[  S u b D i r e c t o r y   yvv  O v e r v i e w   ^\'`n:N  t r u e 
 
 - - = =  HQ\c[  S u b D i r e c t o r y   v@b	gDQ_yv  ( T N*N  M a i n D i r e c t o r y   N)   v  O v e r v i e w   ^\'`n:N  f a l s e 
 
 - - = = c@w\@b	gDQ_yvN  2    _Y	cSHQ!k^͑eMn  S e r i a l 
 
 - - = =  gT\c[  S u b D i r e c t o r y   v  S e r i a l   n:N  1   v^\vQ  O v e r v i e w   n:N  t r u e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 2 - 3 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y S e t O v e r v i e w 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S u b D i r e c t o r y I D   i n t 	 	 	 - - S_MR  S u b D i r e c t o r y   v  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' S u b D i r e c t o r y ' , @ S u b D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ9hncS_MR  @ S u b D i r e c t o r y I D   _[^v  M a i n D i r e c t o r y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ M a i n D i r e c t o r y I D   I N T 
 
 S E L E C T   @ M a i n D i r e c t o r y I D = M a i n D i r e c t o r y I D   F R O M   d b o . S u b D i r e c t o r y   W H E R E   [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR  M a i n D i r e c t o r y I D   Nv@b	g  S u b D i r e c t o r y   -NSv  O v e r v i e w   ^\'`Sc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . S u b D i r e c t o r y   S E T   O v e r v i e w = 0   W H E R E   M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   A N D   O v e r v i e w = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR  M a i n D i r e c t o r y I D   Nv@b	g  S u b D i r e c t o r y   ͑ec^9hncSHQv  S e r i a l 	N2    _Y
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r s o r I D   I N T 
 
 D E C L A R E   @ C u r s o r S e r i a l   I N T 
 
 D E C L A R E   @ N e w S e r i a l   I N T 
 
 S E T   @ N e w S e r i a l = 2 
 
 
 
 D E C L A R E   S u b D i r e c t o r y C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . S u b D i r e c t o r y   W H E R E   M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   O R D E R   B Y   S e r i a l 
 
 	 
 
 O P E N   S u b D i r e c t o r y C u r s o r 
 
 F E T C H   N E X T   F R O M   S u b D i r e c t o r y C u r s o r     I N T O   @ C u r s o r I D , @ C u r s o r S e r i a l 
 
 
 
 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 B E G I N 
 
 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ C u r s o r I D 
 
 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 F E T C H   N E X T   F R O M   S u b D i r e c t o r y C u r s o r     I N T O   @ C u r s o r I D , @ C u r s o r S e r i a l 
 
 E N D 
 
 
 
 C L O S E   S u b D i r e c t o r y C u r s o r 
 
 D E A L L O C A T E   S u b D i r e c t o r y C u r s o r 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gT\S_MRc[  O v e r v i e w = t r u e   v  S u b D i r e c t o r y   v  S e r i a l   n:N  1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = 1 ,   O v e r v i e w = 1     W H E R E   [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Qeg NMN  1    _YNO$cczz
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ N e w S e r i a l = 1 
 
 
 
 D E C L A R E   S u b D i r e c t o r y C u r s o r   C U R S O R   F O R   S E L E C T   [ I D ] ,   S e r i a l   F R O M   d b o . S u b D i r e c t o r y   W H E R E   M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   O R D E R   B Y   S e r i a l 
 
 	 
 
 O P E N   S u b D i r e c t o r y C u r s o r 
 
 F E T C H   N E X T   F R O M   S u b D i r e c t o r y C u r s o r     I N T O   @ C u r s o r I D , @ C u r s o r S e r i a l 
 
 
 
 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 B E G I N 
 
 	 U P D A T E   d b o . S u b D i r e c t o r y   S E T   S e r i a l = @ N e w S e r i a l   W H E R E   [ I D ] = @ C u r s o r I D 
 
 	 S E T   @ N e w S e r i a l = @ N e w S e r i a l + 1 
 
 	 F E T C H   N E X T   F R O M   S u b D i r e c t o r y C u r s o r     I N T O   @ C u r s o r I D , @ C u r s o r S e r i a l 
 
 E N D 
 
 
 
 C L O S E   S u b D i r e c t o r y C u r s o r 
 
 D E A L L O C A T E   S u b D i r e c t o r y C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9eNP[vU_	
 
 - - = = f
N/T(uV:N  S u b D i r e c t o r y M o d i f y   O(u,g  S P ُ7hO[͑
YU_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 1 ,   @ S u b D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y S e t O v e r v i e w ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M e n u M a i n D i r e c t o r y S u b D i r e c t o r y P a g e D i r e c t o r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M e n u M a i n D i r e c t o r y S u b D i r e c t o r y P a g e D i r e c t o r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M e n u M a i n D i r e c t o r y S u b D i r e c t o r y P a g e D i r e c t o r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~[S_MR  A S P X   zv(u7bԏV(u7bCgPVQv@b	g  M a i n D i r e c t o r y ,   S u b D i r e c t o r y ,   P a g e D i r e c t o r y   U_NO(W  A S P X   zg ܃US|~
 
 - - = = ԏVv  M a i n D i r e c t o r y ,   S u b D i r e c t o r y ,   P a g e D i r e c t o r y   \eQ  D a t a S e t   v^:Nُ	N*Nh^z~TsQ|
 
 - - = = labN 9hnc  O p t i o n . M a i n M e n u A l i g n   Q[Q  M a i n D i r e c t o r y   U_vePO(uck^؏/fP^  V:N  a s p x     zg [*vePYgS[PO_w>f:y!k^SS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M e n u M a i n D i r e c t o r y S u b D i r e c t o r y P a g e D i r e c t o r y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegv(u7b
T  bNO(u  T a b l e   ~(u7b|~	
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 - - S_MReS
 
 
 
 
 
 A S   
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQԏV  O p t i o n   -N  M a i n M e n u A l i g n   v<PTb9hncُ*N<P9eS  M a i n D i r e c t o r y   	Sev  O r d e r   b y   agN
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ M a i n M e n u A l i g n   N V A R C H A R ( 1 0 ) 
 
 S E L E C T   @ M a i n M e n u A l i g n = C O N V E R T ( N V A R C H A R ( 1 0 ) , I S N U L L ( o p t . [ V a l u e ] , N ' 1 ' ) )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' M a i n M e n u A l i g n ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 - - RS_MR(u7b/f  A d m i n   E d i t o r     ؏/fnf(u7b$Ny`b_0MRԏVhQ萰U_TԏV&{TCgPvU_
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
     
 
 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1   
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ԏVhQ  M a i n D i r e c t o r y 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 
 
 	 	 N ' M a i n D i r e c t o r y '   A S   K n o w l e d g e D i r e c t o r y , 
 
 	 	 m d . [ I D ]   A S   [ I D ] , 
 
 	 	 m d . S e r i a l   A S   S e r i a l , 
 
 	 	 m d . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 I S N U L L ( m d . N e w W i n d o w , 0 )   A S   N e w W i n d o w , 
 
 	 	 I S N U L L ( m d . [ S y s t e m ] , 0 )   A S   [ S y s t e m ] , 
 
 	 	 I S N U L L ( m d c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( m d c . H i d d e n I n N a v i g a t i o n O n l y , 0 )   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 - - C A S E   W H E N   E X I S T S   ( S E L E C T   i n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   i n o w c   W H E R E   i n o w c . K n o w l e d g e I D   I N   ( S e l e c t   i n o w . [ I D ]   F r o m   d b o . K n o w l e d g e   i n o w   W h e r e   i n o w . P a g e D i r e c t o r y I D   I n   ( s e l e c t   i p d . [ I D ]   f r o m   d b o . P a g e D i r e c t o r y   i p d   w h e r e   i p d . S u b D i r e c t o r y I D   i n   ( s e l e c t   i s d . [ I D ]   f r o m   d b o . S u b D i r e c t o r y   i s d   w h e r e   i s d . M a i n D i r e c t o r y I D = m d . [ I D ] ) ) )   A N D   i n o w c . C u l t u r e = m d c . C u l t u r e   A N D   L E N ( L T R I M ( R T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , i n o w c . C o n t e n t ) ) ) ) > 0 )   T H E N   N ' t r u e '   E L S E   N ' f a l s e '   E N D     A S   C o n t e n t E x i s t s , 
 
 	 	 m d . I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 m d . A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 m d . B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 	 m d . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 
 
 	 	 m d . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , m d . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 m d c . T i t l e   A S   T i t l e , 
 
 	 	 m d c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 
 
 	 	 m d c . U r l   A S   U r l , 
 
 	 	 I S N U L L ( m d c . T h i s I s L i n k , 0 )   A S   T h i s I s L i n k , 
 
 
 
 	 	 m d c . C u l t u r e   A S   C u l t u r e 
 
 
 
 	 F R O M   d b o . M a i n D i r e c t o r y   m d 
 
 	 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d c . M a i n D i r e c t o r y I D = m d . [ I D ]     A N D   m d c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 O R D E R   B Y     C A S E   @ M a i n M e n u A l i g n   W H E N   N ' 1 '   T H E N     S e r i a l     E L S E     - S e r i a l   E N D   A S C 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ޏTV:NU_-N	g  N T E X T   y@bNO(u  U N I O N   A L L   V:N  U N I O N   /f  D I S T I N C T   U N I O N 
NT  N T E X T     ޏ(u	    
 
 	 - - = = YgS_MR(u7b/f  A d m i n   E d i t o r RԏVhQ    
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 
 
 	 	 N ' S u b D i r e c t o r y '   A S   K n o w l e d g e D i r e c t o r y , 
 
 	 	 s d . [ I D ]   A S   [ I D ] , 
 
 	 	 s d . M a i n D i r e c t o r y I D   A S   M a i n D i r e c t o r y I D , 
 
 	 	 s d . S e r i a l   A S   S e r i a l , 
 
 	 	 s d . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 I S N U L L ( s d . N e w W i n d o w , 0 )   A S   N e w W i n d o w , 
 
 	 	 I S N U L L ( s d c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( s d c . H i d d e n I n N a v i g a t i o n O n l y , 0 )   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 - - C A S E   W H E N   E X I S T S   ( S E L E C T   i n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   i n o w c   W H E R E   i n o w c . K n o w l e d g e I D   I N   ( S e l e c t   i n o w . [ I D ]   F r o m   d b o . K n o w l e d g e   i n o w   W h e r e   i n o w . P a g e D i r e c t o r y I D   I n   ( s e l e c t   i p d . [ I D ]   f r o m   d b o . P a g e D i r e c t o r y   i p d   w h e r e   i p d . S u b D i r e c t o r y I D = s d . [ I D ] ) )   A N D   i n o w c . C u l t u r e = s d c . C u l t u r e   A N D   L E N ( L T R I M ( R T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , i n o w c . C o n t e n t ) ) ) ) > 0 )   T H E N   N ' t r u e '   E L S E   N ' f a l s e '   E N D   A S   C o n t e n t E x i s t s , 
 
 	 	 I S N U L L ( s d . O v e r v i e w , 0 )   A S   O v e r v i e w , 
 
 	 	 I S N U L L ( s d . W i z a r d , 0 )   A S   W i z a r d , 
 
 
 
 
 	 	 s d . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , s d . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 s d c . T i t l e   A S   T i t l e , 
 
 	 	 s d c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 	 s d c . W i z a r d P r e v i o u s T i t l e   A S   W i z a r d P r e v i o u s T i t l e , 
 
 	 	 s d c . W i z a r d N e x t T i t l e   A S   W i z a r d N e x t T i t l e , 
 
 
 
 	 	 s d c . U r l   A S   U r l , 
 
 	 	 I S N U L L ( s d c . T h i s I s L i n k , 0 )   A S   T h i s I s L i n k , 
 
 
 
 	 	 s d c . C u l t u r e   A S   C u l t u r e 
 
 
 
 	 F R O M   d b o . S u b D i r e c t o r y   s d 
 
 	 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d c . S u b D i r e c t o r y I D = s d . [ I D ]     A N D   s d c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 O R D E R   B Y   S e r i a l 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ԏVhQ  P a g e D i r e c t o r y   U_
 
 	 - - = = YgS_MR(u7b/f  A d m i n   E d i t o r RԏVhQ
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 
 
 	 	 N ' P a g e D i r e c t o r y '   A S   K n o w l e d g e D i r e c t o r y , 
 
 	 	 p d . [ I D ]   A S   [ I D ] , 
 
 	 	 p d . S u b D i r e c t o r y I D   A S   S u b D i r e c t o r y I D , 
 
 	 	 p d . S e r i a l   A S   S e r i a l , 
 
 	 	 p d . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 p d . P a g e S i z e   A S   P a g e S i z e , 
 
 	 	 I S N U L L ( p d . N e w W i n d o w , 0 )   A S   N e w W i n d o w , 
 
 	 	 I S N U L L ( p d . O v e r v i e w , 0 )   A S   O v e r v i e w , 
 
 	 	 I S N U L L ( p d . F a s t A c c e s s , 0 )   A S   F a s t A c c e s s , 
 
 	 	 I S N U L L ( p d . H o m e , 0 )   A S   H o m e , 
 
 	 	 I S N U L L ( p d c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( p d c . H i d d e n I n N a v i g a t i o n O n l y , 0 )   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 - - C A S E   W H E N   E X I S T S   ( S E L E C T   i n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   i n o w c   W H E R E   i n o w c . K n o w l e d g e I D   I N   ( S e l e c t   i n o w . [ I D ]   F r o m   d b o . K n o w l e d g e   i n o w   W h e r e   i n o w . P a g e D i r e c t o r y I D = p d . [ I D ] )   A N D   i n o w c . C u l t u r e = p d c . C u l t u r e   A N D   L E N ( L T R I M ( R T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , i n o w c . C o n t e n t ) ) ) ) > 0 )   T H E N   N ' t r u e '   E L S E   N ' f a l s e '   E N D   A S   C o n t e n t E x i s t s , 
 
 
 
 	 	 I S N U L L ( p d . R i g h t I n d e n t , 0 )   A S   R i g h t I n d e n t , 
 
 
 
 	 	 I S N U L L ( p d . j Q u e r y , 0 )   A S   j Q u e r y , 
 
 
 
 	 	 I S N U L L ( p d . L o g o H i d e , 0 )   A S   L o g o H i d e , 
 
 	 	 I S N U L L ( p d . M a i n M e n u H i d e , 0 )   A S   M a i n M e n u H i d e , 
 
 	 	 I S N U L L ( p d . B a n n e r H i d e , 0 )   A S   B a n n e r H i d e , 
 
 	 	 I S N U L L ( p d . B r e a d c r u m b H i d e , 0 )   A S   B r e a d c r u m b H i d e , 
 
 	 	 I S N U L L ( p d . P a g e M e n u H i d e , 0 )   A S   P a g e M e n u H i d e , 
 
 	 	 I S N U L L ( p d . P a g e B a r H i d e , 0 )   A S   P a g e B a r H i d e , 
 
 	 	 I S N U L L ( p d . C o p y r i g h t H i d e , 0 )   A S   C o p y r i g h t H i d e , 
 
 
 
 	 	 p d . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , p d . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 p d c . S e o T i t l e   A S   S e o T i t l e , 
 
 	 	 p d c . S e o D e s c r i p t i o n   A S   S e o D e s c r i p t i o n , 
 
 	 	 p d c . S e o K e y w o r d s   A S   S e o K e y w o r d s , 
 
 
 	 	 p d c . T i t l e   A S   T i t l e , 
 
 	 	 p d c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 
 
 	 	 p d c . U r l   A S   U r l , 
 
 	 	 I S N U L L ( p d c . T h i s I s L i n k , 0 )   A S   T h i s I s L i n k , 
 
 
 
 	 	 p d c . C u l t u r e   A S   C u l t u r e 
 
 
 
 	 F R O M   d b o . P a g e D i r e c t o r y   p d 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   O N   p d c . P a g e D i r e c t o r y I D = p d . [ I D ]     A N D   p d c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 O R D E R   B Y   S e r i a l 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 
 
 	 D E C L A R E   @ T e m p T a b l e   T A B L E   
 
 	 ( 
 
 	 	 M a i n D i r e c t o r y I D   i n t , 
 
 	 	 S u b D i r e c t o r y I D   i n t , 
 
 	 	 P a g e D i r e c t o r y I D   i n t 
 
 	 ) 
 
 
 
 	 I N S E R T   I N T O   @ T e m p T a b l e   S E L E C T   n o w p . M a i n D i r e c t o r y I D ,   n o w p . S u b D i r e c t o r y I D ,   n o w p . P a g e D i r e c t o r y I D   F R O M   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   W h e r e   R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ԏV&{TCgPv  M a i n D i r e c t o r y   U_    Tb  W h e r e   agNva`1 .   D e d i c a t e d T o   /}yweg:NzzOOQ  , , , , ,   ُ7hv/}y~g	D e d i c a t e d T o   /}yweg&{TCgPS_MR  p d   Nl	g  n o w   1\/f  I S   N U L L   v1ueg		
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T   
 
 
 
 	 	 N ' M a i n D i r e c t o r y '   A S   K n o w l e d g e D i r e c t o r y , 
 
 	 	 m d . [ I D ]   A S   [ I D ] , 
 
 	 	 m d . S e r i a l   A S   S e r i a l , 
 
 	 	 m d . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 I S N U L L ( m d . N e w W i n d o w , 0 )   A S   N e w W i n d o w , 
 
 	 	 I S N U L L ( m d . [ S y s t e m ] , 0 )   A S   [ S y s t e m ] , 
 
 	 	 I S N U L L ( m d c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( m d c . H i d d e n I n N a v i g a t i o n O n l y , 0 )   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 - - C A S E   W H E N   E X I S T S   ( S E L E C T   i n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   i n o w c   W H E R E   i n o w c . K n o w l e d g e I D   I N   ( S e l e c t   i n o w . [ I D ]   F r o m   d b o . K n o w l e d g e   i n o w   W h e r e   i n o w . P a g e D i r e c t o r y I D   I n   ( s e l e c t   i p d . [ I D ]   f r o m   d b o . P a g e D i r e c t o r y   i p d   w h e r e   i p d . S u b D i r e c t o r y I D   i n   ( s e l e c t   i s d . [ I D ]   f r o m   d b o . S u b D i r e c t o r y   i s d   w h e r e   i s d . M a i n D i r e c t o r y I D = m d . [ I D ] ) ) )   A N D   i n o w c . C u l t u r e = m d c . C u l t u r e   A N D   L E N ( L T R I M ( R T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , i n o w c . C o n t e n t ) ) ) ) > 0 )   T H E N   N ' t r u e '   E L S E   N ' f a l s e '   E N D     A S   C o n t e n t E x i s t s , 
 
 	 	 m d . I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 m d . A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 m d . B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 	 m d . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 
 
 	 	 m d . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , m d . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 m d c . T i t l e   A S   T i t l e , 
 
 	 	 m d c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 
 	 	 m d c . U r l   A S   U r l , 
 
 	 	 I S N U L L ( m d c . T h i s I s L i n k , 0 )   A S   T h i s I s L i n k , 
 
 
 
 	 	 m d c . C u l t u r e   A S   C u l t u r e 
 
 
 
 	 F R O M   d b o . M a i n D i r e c t o r y   m d 
 
 	 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d c . M a i n D i r e c t o r y I D = m d . [ I D ]     A N D   m d c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 - - W H E R E     E X I S T S   ( S e l e c t   n o w p . K n o w l e d g e I D   F r o m   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   W h e r e   n o w p . M a i n D i r e c t o r y I D = m d . [ I D ]   A n d   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 ) ) 
 
 	 - - W H E R E     m d . [ I D ]   I N   ( S e l e c t   n o w p . M a i n D i r e c t o r y I D   F r o m   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   W h e r e   R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 ) 
 
 	 W H E R E   m d . [ I D ]   I N   ( S e l e c t   t t . M a i n D i r e c t o r y I D   F r o m   @ T e m p T a b l e   t t ) 
 
 
 
 	 - - O R D E R   B Y   S e r i a l 
 
 	 O R D E R   B Y     C A S E   @ M a i n M e n u A l i g n   W H E N   N ' 1 '   T H E N     S e r i a l     E L S E     - S e r i a l   E N D   A S C 
 
 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ԏV&{TCgPv  S u b D i r e c t o r y   U_    Tb  W h e r e   agNva`1 .   D e d i c a t e d T o   /}yweg:NzzOOQ  , , , , ,   ُ7hv/}y~g	D e d i c a t e d T o   /}yweg&{TCgPS_MR  p d   Nl	g  n o w   1\/f  I S   N U L L   v1ueg		
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T   
 
 
 
 	 	 N ' S u b D i r e c t o r y '   A S   K n o w l e d g e D i r e c t o r y , 
 
 	 	 s d . [ I D ]   A S   [ I D ] , 
 
 	 	 s d . M a i n D i r e c t o r y I D   A S   M a i n D i r e c t o r y I D , 
 
 	 	 s d . S e r i a l   A S   S e r i a l , 
 
 	 	 s d . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 I S N U L L ( s d . N e w W i n d o w , 0 )   A S   N e w W i n d o w , 
 
 	 	 I S N U L L ( s d c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( s d c . H i d d e n I n N a v i g a t i o n O n l y , 0 )   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 - - C A S E   W H E N   E X I S T S   ( S E L E C T   i n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   i n o w c   W H E R E   i n o w c . K n o w l e d g e I D   I N   ( S e l e c t   i n o w . [ I D ]   F r o m   d b o . K n o w l e d g e   i n o w   W h e r e   i n o w . P a g e D i r e c t o r y I D   I n   ( s e l e c t   i p d . [ I D ]   f r o m   d b o . P a g e D i r e c t o r y   i p d   w h e r e   i p d . S u b D i r e c t o r y I D = s d . [ I D ] ) )   A N D   i n o w c . C u l t u r e = s d c . C u l t u r e   A N D   L E N ( L T R I M ( R T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , i n o w c . C o n t e n t ) ) ) ) > 0 )   T H E N   N ' t r u e '   E L S E   N ' f a l s e '   E N D   A S   C o n t e n t E x i s t s , 
 
 	 	 I S N U L L ( s d . O v e r v i e w , 0 )   A S   O v e r v i e w , 
 
 	 	 I S N U L L ( s d . W i z a r d , 0 )   A S   W i z a r d , 
 
 
 
 	 	 s d . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , s d . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 s d c . T i t l e   A S   T i t l e , 
 
 	 	 s d c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 	 s d c . W i z a r d P r e v i o u s T i t l e   A S   W i z a r d P r e v i o u s T i t l e , 
 
 	 	 s d c . W i z a r d N e x t T i t l e   A S   W i z a r d N e x t T i t l e , 
 
 
 
 	 	 s d c . U r l   A S   U r l , 
 
 	 	 I S N U L L ( s d c . T h i s I s L i n k , 0 )   A S   T h i s I s L i n k , 
 
 
 
 	 	 s d c . C u l t u r e   A S   C u l t u r e 
 
 
 
 	 F R O M   d b o . S u b D i r e c t o r y   s d 
 
 	 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d c . S u b D i r e c t o r y I D = s d . [ I D ]     A N D   s d c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 - - W H E R E   E X I S T S   ( S e l e c t   n o w p . K n o w l e d g e I D   F r o m   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   W h e r e   n o w p . S u b D i r e c t o r y I D = s d . [ I D ]   A n d   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 ) ) 
 
 	 - - W H E R E   s d . [ I D ]   I N     ( S e l e c t   n o w p . S u b D i r e c t o r y I D   F r o m   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   W h e r e   R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 ) 
 
 	 W H E R E   s d . [ I D ]   I N   ( S e l e c t   t t . S u b D i r e c t o r y I D   F r o m   @ T e m p T a b l e   t t ) 
 
 
 
 	 O R D E R   B Y   S e r i a l 
 
 
 
 
 
 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ԏV&{TCgPv  P a g e D i r e c t o r y   U_    Tb  W h e r e   agNva`1 .   D e d i c a t e d T o   /}yweg:NzzOOQ  , , , , ,   ُ7hv/}y~g	D e d i c a t e d T o   /}yweg&{TCgPS_MR  p d   Nl	g  n o w   1\/f  I S   N U L L   v1ueg		
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 
 
 	 	 N ' P a g e D i r e c t o r y '   A S   K n o w l e d g e D i r e c t o r y , 
 
 	 	 p d . [ I D ]   A S   [ I D ] , 
 
 	 	 p d . S u b D i r e c t o r y I D   A S   S u b D i r e c t o r y I D , 
 
 	 	 p d . S e r i a l   A S   S e r i a l , 
 
 	 	 p d . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 p d . P a g e S i z e   A S   P a g e S i z e , 
 
 	 	 I S N U L L ( p d . N e w W i n d o w , 0 )   A S   N e w W i n d o w , 
 
 	 	 I S N U L L ( p d . O v e r v i e w , 0 )   A S   O v e r v i e w , 
 
 	 	 I S N U L L ( p d . F a s t A c c e s s , 0 )   A S   F a s t A c c e s s , 
 
 	 	 I S N U L L ( p d . H o m e , 0 )   A S   H o m e , 
 
 	 	 I S N U L L ( p d c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 I S N U L L ( p d c . H i d d e n I n N a v i g a t i o n O n l y , 0 )   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 - - C A S E   W H E N   E X I S T S   ( S E L E C T   i n o w c . [ I D ]   F R O M   d b o . K n o w l e d g e C o n t e n t   i n o w c   W H E R E   i n o w c . K n o w l e d g e I D   I N   ( S e l e c t   i n o w . [ I D ]   F r o m   d b o . K n o w l e d g e   i n o w   W h e r e   i n o w . P a g e D i r e c t o r y I D = p d . [ I D ] )   A N D   i n o w c . C u l t u r e = p d c . C u l t u r e   A N D   L E N ( L T R I M ( R T R I M ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , i n o w c . C o n t e n t ) ) ) ) > 0 )   T H E N   N ' t r u e '   E L S E   N ' f a l s e '   E N D   A S   C o n t e n t E x i s t s , 
 
 	 
 
 	 	 I S N U L L ( p d . R i g h t I n d e n t , 0 )   A S   R i g h t I n d e n t , 
 
 	 
 
 	 	 I S N U L L ( p d . j Q u e r y , 0 )   A S   j Q u e r y , 
 
 
 
 	 	 I S N U L L ( p d . L o g o H i d e , 0 )   A S   L o g o H i d e , 
 
 	 	 I S N U L L ( p d . M a i n M e n u H i d e , 0 )   A S   M a i n M e n u H i d e , 
 
 	 	 I S N U L L ( p d . B a n n e r H i d e , 0 )   A S   B a n n e r H i d e , 
 
 	 	 I S N U L L ( p d . B r e a d c r u m b H i d e , 0 )   A S   B r e a d c r u m b H i d e , 
 
 
 	 	 I S N U L L ( p d . P a g e M e n u H i d e , 0 )   A S   P a g e M e n u H i d e , 
 
 	 	 I S N U L L ( p d . P a g e B a r H i d e , 0 )   A S   P a g e B a r H i d e , 
 
 	 	 I S N U L L ( p d . C o p y r i g h t H i d e , 0 )   A S   C o p y r i g h t H i d e , 
 
 
 
 	 	 p d . E d i t o r   A S   E d i t o r , 
 
 	 	 d b o . U D F _ E d i t o r D e d i c a t e d T o ( @ U s e r , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , p d . E d i t o r ) )   A S   E d i t o r P e r m i s s i o n , 
 
 
 
 	 	 p d c . S e o T i t l e   A S   S e o T i t l e , 
 
 	 	 p d c . S e o D e s c r i p t i o n   A S   S e o D e s c r i p t i o n , 
 
 	 	 p d c . S e o K e y w o r d s   A S   S e o K e y w o r d s , 
 
 	 	 p d c . T i t l e   A S   T i t l e , 
 
 	 	 p d c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 
 
 	 	 p d c . U r l   A S   U r l , 
 
 	 	 I S N U L L ( p d c . T h i s I s L i n k , 0 )   A S   T h i s I s L i n k , 
 
 
 
 	 	 p d c . C u l t u r e   A S   C u l t u r e 
 
 
 
 	 F R O M   d b o . P a g e D i r e c t o r y   p d 
 
 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   O N   p d c . P a g e D i r e c t o r y I D = p d . [ I D ]     A N D   p d c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 - - W H E R E   E X I S T S   ( S e l e c t   n o w p . K n o w l e d g e I D   F r o m   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   W h e r e   n o w p . P a g e D i r e c t o r y I D = p d . [ I D ]   A n d   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 ) ) 
 
 	 - - W H E R E   p d . [ I D ]   I N     ( S e l e c t   n o w p . P a g e D i r e c t o r y I D   F r o m   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   W h e r e   R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 ) 
 
 	 W H E R E   p d . [ I D ]   I N   ( S e l e c t   t t . P a g e D i r e c t o r y I D   F r o m   @ T e m p T a b l e   t t ) 
 
 
 
 	 O R D E R   B Y   S e r i a l 
 
 
 
 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 - - ԏV N*NrzvhU s e r C h i e f E d i t o r U s e r C o l u m n E d i t o r 	Q  U s e r C h i e f E d i t o r ,   U s e r C o l u m n E d i t o r   $N*N^\'`O  M e n u . c s   m9
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 S E L E C T   
 
 
 
 	 d b o . U D F _ U s e r C h i e f E d i t o r ( @ U s e r )   A S   U s e r C h i e f E d i t o r , 
 
 	 d b o . U D F _ U s e r C o l u m n E d i t o r ( @ U s e r )   A S   U s e r C o l u m n E d i t o r 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M e n u M a i n D i r e c t o r y S u b D i r e c t o r y P a g e D i r e c t o r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M e n u C o m m u n i t y F o r u m         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M e n u C o m m u n i t y F o r u m ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M e n u C o m m u n i t y F o r u m ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~[S_MR  A S P X   zv(u7bԏV(u7bCgPVQv@b	g  C o m m u n i t y ,   F o r u m   U_NO(W  A S P X   zg ܃US|~
 
 - - = = ԏVv  C o m m u n i t y ,   F o r u m   \eQ  D a t a S e t   v^:Nُ2 *Nh^z~TsQ|
 
 - - = = bN 9hnc  O p t i o n . M a i n M e n u A l i g n   
NT<PO(u
NTvc^e_ԏV  C o m m u n i t y   U_  l1uN  S P   O(uN  U n i o n   A l l   Vdk  O r d e r   B y   ̑elO(uagN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M e n u C o m m u n i t y F o r u m 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegv(u7b
T  bNO(u  T a b l e   ~(u7b|~	
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 - - S_MReS
 
 
 
 A S 
 
     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQԏV  O p t i o n   -N  M a i n M e n u A l i g n   v<PTb9hncُ*N<P9eS  M a i n D i r e c t o r y   	Sev  O r d e r   b y   agN
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ M a i n M e n u A l i g n   N V A R C H A R ( 1 0 ) 
 
 S E L E C T   @ M a i n M e n u A l i g n = C O N V E R T ( N V A R C H A R ( 1 0 ) , I S N U L L ( o p t . [ V a l u e ] , N ' 1 ' ) )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' M a i n M e n u A l i g n ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 - - ԏVc[(u7bCgPQv  C o m m u n i t y   Rh  
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc;N܃US]S[P[R
NT  O r d e r   B y   ۏL  NN$Nk,g/U Nv:S+R/f  O r d e r   B y   
NT	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ M a i n M e n u A l i g n = N ' 1 ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = (W;N܃US[:N][PeO r d e r   B y   S e r i a l   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T 
 
 	 	 
 
 	 	 	 N ' C o m m u n i t y '   A S   C o m m u n i t y D i r e c t o r y , 
 
 	 	 	 c o . [ I D ]   A S   [ I D ] , 
 
 	 	 	 c o . S e r i a l   A S   S e r i a l , 
 
 	 	 	 c o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 	 c o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 	 	 I S N U L L ( c o . [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 	 	 I S N U L L ( c o c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 c o . I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 	 	 c o . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 	 	 	 c o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 	 	 c o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 	 	 c o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 	 	 	 c o c . C u l t u r e   A S   C u l t u r e , 
 
 	 	 	 c o c . T i t l e   A s   T i t l e , 
 
 	 	 	 c o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 	 	 d b o . U D F _ G e t F o r u m I D F r o m C o m m u n i t y I D ( @ U s e r , c o . [ I D ] )   A S   F i r s t F o r u m I D 
 
 	 	 
 
 	 	 F R O M   d b o . C o m m u n i t y   c o 
 
 	 	 L E F T   J O I N   d b o . C o m m u n i t y C o n t e n t   c o c   O N   c o c . C o m m u n i t y I D = c o . [ I D ]   A N D   c o c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 W H E R E   E X I S T S   ( S e l e c t   f o . [ I D ]   F r o m   d b o . F o r u m   f o   W h e r e   d b o . U D F _ F o r u m R e a d a b l e ( @ U s e r , f o . [ I D ] ) = 1   A n d   f o . C o m m u n i t y I D = c o . [ I D ] ) 	 	 
 
 
 
 	 	 O R D E R   B Y   c o . S e r i a l   A S C 
 
 
 
 	 	 / * 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQԏV  P u b l i c   F o r u m   @b(Wv  C o m m u n i t y   NS_MR(u7b
N:N  A d m i n 	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   T O P   1 0 0   P E R C E N T 
 
 	 	 
 
 	 	 	 N ' C o m m u n i t y '   A S   C o m m u n i t y D i r e c t o r y , 
 
 	 	 	 c o . [ I D ]   A S   [ I D ] , 
 
 	 	 	 c o . S e r i a l   A S   S e r i a l , 
 
 	 	 	 c o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 	 c o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 	 	 I S N U L L ( c o . [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 	 	 I S N U L L ( c o c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 c o . I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 	 	 c o . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 	 	 	 c o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 	 	 c o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 	 	 c o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 	 	 	 c o c . C u l t u r e   A S   C u l t u r e , 
 
 	 	 	 c o c . T i t l e   A s   T i t l e , 
 
 	 	 	 c o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 	 	 d b o . U D F _ G e t F o r u m I D F r o m C o m m u n i t y I D ( @ U s e r , c o . [ I D ] )   A S   F i r s t F o r u m I D 
 
 	 	 
 
 	 	 F R O M   d b o . C o m m u n i t y   c o 
 
 	 	 L E F T   J O I N   d b o . C o m m u n i t y C o n t e n t   c o c   O N   c o c . C o m m u n i t y I D = c o . [ I D ]   A N D   c o c . C u l t u r e = @ C u l t u r e 
 
 	 	 
 
 	 	 W H E R E 
 
 	 	   
 
 	 	 	 ( 
 
 	 	 
 
 	 	 	 	 ( c o . [ I D ]   I N   ( S e l e c t   f o . C o m m u n i t y I D   F r o m   d b o . F o r u m   f o   W H E R E   f o . [ P u b l i c ] = N ' t r u e ' ) )   
 
 	 	 
 
 	 	 	 	 O R   
 
 	 	 
 
 	 	 	 	 ( c o . [ I D ]   I N 
 
 	 	 	 	 	 ( 
 
 	 	 	 	 	 	 S e l e c t   f o . C o m m u n i t y I D   
 
 	 	 	 	 	 	 F r o m   d b o . F o r u m   f o   
 
 	 	 	 	 	 	 L e f t   J o i n   d b o . U s e r F o r u m s   u f   O N   u f . [ F o r u m ] = f o . [ I D ]   
 
 	 	 	 	 	 	 W h e r e   u f . [ U s e r ] = @ U s e r   A n d   ( u f . R e a d E n a b l e d = 1   o r   u f . T o p i c W r i t e E n a b l e d = 1   o r   u f . F o l l o w U p W r i t e E n a b l e d = 1 )   A n d   d b o . U D F _ U s e r C o m m u n i t y ( @ U s e r ) = 1   A n d   f o . [ P u b l i c ] < > N ' t r u e ' 
 
 	 	 	 	 	 ) 
 
 	 	 	 	 ) 
 
 	 	 	 )   
 
 	 	 	 
 
 	 	 	 A N D   
 
 	 	 
 
 	 	 	 d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 
 
 	 	 
 
 	 	 
 
 	 	 
 
 	 	 U N I O N   A L L 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = YgS_MR(u7b/f  A d m i n   RԏVhQ
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   T O P   1 0 0   P E R C E N T 
 
 	 	 
 
 	 	 	 N ' C o m m u n i t y '   A S   C o m m u n i t y D i r e c t o r y , 
 
 	 	 	 c o . [ I D ]   A S   [ I D ] , 
 
 	 	 	 c o . S e r i a l   A S   S e r i a l , 
 
 	 	 	 c o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 	 c o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 	 	 I S N U L L ( c o . [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 	 	 I S N U L L ( c o c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 c o . I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 	 	 c o . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 	 	 	 c o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 	 	 c o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 	 	 c o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 	 	 	 c o c . C u l t u r e   A S   C u l t u r e , 
 
 	 	 	 c o c . T i t l e   A s   T i t l e , 
 
 	 	 	 c o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 	 	 d b o . U D F _ G e t F o r u m I D F r o m C o m m u n i t y I D ( @ U s e r , c o . [ I D ] )   A S   F i r s t F o r u m I D 
 
 	 	 
 
 	 	 F R O M   d b o . C o m m u n i t y   c o 
 
 	 	 L E F T   J O I N   d b o . C o m m u n i t y C o n t e n t   c o c   O N   c o c . C o m m u n i t y I D = c o . [ I D ]   A N D   c o c . C u l t u r e = @ C u l t u r e 
 
 	 	 W H E R E   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O(u  U N I O N   vePS	g gT N*N  U N I O N   SMbSNO(u  O R D E R   B Y 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 O R D E R   B Y   S e r i a l   A S C 
 
 	 	 * / 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = (W;N܃US[:NS[PeO r d e r   B y   S e r i a l   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T 
 
 	 	 
 
 	 	 	 N ' C o m m u n i t y '   A S   C o m m u n i t y D i r e c t o r y , 
 
 	 	 	 c o . [ I D ]   A S   [ I D ] , 
 
 	 	 	 c o . S e r i a l   A S   S e r i a l , 
 
 	 	 	 c o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 	 c o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 	 	 I S N U L L ( c o . [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 	 	 I S N U L L ( c o c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 c o . I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 	 	 c o . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 	 	 	 c o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 	 	 c o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 	 	 c o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 	 	 	 c o c . C u l t u r e   A S   C u l t u r e , 
 
 	 	 	 c o c . T i t l e   A s   T i t l e , 
 
 	 	 	 c o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 	 	 d b o . U D F _ G e t F o r u m I D F r o m C o m m u n i t y I D ( @ U s e r , c o . [ I D ] )   A S   F i r s t F o r u m I D 
 
 	 	 
 
 	 	 F R O M   d b o . C o m m u n i t y   c o 
 
 	 	 L E F T   J O I N   d b o . C o m m u n i t y C o n t e n t   c o c   O N   c o c . C o m m u n i t y I D = c o . [ I D ]   A N D   c o c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 W H E R E   E X I S T S   ( S e l e c t   f o . [ I D ]   F r o m   d b o . F o r u m   f o   W h e r e   d b o . U D F _ F o r u m R e a d a b l e ( @ U s e r , f o . [ I D ] ) = 1   A n d   f o . C o m m u n i t y I D = c o . [ I D ] ) 
 
 	 	 
 
 	 	 O R D E R   B Y   c o . S e r i a l   D E S C 
 
 
 
 	 	 / * 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQԏV  P u b l i c   F o r u m   @b(Wv  C o m m u n i t y   NS_MR(u7b
N:N  A d m i n 	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   T O P   1 0 0   P E R C E N T 
 
 	 	 
 
 	 	 	 N ' C o m m u n i t y '   A S   C o m m u n i t y D i r e c t o r y , 
 
 	 	 	 c o . [ I D ]   A S   [ I D ] , 
 
 	 	 	 c o . S e r i a l   A S   S e r i a l , 
 
 	 	 	 c o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 	 c o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 	 	 I S N U L L ( c o . [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 	 	 I S N U L L ( c o c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 c o . I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 	 	 c o . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 	 	 	 c o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 	 	 c o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 	 	 c o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 	 	 	 c o c . C u l t u r e   A S   C u l t u r e , 
 
 	 	 	 c o c . T i t l e   A s   T i t l e , 
 
 	 	 	 c o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 	 	 d b o . U D F _ G e t F o r u m I D F r o m C o m m u n i t y I D ( @ U s e r , c o . [ I D ] )   A S   F i r s t F o r u m I D 
 
 	 	 
 
 	 	 F R O M   d b o . C o m m u n i t y   c o 
 
 	 	 L E F T   J O I N   d b o . C o m m u n i t y C o n t e n t   c o c   O N   c o c . C o m m u n i t y I D = c o . [ I D ]   A N D   c o c . C u l t u r e = @ C u l t u r e 
 
 	 	 
 
 	 	 W H E R E 
 
 	 	   
 
 	 	 	 ( 
 
 	 	 
 
 	 	 	 	 ( c o . [ I D ]   I N   ( S e l e c t   f o . C o m m u n i t y I D   F r o m   d b o . F o r u m   f o   W H E R E   f o . [ P u b l i c ] = N ' t r u e ' ) )   
 
 	 	 
 
 	 	 	 	 O R   
 
 	 	 
 
 	 	 	 	 ( c o . [ I D ]   I N 
 
 	 	 	 	 	 ( 
 
 	 	 	 	 	 	 S e l e c t   f o . C o m m u n i t y I D   
 
 	 	 	 	 	 	 F r o m   d b o . F o r u m   f o   
 
 	 	 	 	 	 	 L e f t   J o i n   d b o . U s e r F o r u m s   u f   O N   u f . [ F o r u m ] = f o . [ I D ]   
 
 	 	 	 	 	 	 W h e r e   u f . [ U s e r ] = @ U s e r   A n d   ( u f . R e a d E n a b l e d = 1   o r   u f . T o p i c W r i t e E n a b l e d = 1   o r   u f . F o l l o w U p W r i t e E n a b l e d = 1 )   A n d   d b o . U D F _ U s e r C o m m u n i t y ( @ U s e r ) = 1   A n d   f o . [ P u b l i c ] < > N ' t r u e ' 
 
 	 	 	 	 	 ) 
 
 	 	 	 	 ) 
 
 	 	 	 )   
 
 	 	 	 
 
 	 	 	 A N D   
 
 	 	 
 
 	 	 	 d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 
 
 	 	 
 
 	 	 
 
 	 	 
 
 	 	 U N I O N   A L L 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = YgS_MR(u7b/f  A d m i n   RԏVhQ
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   T O P   1 0 0   P E R C E N T 
 
 	 	 
 
 	 	 	 N ' C o m m u n i t y '   A S   C o m m u n i t y D i r e c t o r y , 
 
 	 	 	 c o . [ I D ]   A S   [ I D ] , 
 
 	 	 	 c o . S e r i a l   A S   S e r i a l , 
 
 	 	 	 c o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 	 	 c o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 	 	 I S N U L L ( c o . [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 	 	 I S N U L L ( c o c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 c o . I n A c t i v e M a i n M e n u I c o n M a p   A S   I n A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . A c t i v e M a i n M e n u I c o n M a p   A S   A c t i v e M a i n M e n u I c o n M a p , 
 
 	 	 	 c o . B a n n e r M a p   A S   B a n n e r M a p , 
 
 	 	 	 c o . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r , 
 
 	 	 	 c o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 	 	 c o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 	 	 c o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 	 	 	 c o c . C u l t u r e   A S   C u l t u r e , 
 
 	 	 	 c o c . T i t l e   A s   T i t l e , 
 
 	 	 	 c o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 	 	 d b o . U D F _ G e t F o r u m I D F r o m C o m m u n i t y I D ( @ U s e r , c o . [ I D ] )   A S   F i r s t F o r u m I D 
 
 	 	 
 
 	 	 F R O M   d b o . C o m m u n i t y   c o 
 
 	 	 L E F T   J O I N   d b o . C o m m u n i t y C o n t e n t   c o c   O N   c o c . C o m m u n i t y I D = c o . [ I D ]   A N D   c o c . C u l t u r e = @ C u l t u r e 
 
 	 	 W H E R E   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = O(u  U N I O N   vePS	g gT N*N  U N I O N   SMbSNO(u  O R D E R   B Y 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 O R D E R   B Y   S e r i a l   D E S C 
 
 	 	 * / 
 
 
 
 	 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 - - ԏVS_MR~[(u7bCgPVQv@b	g  F o r u m   U_
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 S E L E C T 
 
 
 
 	 N ' F o r u m '   A S   C o m m u n i t y D i r e c t o r y , 
 
 	 f o . [ I D ]   A S   [ I D ] , 
 
 	 f o . C o m m u n i t y I D   A S   C o m m u n i t y I D , 
 
 	 f o . S e r i a l   A S   S e r i a l , 
 
 	 f o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 f o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 I S N U L L ( f o . [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 f o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 f o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 f o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 
 
 	 f o c . C u l t u r e   A S   C u l t u r e , 
 
 
 
 	 f o c . T i t l e   A s   T i t l e , 
 
 	 f o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 I S N U L L ( f o c . H i d d e n , 0 )   A S   H i d d e n , 
 
 
 
 	 f u c . C o m m a n d T i t l e T a s k L i s t , 
 
 	 f u c . C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 f u c . C o m m a n d T i t l e A d d , 
 
 	 f u c . C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 f u c . C o m m a n d T i t l e Q u e r y , 
 
 	 f u c . C o m m a n d T i t l e Q u e r y D e s c r i p t i o n 
 
 
 
 F R O M   d b o . F o r u m   f o 
 
 L E F T   J O I N   d b o . F o r u m C o n t e n t   f o c   O N   f o c . F o r u m I D = f o . [ I D ]     A N D   f o c . C u l t u r e = @ C u l t u r e 
 
 L E F T   J O I N   d b o . V i e w _ F o r u m U i C u s t o m i z a t i o n   f u c   O N   f u c . F o r u m C o n t e n t I D = f o c . [ I D ] 
 
 
 
 W H E R E   d b o . U D F _ F o r u m R e a d a b l e ( @ U s e r , f o . [ I D ] ) = 1 
 
 
 
 O R D E R   B Y   f o . S e r i a l 
 
 
 
 
 
 / * 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ_  P u b l i c   F o r u m     NS_MR(u7b
N/f  a d m i n 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   T O P   1 0 0   P E R C E N T 
 
 
 
 	 N ' F o r u m '   A S   C o m m u n i t y D i r e c t o r y , 
 
 	 f o . [ I D ]   A S   [ I D ] , 
 
 	 f o . C o m m u n i t y I D   A S   C o m m u n i t y I D , 
 
 	 f o . S e r i a l   A S   S e r i a l , 
 
 	 f o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 f o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 I S N U L L ( f o . [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 f o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 f o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 f o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 	 I S N U L L ( f o c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 f o c . C u l t u r e   A S   C u l t u r e , 
 
 	 f o c . T i t l e   A s   T i t l e , 
 
 	 f o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 f o c . C o m m a n d T i t l e T a s k L i s t , 
 
 	 f o c . C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 f o c . C o m m a n d T i t l e A d d , 
 
 	 f o c . C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 f o c . C o m m a n d T i t l e Q u e r y , 
 
 	 f o c . C o m m a n d T i t l e Q u e r y D e s c r i p t i o n 
 
 
 
 F R O M   d b o . F o r u m   f o 
 
 L E F T   J O I N   d b o . F o r u m C o n t e n t   f o c   O N   f o c . F o r u m I D = f o . [ I D ]     A N D   f o c . C u l t u r e = @ C u l t u r e 
 
 
 
 W H E R E   
 
 	 ( 
 
 	 	 ( f o . [ P u b l i c ] = N ' t r u e '   )   O r 
 
 
 
 	 	 ( f o . [ I D ]   i n   ( S e l e c t   u f . F o r u m   F r o m   d b o . U s e r F o r u m s   u f   W h e r e   u f . [ U s e r ] = @ U s e r   A n d   ( u f . R e a d E n a b l e d = 1   o r   u f . T o p i c W r i t e E n a b l e d = 1   o r   u f . F o l l o w U p W r i t e E n a b l e d = 1 ) )   A n d   d b o . U D F _ U s e r C o m m u n i t y ( @ U s e r ) = 1   A n d   f o . [ P u b l i c ] < > N ' t r u e '   ) 
 
 	 )     
 
 
 
 	 A N D 
 
 
 
 	 d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 
 
 
 
 
 
 U N I O N   A L L 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/f  A m i n   (u7bRԏVhQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   T O P   1 0 0   P E R C E N T 
 
 
 
 	 N ' F o r u m '   A S   C o m m u n i t y D i r e c t o r y , 
 
 	 f o . [ I D ]   A S   [ I D ] , 
 
 	 f o . C o m m u n i t y I D   A S   C o m m u n i t y I D , 
 
 	 f o . S e r i a l   A S   S e r i a l , 
 
 	 f o . [ N a m e ]   A S   [ N a m e ] , 
 
 	 f o . M o d e r a t o r   A S   M o d e r a t o r , 
 
 	 I S N U L L ( f o . [ P u b l i c ] , N ' f a l s e ' )   A S   [ P u b l i c ] , 
 
 	 f o . R e a d P e r m i s s i o n   A S   R e a d P e r m i s s i o n , 
 
 	 f o . T o p i c W r i t e P e r m i s s i o n   A S   T o p i c W r i t e P e r m i s s i o n , 
 
 	 f o . F o l l o w U p W r i t e P e r m i s s i o n   A S   F o l l o w U p W r i t e P e r m i s s i o n , 
 
 	 I S N U L L ( f o c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 f o c . C u l t u r e   A S   C u l t u r e , 
 
 	 f o c . T i t l e   A s   T i t l e , 
 
 	 f o c . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 f o c . C o m m a n d T i t l e T a s k L i s t , 
 
 	 f o c . C o m m a n d T i t l e T a s k L i s t D e s c r i p t i o n , 
 
 	 f o c . C o m m a n d T i t l e A d d , 
 
 	 f o c . C o m m a n d T i t l e A d d D e s c r i p t i o n , 
 
 	 f o c . C o m m a n d T i t l e Q u e r y , 
 
 	 f o c . C o m m a n d T i t l e Q u e r y D e s c r i p t i o n 
 
 
 
 F R O M   d b o . F o r u m   f o 
 
 L E F T   J O I N   d b o . F o r u m C o n t e n t   f o c   O N   f o c . F o r u m I D = f o . [ I D ]     A N D   f o c . C u l t u r e = @ C u l t u r e 
 
 W H E R E   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O(u  U N I O N   vePS	g gT N*N  U N I O N   SMbSNO(u  O R D E R   B Y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 O R D E R   B Y   S e r i a l 
 
 * / 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M e n u C o m m u n i t y F o r u m ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c G e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c G e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c G e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v  M a i n D i r e c t o r y N a m e   N  M a i n D i r e c t o r y   b  C o m m u n i t y   hԏV[^v  B a n n e r M a p 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 1   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 1 - 0 1 - 1 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c G e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e 
 
 
 
 @ M a i n D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) 	 	 	 - - h  M a i n D i r e c t o r y   /   C o m m u n i t y   v  M a i n D i r e c t o r y N a m e 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  9hnc  @ M a i n D i r e c t o r y N a m e   eg  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y   Q[NT̑_	|~v  M a i n D i r e c t o r y N a m e   /f
N͑
Yv
N{/feg  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   [ N a m e ] = @ M a i n D i r e c t o r y N a m e ) 
 
 
 
 B E G I N 
 
 
 
 	 S E L E C T   
 
 
 
 	 	 m d . B a n n e r M a p   A S   B a n n e r M a p 
 
 
 
 	 F R O M   d b o . M a i n D i r e c t o r y   m d   W H E R E   m d . [ N a m e ] = @ M a i n D i r e c t o r y N a m e 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 S E L E C T   
 
 
 
 	 	 c o . B a n n e r M a p   A S   B a n n e r M a p 
 
 
 
 	 F R O M   d b o . C o m m u n i t y   c o   W H E R E   c o . [ N a m e ] = @ M a i n D i r e c t o r y N a m e 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c G e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c S e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c S e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c S e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v  M a i n D i r e c t o r y N a m e   \  B a n n e r M a p   QeQ  M a i n D i r e c t o r y   b  C o m m u n i t y   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 1   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 1 - 0 1 - 1 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c S e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e 
 
 
 
 @ M a i n D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - h  M a i n D i r e c t o r y   /   C o m m u n i t y     v  M a i n D i r e c t o r y N a m e 
 
 @ B a n n e r M a p   n t e x t 	 	 	 	 	 - - h  M a i n D i r e c t o r y   /   C o m m u n i t y     v  B a n n e r M a p 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  9hnc  @ M a i n D i r e c t o r y N a m e   /feg  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y   hQ[\  @ B a n n e r C o n t e n t L a y e r   OX[0R  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y   h	|~v  M a i n D i r e c t o r y N a m e   /f
NO͑
Yv
N{/feg  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   [ N a m e ] = @ M a i n D i r e c t o r y N a m e ) 
 
 
 
 B E G I N 
 
 
 
 	 U P D A T E   d b o . M a i n D i r e c t o r y   S E T   B a n n e r M a p = @ B a n n e r M a p   W H E R E   [ N a m e ] = @ M a i n D i r e c t o r y N a m e 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 U P D A T E   d b o . C o m m u n i t y   S E T   B a n n e r M a p = @ B a n n e r M a p   W H E R E   [ N a m e ] = @ M a i n D i r e c t o r y N a m e 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c S e t B a n n e r M a p B y M a i n D i r e c t o r y N a m e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y G e t N e i g h b o u r         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y G e t N e i g h b o u r ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y G e t N e i g h b o u r ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~[  P a g e D i r e c t o r y N a m e   ԏVvQ  N e i g h b o u r   1\/fT  P a g e D i r e c t o r y   MONT N  S u b D i r e c t o r y ,   bT N  M a i n D i r e c t o r y   v  P a g e D i r e c t o r y 	
 
 - - = = 
 
 - - = =   S P   (uN  K n o w l e d g e    RdTv͑[TRNNQy`b_
 
 - - = = 1 .   Yg Rdv/f  P a g e D i r e c t o r y   agvRhgS_MRyv/f&T	gT^\ N*N  S u b D i r e c t o r y   Nv  B r o t h e r Yg	gRSKN&TRST N*N  M a i n D i r e c t o r y   NvvQ[  S u b D i r e c t o r y   yNv  P a g e D i r e c t o r y bvQN  M a i n D i r e c t o r y   Nv gT N*N  S u b D i r e c t o r y   Nv gT N*N  P a g e D i r e c t o r y 
 
 - - = = 2 .   Yg Rdv/f  S u b D i r e c t o r y   agvRST N  M a i n D i r e c t o r y   yNvQ[  S u b D i r e c t o r y   Nv gT N*N  P a g e D i r e c t o r y 
 
 - - = = 3 .   Yg Rdv/f  M a i n D i r e c t o r y   agvRS4Nя  M a i n D i r e c t o r y   N gT N*N  S u b D i r e c t o r y   Nv gT N*N  P a g e D i r e c t o r y 
 
 - - = = 4 .   Yg  M a i n D i r e c t o r y    RIQNRۏeQ  " {t  |   Q[{t  |   Q[h" 
 
 - - = = 
 
 - - = = ԏV~g
 
 - - = = Yg/f] R]RbN\ՋS[~bvQ  N e i g h b o u r ,   ~b0RN1\ԏVُ*N  N e i g h b o u r &TRԏVzz
 
 - - = = Yg
N/f] R]RS\
NRԏVُ*N  @ P a g e D i r e c t o r y N a m e   \O  N e i g h b o u r 
 
 - - = = (W  A S P X   zNYgw0RԏVegv  N e i g h b o u r   
N:NzzRfbcS_MR  C o n t e x t     P a g e M e n u N a m e Yg:Nzzf]~ RIQN]~l	g  M a i n D i r e c t o r y   N	R [  " {t  |   Q[{t  |   Q[h" 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 1 - 1 5   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y G e t N e i g h b o u r 
 
 
 
 @ P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 - - ~[v  @ P a g e D i r e c t o r y N a m e 
 
 @ K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 - - /f  M a i n D i r e c t o r y ,   S u b D i r e c t o r y ,   P a g e D i r e c t o r y ? 
 
 @ K n o w l e d g e I t e m   i n t , 	 	 	 - -  Rdagvv  I D 
 
 
 
 @ N e i g h b o u r   n v a r c h a r ( 1 0 0 )   O U T 	 	 - - ԏVSpe,   c[  @ K n o w l e d g e I t e m   v  N e i g h b o u r 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ P a g e D i r e c t o r y N a m e   [^v  P a g e D i r e c t o r y I D ,   S u b D i r e c t o r y I D ,   M a i n D i r e c t o r y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e D i r e c t o r y I D   I N T 
 
 D E C L A R E   @ S u b D i r e c t o r y I D   I N T 
 
 D E C L A R E   @ M a i n D i r e c t o r y I D   I N T 
 
 
 
 D E C L A R E   @ P a g e D i r e c t o r y S e r i a l   I N T 
 
 D E C L A R E   @ S u b D i r e c t o r y S e r i a l   I N T 
 
 D E C L A R E   @ M a i n D i r e c t o r y S e r i a l   I N T 
 
 
 
 S E L E C T   
 
 
 
 	 @ P a g e D i r e c t o r y I D = p d . [ I D ] , 
 
 	 @ P a g e D i r e c t o r y S e r i a l = p d . S e r i a l , 
 
 	 @ S u b D i r e c t o r y I D = s d . [ I D ] , 
 
 	 @ S u b D i r e c t o r y S e r i a l = s d . S e r i a l , 
 
 	 @ M a i n D i r e c t o r y I D = m d . [ I D ] , 
 
 	 @ M a i n D i r e c t o r y S e r i a l = m d . S e r i a l 
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y   p d   
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p d . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 
 
 W H E R E   p d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ P a g e D i r e c t o r y I D ,   @ S u b D i r e c t o r y I D ,   @ M a i n D i r e c t o r y I D   vE\  I D   Yg	g  S e r i a l   'Y N*Nv(u'Y N*Nv&TR(u\ N*Nv	
 
 - - = = HQRYS:N    @ P a g e D i r e c t o r y N e i g h b o u r I D = @ P a g e D i r e c t o r y I D @ S u b D i r e c t o r y N e i g h b o u r I D = @ S u b D i r e c t o r y I D   @ M a i n D i r e c t o r y N e i g h b o u r I D = @ M a i n D i r e c t o r y I D   ( N[
N(WTbbN\d[[[N]~ce(WYN) 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e D i r e c t o r y N e i g h b o u r I D   I N T 
 
 D E C L A R E   @ S u b D i r e c t o r y N e i g h b o u r I D   I N T 
 
 D E C L A R E   @ M a i n D i r e c t o r y N e i g h b o u r I D   I N T 
 
 
 
 S E T   @ P a g e D i r e c t o r y N e i g h b o u r I D = @ P a g e D i r e c t o r y I D 
 
 S E T   @ S u b D i r e c t o r y N e i g h b o u r I D = @ S u b D i r e c t o r y I D 
 
 S E T   @ M a i n D i r e c t o r y N e i g h b o u r I D = @ M a i n D i r e c t o r y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ P a g e D i r e c t o r y N e i g h b o u r I D   ~b  S e r i a l   4Nяvb  I D   4Nяv  	geP  S e r i a l   S9h,glǏ/f  1 ُ/f1\~b  I D   4Nяv		
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   p d . [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . S e r i a l > @ P a g e D i r e c t o r y S e r i a l   A n d   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ P a g e D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   p d . [ I D ]     F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . S e r i a l > @ P a g e D i r e c t o r y S e r i a l   A n d   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   O r d e r   B y   p d . S e r i a l   A S C ) 
 
 	 E N D 
 
 
 
 E L S E   I F   E X I S T S   ( S e l e c t   p d . [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . S e r i a l < @ P a g e D i r e c t o r y S e r i a l   A n d   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ P a g e D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   p d . [ I D ]     F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . S e r i a l < @ P a g e D i r e c t o r y S e r i a l   A n d   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   O r d e r   B y   p d . S e r i a l   D E S C ) 
 
 	 E N D 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   p d . [ I D ]   F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . [ I D ] > @ P a g e D i r e c t o r y I D   A n d   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D ) 
 
 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ P a g e D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   p d . [ I D ]     F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . [ I D ] > @ P a g e D i r e c t o r y I D   A n d   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   O r d e r   B y   p d . [ I D ]   A S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ P a g e D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   p d . [ I D ]     F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . [ I D ] < @ P a g e D i r e c t o r y I D   A n d   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D   O r d e r   B y   p d . [ I D ]   D E S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ S u b D i r e c t o r y N e i g h b o u r I D   ~b  S e r i a l   4Nяvb  I D   4Nяv  	geP  S e r i a l   S9h,glǏ/f  1 ُ/f1\~b  I D   4Nяv		
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   s d . [ I D ]   F r o m   d b o . S u b D i r e c t o r y   s d   W h e r e   s d . S e r i a l > @ S u b D i r e c t o r y S e r i a l   A n d   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ S u b D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   s d . [ I D ]     F r o m   d b o . S u b D i r e c t o r y   s d   W h e r e   s d . S e r i a l > @ S u b D i r e c t o r y S e r i a l   A n d   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   O r d e r   B y   s d . S e r i a l   A S C ) 
 
 	 E N D 
 
 
 
 E L S E   I F   E X I S T S   ( S e l e c t   s d . [ I D ]   F r o m   d b o . S u b D i r e c t o r y   s d   W h e r e   s d . S e r i a l < @ S u b D i r e c t o r y S e r i a l   A n d   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ S u b D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   s d . [ I D ]     F r o m   d b o . S u b D i r e c t o r y   s d   W h e r e   s d . S e r i a l < @ S u b D i r e c t o r y S e r i a l   A n d   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   O r d e r   B y   s d . S e r i a l   D E S C ) 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   s d . [ I D ]   F r o m   d b o . S u b D i r e c t o r y   s d   W h e r e   s d . [ I D ] > @ S u b D i r e c t o r y I D   A n d   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D ) 
 
 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ S u b D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   s d . [ I D ]     F r o m   d b o . S u b D i r e c t o r y   s d   W h e r e   s d . [ I D ] > @ S u b D i r e c t o r y I D   A n d   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   O r d e r   B y   s d . [ I D ]   A S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ S u b D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   s d . [ I D ]     F r o m   d b o . S u b D i r e c t o r y   s d   W h e r e   s d . [ I D ] < @ S u b D i r e c t o r y I D   A n d   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D   O r d e r   B y   s d . [ I D ]   D E S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 E N D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ M a i n D i r e c t o r y N e i g h b o u r I D   ~b  S e r i a l   4Nяvb  I D   4Nяv  	geP  S e r i a l   S9h,glǏ/f  1 ُ/f1\~b  I D   4Nяv		
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   m d . [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   m d   W h e r e   m d . S e r i a l > @ M a i n D i r e c t o r y S e r i a l ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   m d . [ I D ]     F r o m   d b o . M a i n D i r e c t o r y   m d   W h e r e   m d . S e r i a l > @ M a i n D i r e c t o r y S e r i a l   O r d e r   B y   m d . S e r i a l   A S C ) 
 
 	 E N D 
 
 
 
 E L S E   I F   E X I S T S   ( S e l e c t   m d . [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   m d   W h e r e   m d . S e r i a l < @ M a i n D i r e c t o r y S e r i a l ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   m d . [ I D ]     F r o m   d b o . M a i n D i r e c t o r y   m d   W h e r e   m d . S e r i a l < @ M a i n D i r e c t o r y S e r i a l   O r d e r   B y   m d . S e r i a l   D E S C ) 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   m d . [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   m d   W h e r e   m d . [ I D ] > @ M a i n D i r e c t o r y I D ) 
 
 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ M a i n D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   m d . [ I D ]     F r o m   d b o . M a i n D i r e c t o r y   m d   W h e r e   m d . [ I D ] > @ M a i n D i r e c t o r y I D   O r d e r   B y   m d . [ I D ]   A S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ M a i n D i r e c t o r y N e i g h b o u r I D = ( S e l e c t   T o p   1   m d . [ I D ]     F r o m   d b o . M a i n D i r e c t o r y   m d   W h e r e   m d . [ I D ] < @ M a i n D i r e c t o r y I D   O r d e r   B y   m d . [ I D ]   D E S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 E N D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  @ K n o w l e d g e D i r e c t o r y =     P a g e D i r e c t o r y   |     S u b D i r e c t o r y   |   M a i n D i r e c t o r y     	Ny`b_Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   @ K n o w l e d g e D i r e c t o r y = N ' P a g e D i r e c t o r y ' 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 - - = = Yg/f  P a g e D i r e c t o r y   `b_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQww/f
N/fd[[[N/fv݋9hncbN(W  S P   P a g e D i r e c t o r y D e l e t e   -Nv~[d[[[Nv RdOybkȒُ_N1\
NX[(WQ  N e i g h b o u r   vvcQ    @ P a g e D i r e c t o r y N a m e   \O:N  @ N e i g h b o u r   O U T 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 
 
 	 	 D E C L A R E   @ P a g e D i r e c t o r y C o u n t   I N T 
 
 	 	 S E L E C T   @ P a g e D i r e c t o r y C o u n t = C O U N T ( p d . [ I D ] )   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y I D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = /f&Td[[[N
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ P a g e D i r e c t o r y C o u n t < = 1 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Yg
0/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ N e i g h b o u r = @ P a g e D i r e c t o r y N a m e 
 
 	 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Yg
0
N/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = R/f&T] R]R+RQ
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   @ P a g e D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 	 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0/f0] R]  . . . 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T     @ N e i g h b o u r = ( S e l e c t   p d . [ N a m e ]   F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . [ I D ] = @ P a g e D i r e c t o r y N e i g h b o u r I D ) 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 	 E L S E 
 
 	 	 	 	 	 B E G I N 	 	 	 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0
N/f0] R]vcQ  @ P a g e D i r e c t o r y N a m e   \O:N  @ N e i g h b o u r   O U T 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T   @ N e i g h b o u r = @ P a g e D i r e c t o r y N a m e 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 E N D 
 
 
 
 
 
 	 E N D 
 
 
 
 E L S E   I F     @ K n o w l e d g e D i r e c t o r y = N ' S u b D i r e c t o r y ' 
 
 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 - - = = Yg/f  S u b D i r e c t o r y   `b_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQww/f
N/fd[[[N/fv݋9hncbN(W  S P   P a g e D i r e c t o r y D e l e t e   -Nv~[d[[[Nv RdOybkȒُ_N1\
NX[(WQ  N e i g h b o u r   vvcQ    @ P a g e D i r e c t o r y N a m e   \O:N  @ N e i g h b o u r   O U T 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 
 
 	 	 D E C L A R E   @ S u b D i r e c t o r y C o u n t   I N T 
 
 	 	 S E L E C T   @ S u b D i r e c t o r y C o u n t = C O U N T ( s d . [ I D ] )   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y I D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = /f&Td[[[N
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ S u b D i r e c t o r y C o u n t < = 1 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Yg
0/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ N e i g h b o u r = @ P a g e D i r e c t o r y N a m e 
 
 	 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Yg
0
N/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = R/f&T] R]R+RQ
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   @ S u b D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 	 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0/f0] R]  . . . 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T     @ N e i g h b o u r = ( S e l e c t   T o p   1   p d . [ N a m e ]   F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . S u b D i r e c t o r y I D = @ S u b D i r e c t o r y N e i g h b o u r I D   O r d e r   B y   p d . S e r i a l   A S C ) 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 	 E L S E 
 
 	 	 	 	 	 B E G I N 	 	 	 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0
N/f0] R]vcQ  @ P a g e D i r e c t o r y N a m e   \O:N  @ N e i g h b o u r   O U T 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T   @ N e i g h b o u r = @ P a g e D i r e c t o r y N a m e 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 E N D 
 
 
 
 
 
 	 E N D 
 
 
 
 
 
 
 
 E L S E 
 
 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 - - = = Yg/f  M a i n D i r e c t o r y   `b_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQww/f
N/fd[[[N/fv݋Q  @ N e i g h b o u r = " "       A S P X   zw0Rzzv  @ N e i g h b o u r   O0R|~{t̑
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 
 
 	 	 D E C L A R E   @ M a i n D i r e c t o r y C o u n t   I N T 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y C o u n t = C O U N T ( m d . [ I D ] )   F R O M   d b o . M a i n D i r e c t o r y   m d 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = /f&Td[[[N
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ M a i n D i r e c t o r y C o u n t < = 1 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = Yg
0/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ N e i g h b o u r = N ' ' 
 
 	 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = Yg
0
N/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = R/f&T] R]R+RQ
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   @ M a i n D i r e c t o r y I D = @ K n o w l e d g e I t e m 
 
 	 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0/f0] R]  . . . 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T     @ N e i g h b o u r = ( S e l e c t   T o p   1   p d . [ N a m e ]   F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . S u b D i r e c t o r y I D = ( s e l e c t   t o p   1   s d . [ I D ]   f r o m   d b o . S u b D i r e c t o r y   s d   w h e r e   s d . M a i n D i r e c t o r y I D = @ M a i n D i r e c t o r y N e i g h b o u r I D   o r d e r   b y   s d . [ I D ]   A S C )   O r d e r   B y   p d . S e r i a l   A S C ) 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 	 E L S E 
 
 	 	 	 	 	 B E G I N 	 	 	 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0
N/f0] R]vcQ  @ P a g e D i r e c t o r y N a m e   \O:N  @ N e i g h b o u r   O U T 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T   @ N e i g h b o u r = @ P a g e D i r e c t o r y N a m e 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 E N D 
 
 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y G e t N e i g h b o u r ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ A d m i n E d i t o r U s e r A u t h e n t i c a t i o n ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ A d m i n E d i t o r U s e r A u t h e n t i c a t i o n ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgS_MR(u7b/f&TSN[  K n o w l e d g e   T  L e v e l 	ۏLOX[O9e
 
 - - = = h  U s e r s   -Nv(u7b҉rYg
N/f  A d m i n ,   C h i e f E d i t o r   b&{TCgP[v  C o l u m n   E d i t o r   R
NۏLOX[O9e
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n 
 
 
 
 @ U s e r   N V A R C H A R ( 5 0 ) , 	 	 	 	 - - Spec[(u7b
 
 
 
 @ K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - \hg[gqv  K n o w l e d g e     agvvv  D i r e c t o r y 
 
 @ K n o w l e d g e I t e m   i n t , 	 	 	 	 - - \hg[gqv  K n o w l e d g e     agvv  I D 
 
 
 
 @ o P a s s   I N T   O U T 	 	 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Sϑ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ E d i t o r P e r m i s s i o n   I N T 
 
 S E T   @ E d i t o r P e r m i s s i o n = 0 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg  @ U s e r   /f  N U L L R:_6R:N  N ' ' 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ U s e r   I S   N U L L 
 
 
 
 B E G I N 
 
 	 S E T   @ U s e r = N ' ' 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Sϑ NX
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ M a i n D i r e c t o r y E d i t o r   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ S u b D i r e c t o r y E d i t o r   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ P a g e D i r e c t o r y E d i t o r   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ K n o w l e d g e E d i t o r   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 D E C L A R E   @ U s e r I n E d i t o r L i s t   I N T 
 
 
 
 D E C L A R E   @ M a i n D i r e c t o r y I D   I N T 
 
 D E C L A R E   @ S u b D i r e c t o r y I D   I N T 
 
 D E C L A R E   @ P a g e D i r e c t o r y I D   I N T 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/f  M a i n D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   @ K n o w l e d g e D i r e c t o r y = N ' M a i n D i r e c t o r y ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = SS_MR  M a i n D i r e c t o r y   Rh
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , m d . E d i t o r ) , N ' ' )   F R O M   d b o . M a i n D i r e c t o r y   m d   W H E R E   m d . [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR  @ U s e r   /f&T(WRh
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ U s e r I n E d i t o r L i s t = 0 
 
 	 	 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ M a i n D i r e c t o r y E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ M a i n D i r e c t o r y E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg/f  A d m i n   b  C h i e f E d i t o r   b  K n o w l e d g e   cCgRh-NvNRSN
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 )     O R     ( d b o . U D F _ U s e r C h i e f E d i t o r ( @ U s e r ) = 1 )     O R     ( @ U s e r I n E d i t o r L i s t = 1 ) 
 
 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ E d i t o r P e r m i s s i o n = 1 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/f  S u b D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y = N ' S u b D i r e c t o r y ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc  S u b D i r e c t o r y I D   _  M a i n D i r e c t o r y I D 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y I D = s d . M a i n D i r e c t o r y I D   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = SS_MR  M a i n D i r e c t o r y ,   S u b D i r e c t o r y   Rh
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , m d . E d i t o r ) , N ' ' )   F R O M   d b o . M a i n D i r e c t o r y   m d   W H E R E   m d . [ I D ] = @ M a i n D i r e c t o r y I D 
 
 	 	 S E L E C T   @ S u b D i r e c t o r y E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , s d . E d i t o r ) , N ' ' )   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR  @ U s e r   /f&T(WRh  ( NN NsSS) 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ U s e r I n E d i t o r L i s t = 0 
 
 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ M a i n D i r e c t o r y E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ M a i n D i r e c t o r y E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 	 	 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ S u b D i r e c t o r y E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ S u b D i r e c t o r y E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg/f  A d m i n   b  C h i e f E d i t o r   b  K n o w l e d g e   cCgRh-NvNRSN
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 )     O R     ( d b o . U D F _ U s e r C h i e f E d i t o r ( @ U s e r ) = 1 )     O R     ( @ U s e r I n E d i t o r L i s t = 1 ) 
 
 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ E d i t o r P e r m i s s i o n = 1 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/f  P a g e D i r e c t o r y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y = N ' P a g e D i r e c t o r y ' 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc  P a g e D i r e c t o r y I D   _  S u b D i r e c t o r y I D   T  M a i n D i r e c t o r y I D 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ S u b D i r e c t o r y I D = p d . S u b D i r e c t o r y I D   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y I D = s d . M a i n D i r e c t o r y I D   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = SS_MR  M a i n D i r e c t o r y ,   S u b D i r e c t o r y ,   P a g e D i r e c t o r y     Rh
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , m d . E d i t o r ) , N ' ' )   F R O M   d b o . M a i n D i r e c t o r y   m d   W H E R E   m d . [ I D ] = @ M a i n D i r e c t o r y I D 
 
 	 	 S E L E C T   @ S u b D i r e c t o r y E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , s d . E d i t o r ) , N ' ' )   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ S u b D i r e c t o r y I D 
 
 	 	 S E L E C T   @ P a g e D i r e c t o r y E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , p d . E d i t o r ) , N ' ' )   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR  @ U s e r   /f&T(WRh  ( 	NN NsSS) 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ U s e r I n E d i t o r L i s t = 0 
 
 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ M a i n D i r e c t o r y E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ M a i n D i r e c t o r y E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 	 	 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ S u b D i r e c t o r y E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ S u b D i r e c t o r y E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ P a g e D i r e c t o r y E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ P a g e D i r e c t o r y E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg/f  A d m i n   b  C h i e f E d i t o r   b  K n o w l e d g e   cCgRh-NvNRSN
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 )     O R     ( d b o . U D F _ U s e r C h i e f E d i t o r ( @ U s e r ) = 1 )     O R     ( @ U s e r I n E d i t o r L i s t = 1 ) 
 
 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ E d i t o r P e r m i s s i o n = 1 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/f  K n o w l e d g e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y = N ' K n o w l e d g e ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hncK n o w l e d g e I D   _  P a g e D i r e c t o r y I D ,   S u b D i r e c t o r y I D   T  M a i n D i r e c t o r y I D 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ P a g e D i r e c t o r y I D = n o w . P a g e D i r e c t o r y I D   F R O M   d b o . K n o w l e d g e   n o w   W H E R E   n o w . [ I D ] = @ K n o w l e d g e I t e m 
 
 	 	 S E L E C T   @ S u b D i r e c t o r y I D = p d . S u b D i r e c t o r y I D   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . [ I D ] = @ P a g e D i r e c t o r y I D 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y I D = s d . M a i n D i r e c t o r y I D   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = SS_MR  M a i n D i r e c t o r y ,   S u b D i r e c t o r y ,   P a g e D i r e c t o r y ,   K n o w l e d g e     Rh
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ M a i n D i r e c t o r y E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , m d . E d i t o r ) , N ' ' )   F R O M   d b o . M a i n D i r e c t o r y   m d   W H E R E   m d . [ I D ] = @ M a i n D i r e c t o r y I D 
 
 	 	 S E L E C T   @ S u b D i r e c t o r y E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , s d . E d i t o r ) , N ' ' )   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ S u b D i r e c t o r y I D 
 
 	 	 S E L E C T   @ P a g e D i r e c t o r y E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , p d . E d i t o r ) , N ' ' )   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . [ I D ] = @ P a g e D i r e c t o r y I D 
 
 	 	 S E L E C T   @ K n o w l e d g e E d i t o r = I S N U L L ( C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , n o w . E d i t o r ) , N ' ' )   F R O M   d b o . K n o w l e d g e   n o w   W H E R E   n o w . [ I D ] = @ K n o w l e d g e I t e m 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR  @ U s e r   /f&T(WRh  ( VN NsSS) 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E T   @ U s e r I n E d i t o r L i s t = 0 
 
 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ M a i n D i r e c t o r y E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ M a i n D i r e c t o r y E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 	 	 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ S u b D i r e c t o r y E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ S u b D i r e c t o r y E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ P a g e D i r e c t o r y E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ P a g e D i r e c t o r y E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 
 
 	 	 - - I F     ( @ U s e r   I n   ( s e l e c t   E l e m e n t   f r o m   d b o . U D F _ P u b l i c S p l i t ( @ K n o w l e d g e E d i t o r , N ' , ' ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 I F     ( @ U s e r   I n   ( s e l e c t   [ U s e r ]   f r o m   d b o . U D F _ U s e r R e s o l v e ( @ K n o w l e d g e E d i t o r ) ) )     A n d     ( @ U s e r < > N ' ' )   
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ U s e r I n E d i t o r L i s t = 1 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg/f  A d m i n   b  C h i e f E d i t o r   b  K n o w l e d g e   cCgRh-NvNRSN
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 )     O R     ( d b o . U D F _ U s e r C h i e f E d i t o r ( @ U s e r ) = 1 )     O R     ( @ U s e r I n E d i t o r L i s t = 1 ) 
 
 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ E d i t o r P e r m i s s i o n = 1 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/fzzW[&{R     A d m i n   b  C h i e f   E d i t o r   CgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y = N ' ' 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg/f  A d m i n   b  C h i e f E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 )     O R     ( d b o . U D F _ U s e r C h i e f E d i t o r ( @ U s e r ) = 1 )   
 
 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ E d i t o r P e r m i s s i o n = 1 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/fvQ[     N,SNO(u    N ' A d m i n E d i t o r '   ُe/f<{~0W$Re/f/f  A d m i n   b  C h i e f   E d i t o r   b  C o l u m n   E d i t o r   GWS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg/f  A d m i n   b  C h i e f E d i t o r ,   b  C o l u m n E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 )     O R     ( d b o . U D F _ U s e r C h i e f E d i t o r ( @ U s e r ) = 1 )     O R     ( d b o . U D F _ U s e r C o l u m n E d i t o r ( @ U s e r ) = 1 ) 
 
 
 
 	 	 B E G I N 
 
 	 	 	 S E T   @ E d i t o r P e r m i s s i o n = 1 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  g~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   @ E d i t o r P e r m i s s i o n = 0 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R A I S E R R O R ( N ' _bIk`
N/fQz{tXTbb	gv^CgPv
NAQۏLd\O0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ A d m i n E d i t o r U s e r A u t h e n t i c a t i o n ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r F o r g e t P a s s w o r d         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r F o r g e t P a s s w o r d ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r F o r g e t P a s s w o r d ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - (u7b_[xTcO(u7b
TT{ُ̑(u7b
TT{/f&T NYg NRԏV(u7b[xTv^  R e s u l t   Nx
 
 - - Q  o R e s u l t   ~gNx  0 v&{    - 1 (u7b
NX[(W      - 2 {&7b
N9SM	
 
 - - Q  o P a s s w o r d   (u7bv[x
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r F o r g e t P a s s w o r d 
 
 
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - (u7b
TeQ	
 
 @ E m a i l A d d r e s s   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - {0W@W
 
 
 
 @ o A d m i n E m a i l A d d r e s s   n v a r c h a r ( 1 0 0 )   O U T , 	 - - |~{tXTv  E m a i l   0W@W
 
 @ o P a s s w o r d   n v a r c h a r ( 2 0 0 )   O U T , 	 	 - - [xR[v	Q	
 
 @ o R e s u l t   i n t   O U T 	 	 	 	 - - /f&TǏQ	
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg(u7b
NX[(W  |   X[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   N O T   E X I S T S   ( S e l e c t   u s . [ I D ]   F r o m   d b o . U s e r s   u s   W h e r e   u s . [ N a m e ] = @ N a m e ) 
 
 
 
 	 B E G I N   
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg(u7b
NX[(W
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ o R e s u l t = - 1 
 
 	 	 S E L E C T   @ o P a s s w o r d = N ' ' 
 
 	 	 S E L E C T   @ o A d m i n E m a i l A d d r e s s = N ' ' 
 
 	 	 R E T U R N 
 
 	 E N D 	 
 
 
 
 E L S E 
 
 
 
 	 B E G I N   
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg(u7bX[(W
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   N O T   E X I S T S   ( S e l e c t   u s . [ I D ]   F r o m   d b o . U s e r s   u s   W h e r e   u s . [ N a m e ] = @ N a m e   A n d   u s . [ E m a i l ] = @ E m a i l A d d r e s s ) 
 
 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = Yg{0W@W
N9SM
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 S E L E C T   @ o R e s u l t = - 2 
 
 	 	 	 	 S E L E C T   @ o P a s s w o r d = N ' ' 
 
 	 	 	 	 S E L E C T   @ o A d m i n E m a i l A d d r e s s = N ' ' 
 
 	 	 	 	 R E T U R N 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = Yg{0W@W9SM
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 S E L E C T   @ o R e s u l t = 0 
 
 	 	 	 	 S E L E C T   @ o P a s s w o r d = I S N U L L ( u s . [ P a s s w o r d ] , N ' ' )   F r o m   d b o . [ U s e r s ]   u s   W h e r e   u s . [ N a m e ] = @ N a m e 
 
 	 	 	 	 S E L E C T   @ o A d m i n E m a i l A d d r e s s = I S N U L L ( u s . [ E m a i l ] , N ' ' )   F r o m   d b o . [ U s e r s ]   u s   W h e r e   d b o . U D F _ U s e r A d m i n ( u s . [ N a m e ] ) = 1 
 
 	 	 	 	 R E T U R N 
 
 	 	 	 E N D 
 
 	 E N D 	 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r F o r g e t P a s s w o r d ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r C h a n g e P a s s w o r d         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r C h a n g e P a s s w o r d ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r C h a n g e P a s s w o r d ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - (u7bO9e[xhg(u7b/f&TX[(We[x/f&Tcknxe[x$N!keQ/f&T N
 
 - - Q  o R e s u l t   ~gNx  0 bR    - 1 (u7b
NX[(W      - 2 e[x
N9SM    - 3 e[x$N!keQ
N N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r C h a n g e P a s s w o r d 
 
 
 
 @ N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - (u7b
TeQ	
 
 
 
 @ O l d E n c r y p t e d P a s s w o r d   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - e[xR[v	
 
 @ N e w E n c r y p t e d P a s s w o r d   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - e[x
 
 @ N e w E n c r y p t e d P a s s w o r d R e t y p e   n v a r c h a r ( 2 0 0 ) , 	 	 - - e[x,{NMeQ	
 
 
 
 @ N e w P a s s w o r d   n v a r c h a r ( 2 0 0 ) , 	 	 	 	 - - e[x
 
 @ N e w P a s s w o r d R e t y p e   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - e[x,{NMeQ	
 
 
 
 @ o R e s u l t   i n t   O U T 	 	 	 	 	 - - /f&TǏQ	
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg(u7b
NX[(W  |   X[(W
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   N O T   E X I S T S   ( S e l e c t   u s . [ I D ]   F r o m   d b o . U s e r s   u s   W h e r e   u s . [ N a m e ] = @ N a m e ) 
 
 
 
 	 B E G I N   
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg(u7b
NX[(W
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   @ o R e s u l t = - 1 
 
 	 	 R E T U R N 
 
 	 E N D 	 
 
 
 
 E L S E 
 
 
 
 	 B E G I N   
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg(u7bX[(W
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   N O T   E X I S T S   ( S e l e c t   u s . [ I D ]   F r o m   d b o . U s e r s   u s   W h e r e   u s . [ N a m e ] = @ N a m e   A n d   u s . [ P a s s w o r d ] = @ O l d E n c r y p t e d P a s s w o r d ) 
 
 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = Yge[x
N9SM
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 S E L E C T   @ o R e s u l t = - 2 
 
 	 	 	 	 R E T U R N 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = Yge[x9SM
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   ( @ N e w E n c r y p t e d P a s s w o r d < > @ N e w E n c r y p t e d P a s s w o r d R e t y p e )   O R   ( @ N e w P a s s w o r d = N ' ' )   O R   ( @ N e w P a s s w o r d R e t y p e = N ' ' ) 
 
 	 	 	 	 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yge[x$N!keQ
N N
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 S E L E C T   @ o R e s u l t = - 3 
 
 	 	 	 	 	 	 R E T U R N 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 	 E L S E 
 
 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yge[x$N!keQ NTee[x_N9SMTe(u7b_NX[(W	
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 U P D A T E   d b o . [ U s e r s ]   S E T   [ P a s s w o r d ] = @ N e w E n c r y p t e d P a s s w o r d   W H E R E   [ N a m e ] = @ N a m e 
 
 	 	 	 	 	 	 S E L E C T   @ o R e s u l t = 0 
 
 	 	 	 	 	 	 R E T U R N 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 E N D 
 
 	 E N D 	 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r C h a n g e P a s s w o r d ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c G e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c G e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c G e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v  M a i n D i r e c t o r y N a m e   N  M a i n D i r e c t o r y   b  C o m m u n i t y   hԏV[^v  B a n n e r C o n t e n t L a y e r 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 1   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 1 - 0 1 - 1 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c G e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e 
 
 
 
 @ M a i n D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 - - h  M a i n D i r e c t o r y   /   C o m m u n i t y   v  M a i n D i r e c t o r y N a m e 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  9hnc  @ M a i n D i r e c t o r y N a m e   eg  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y   Q[NT̑_	|~v  M a i n D i r e c t o r y N a m e   /f
N͑
Yv
N{/feg  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   [ N a m e ] = @ M a i n D i r e c t o r y N a m e ) 
 
 
 
 B E G I N 
 
 
 
 	 S E L E C T   
 
 
 
 	 	 m d . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r 
 
 
 
 	 F R O M   d b o . M a i n D i r e c t o r y   m d   W H E R E   m d . [ N a m e ] = @ M a i n D i r e c t o r y N a m e 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 S E L E C T   
 
 
 
 	 	 c o . B a n n e r C o n t e n t L a y e r   A S   B a n n e r C o n t e n t L a y e r 
 
 
 
 	 F R O M   d b o . C o m m u n i t y   c o   W H E R E   c o . [ N a m e ] = @ M a i n D i r e c t o r y N a m e 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c G e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P u b l i c S e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P u b l i c S e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P u b l i c S e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v  M a i n D i r e c t o r y N a m e   \  B a n n e r C o n t e n t L a y e r   QeQ  M a i n D i r e c t o r y   b  C o m m u n i t y   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 1   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 1 - 0 1 - 1 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P u b l i c S e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e 
 
 
 
 @ M a i n D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - h  M a i n D i r e c t o r y   /   C o m m u n i t y   v  M a i n D i r e c t o r y N a m e 
 
 @ B a n n e r C o n t e n t L a y e r   n t e x t 	 	 	 	 	 - - h  M a i n D i r e c t o r y   /   C o m m u n i t y   v  B a n n e r C o n t e n t L a y e r 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  9hnc  @ M a i n D i r e c t o r y N a m e   /feg  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y   hQ[\  @ B a n n e r C o n t e n t L a y e r   OX[0R  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y   h	|~v  M a i n D i r e c t o r y N a m e   /f
NO͑
Yv
N{/feg  M a i n D i r e c t o r y   ؏/f  C o m m u n i t y 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . M a i n D i r e c t o r y   W h e r e   [ N a m e ] = @ M a i n D i r e c t o r y N a m e ) 
 
 
 
 B E G I N 
 
 
 
 	 U P D A T E   d b o . M a i n D i r e c t o r y   S E T   B a n n e r C o n t e n t L a y e r = @ B a n n e r C o n t e n t L a y e r   W H E R E   [ N a m e ] = @ M a i n D i r e c t o r y N a m e 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 U P D A T E   d b o . C o m m u n i t y   S E T   B a n n e r C o n t e n t L a y e r = @ B a n n e r C o n t e n t L a y e r   W H E R E   [ N a m e ] = @ M a i n D i r e c t o r y N a m e 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P u b l i c S e t B a n n e r C o n t e n t L a y e r B y M a i n D i r e c t o r y N a m e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  R e s o u r c e s 
 
 - - = = T a g   \QYO0WOX[(W$N*NMOn1 .   R e s o u r c e s   hN  " , "    _vW[&{2N	        2 .   R e s o u r c e s T a g s     US N  T a g   N  R e s o u r c e s I D   [^  R e s o u r c e s   h	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~  S c o r e   :g6RdN(W  R e s o u r c e s   h	g  S c o r e   T  S c o r e C o u n t   U_KNYR e s o u r c e s S c o r e   h؏\OX[k N!kSbRU_R e s o u r c e I D SbRv  I P SbReRpe	k!kSbRꁨR{Qs^GW<PQYOOX[0R  R e s o u r c e s   hv  S c o r e   RSbR!kpe_NQYOOX[0R  S c o r e C o u n t   R0ُ7hZPvvv/f:NN_ԏVg*NDnvRpeNSbR!kpe
N_k!ks{
 
 - - = = |~{tXT(W  M o d i f y R e s o u r c e   -NSN:_Lv  S c o r e   Rv<PFO  S c o r e C o u n t   
NOvV:N  R e s o u r c e s . S c o r e   e/f gevVdk|~{tXTۏeQ  M o d i f y R e s o u r c e   Lubw0RvRpe_N/fQnxvNYg
N`vُ*NSbRSN
NO9evcOX[ُWYRpeO6qOc
NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 0 2 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) , 	 	 - - S_MR  R e s o u r c e   v;_
 
 @ F i l e D a t e   d a t e t i m e , 	 	 	 - - S_MR  R e s o u r c e   veNeg gT N!kO9eveg	
 
 @ D i m e n s i o n W i d t h   i n t , 	 	 	 - - S_MR  R e s o u r c e   Yg/fVGr	v;ub[^
 
 @ D i m e n s i o n H e i g h t   i n t , 	 	 	 - - S_MR  R e s o u r c e   Yg/fVGr	v;ubؚ^
 
 @ F i l e S i z e   b i g i n t , 	 	 	 	 - - S_MR  R e s o u r c e   veN:\[
 
 @ T a g   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 - - S_MR  R e s o u r c e   vh~{N  " , "   Y*Nh~{	
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  R e s o u r c e   vh
 
 @ S u m m a r y   n t e x t , 	 	 	 - - S_MR  R e s o u r c e   vi
 
 @ D e s c r i p t i o n   n t e x t , 	 	 	 - - S_MR  R e s o u r c e   vc
 
 @ H i d d e n   b i t , 	 	 	 	 - - S_MR  R e s o u r c e   /f&Tυ
 
 @ A p p r o v e d   i n t , 	 	 	 	 - - S_MR  R e s o u r c e   /f&T[8hǏ
 
 @ A p p r o v e M e s s a g e   n t e x t , 	 	 - - S_MR  R e s o u r c e   v[8ha
 
 @ S c o r e   i n t 	 	 	 	 - - S_MR  R e s o u r c e   vċR
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MR  @ L o g i c a l P a t h   [^v  R e s o u r c e s   U_  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ R e s o u r c e s I D   I N T 
 
 S E L E C T   @ R e s o u r c e s I D = r e s . [ I D ]   F R O M   d b o . R e s o u r c e s   r e s   W H E R E   r e s . L o g i c a l P a t h = @ L o g i c a l P a t h 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ]	g  S c o r e ,   S c o r e C o u n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 D E C L A R E   @ O l d S c o r e   I N T 
 
 D E C L A R E   @ O l d S c o r e C o u n t   I N T 
 
 
 
 S E L E C T   @ O l d S c o r e = r e s . S c o r e   F R O M   d b o . R e s o u r c e s   r e s   W H E R E   [ I D ] = @ R e s o u r c e s I D 
 
 S E L E C T   @ O l d S c o r e C o u n t = r e s . S c o r e C o u n t   F R O M   d b o . R e s o u r c e s   r e s   W H E R E   [ I D ] = @ R e s o u r c e s I D 
 
 
 
 I F   @ O l d S c o r e = N U L L   O R   @ O l d S c o r e   I S   N U L L 
 
 B E G I N 
 
 	 S E L E C T   @ O l d S c o r e = 0 
 
 E N D 
 
 
 
 I F   @ O l d S c o r e C o u n t = N U L L   O R   @ O l d S c o r e C o u n t   I S   N U L L 
 
 B E G I N 
 
 	 S E L E C T   @ O l d S c o r e C o u n t = 0 
 
 E N D 
 
 * / 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S c o r e C o u n t   Oc
NSSpeS	g(W(u7bSbRvePMbO/}R0Ȓُ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ S c o r e C o u n t   I N T 
 
 S E L E C T   @ S c o r e C o u n t = r e s . S c o r e C o u n t   F R O M   d b o . R e s o u r c e s   r e s   W H E R E   r e s . [ I D ] = @ R e s o u r c e s I D 
 
 
 
 I F   @ S c o r e C o u n t = N U L L   O R   @ S c o r e C o u n t   I S   N U L L 
 
 B E G I N 
 
 	 S E L E C T   @ S c o r e C o u n t = 0 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ Rd  R e s o u r c e s     -NS]~X[(WNv勇eNvU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . R e s o u r c e s   W H E R E   [ I D ] = @ R e s o u r c e s I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = c@w Rd  R e s o u r c e s T a g s     -N[^v  T a g   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . R e s o u r c e s T a g s   W H E R E   R e s o u r c e s I D = @ R e s o u r c e s I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  R e s o u r c e s   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . R e s o u r c e s ( L o g i c a l P a t h , F i l e D a t e , D i m e n s i o n W i d t h , D i m e n s i o n H e i g h t , F i l e S i z e , T a g , T i t l e , S u m m a r y , [ D e s c r i p t i o n ] , H i d d e n , A p p r o v e d , A p p r o v e M e s s a g e , A p p r o v e d B y , S c o r e , S c o r e C o u n t )   V A L U E S ( @ L o g i c a l P a t h , @ F i l e D a t e , @ D i m e n s i o n W i d t h , @ D i m e n s i o n H e i g h t , @ F i l e S i z e , @ T a g , @ T i t l e , @ S u m m a r y , @ D e s c r i p t i o n , @ H i d d e n , @ A p p r o v e d , @ A p p r o v e M e s s a g e , @ U s e r , @ S c o r e , @ S c o r e C o u n t ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o N e w I D   I N T 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  T a g   S/f ,     _vRh	ROX[(W  R e s o u r c e s T a g s   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . R e s o u r c e s T a g s ( R e s o u r c e s I D , T a g )   S E L E C T   @ o N e w I D ,   E l e m e n t   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    L o g i c a l P a t h   ԏV[^v  T a g 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 3   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 0 2 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s S e l e c t 
 
 
 
 - - @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  a s p x   z OǏegv(u7b
T
 
 
 
 @ L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) 	 	 	 	 - - c[  R e s o u r c e   v;_
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - D E C L A R E   @ o P a s s   I N T 
 
 - - E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 - - I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b  R e s o u r c e s   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 r e s . [ I D ]   A S   [ I D ] , 
 
 	 r e s . L o g i c a l P a t h   A S   L o g i c a l P a t h , 
 
 	 r e s . F i l e D a t e   A S   F i l e D a t e , 
 
 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 r e s . T a g   A S   T a g , 
 
 	 r e s . T i t l e   A S   T i t l e , 
 
 	 r e s . S u m m a r y   A S   S u m m a r y , 
 
 	 r e s . [ D e s c r i p t i o n ]   A S   [ D e s c r i p t i o n ] , 
 
 	 r e s . H i d d e n   A S   H i d d e n , 
 
 	 r e s . A p p r o v e d   A S   A p p r o v e d , 
 
 	 r e s . A p p r o v e M e s s a g e   A S   A p p r o v e M e s s a g e , 
 
 	 r e s . A p p r o v e d B y   A S   A p p r o v e d B y , 
 
 	 r e s . S c o r e   A S   S c o r e , 
 
 	 r e s . S c o r e C o u n t   A S   S c o r e C o u n t 
 
 
 
 F R O M   d b o . R e s o u r c e s   r e s 
 
 
 
 W H E R E   r e s . L o g i c a l P a t h = @ L o g i c a l P a t h 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s Q u e r y B y T a g         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s Q u e r y B y T a g ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s Q u e r y B y T a g ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  T a g   d"}  R e s o u r c e s 
 
 - - = = Sped"}  T a g   SN/feS _vY*N  T a g b(u  +   ޏcvY*NsQ.͋    eS/f b   va`RS/f v^N   va`	
 
 - - = = ^zRu:g6RHQ\ck8^g~gX[eQ N*N~g N7hFOYN N*NP a g i n g I D vhSϑ	9hncP a g i n g I D @ P a g e S i z e @ C u r r e n t P a g e 	SS_MRuvU_v^\;`upe\O:N N*NRhMOQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 0 2 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s Q u e r y B y T a g 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  a s p x   z OǏegv(u7b
T
 
 
 
 @ T a g   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 - - d"}  T a g   Y  N ' L o g o , B a n n e r '             b    N ' * '           b      N ' Ɖ+ ^JT' 	
 
 
 
 @ S e a r c h D i r e c t o r y   n v a r c h a r ( 2 0 0 0 ) , 	 - - NT*NvU_Nd"}    l(W(u  S P   e:N  S P   cOSpeveP@ S e a r c h D i r e c t o r y   ]~nxOS+TN gTv  " / " Y  / w r i t a b l e / r e s o u r c e /   	
 
 @ I n c l u d e S u b d i r e c t o r y   b i t , 	 	 - - d"}veP/f&TS+TN~vU_
 
 
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) , 	 	 - - c^e_  A S C ,   D E S C   la:NN|Q[  S Q L   S e r v e r   2 0 0 0 f
NO(u  O r d e r   B y   Sϑ	
 
 
 
 @ P a g e S i z e   I N T , 	 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T 	 	 	 - - ux:g6RS_MRu
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = [  @ T a g   SpeۏLYt\vQ-Nv   *    M&{bcb  % 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ T a g = R E P L A C E ( @ T a g , N ' * ' , N ' % ' ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	l2 0 1 0 - 0 7 - 1 2 1uN_eQN  R e s o u r c e   R e f e r e n c e   :g6RVdks(W
NQP6R  S P   vCgPV:N(W  R e s o u r c e   R e f e r e n c e   -N_SSunfvub_(u  R e s o u r c e   v`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - D E C L A R E   @ o P a s s   I N T 
 
 - - E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 - - I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^Ruh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   N O C O U N T   O N 
 
 
 
 D E C L A R E   @ P a g i n g   T A B L E 
 
 (   
 
 	 P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   
 
 	 [ I D ]   i n t ,   
 
 	 L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 [ F i l e N a m e ]   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 F i l e D a t e   d a t e t i m e , 
 
 	 D i m e n s i o n W i d t h   i n t , 
 
 	 D i m e n s i o n H e i g h t   i n t , 
 
 	 F i l e S i z e   b i g i n t , 
 
 	 T a g   n v a r c h a r ( 1 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 T i t l e   n v a r c h a r ( 2 0 0 )     C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 S u m m a r y   n v a r c h a r ( 4 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 [ D e s c r i p t i o n ]   n v a r c h a r ( 4 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 H i d d e n   b i t , 
 
 	 A p p r o v e d   i n t , 
 
 	 A p p r o v e M e s s a g e   n v a r c h a r ( 4 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 A p p r o v e d B y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 S c o r e   i n t , 
 
 	 S c o r e C o u n t   i n t 
 
   )   
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hgw  R e s o u r c e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ R e s o u r c e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ R e s o u r c e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' R e s o u r c e A p p r o v e ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spe  @ O r d e r B y   T  @ O r d e r B y O r d e r   RYS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ O r d e r B y = N ' '   O R   @ O r d e r B y = N U L L   O R   @ O r d e r B y   I S   N U L L 
 
 
 
 B E G I N 
 
 	 S E L E C T   @ O r d e r B y = N ' F i l e D a t e ' 
 
 E N D 
 
 
 
 I F   @ O r d e r B y O r d e r = N ' '   O R   @ O r d e r B y O r d e r = N U L L   O R   @ O r d e r B y O r d e r   I S   N U L L 
 
 
 
 B E G I N 
 
 	 S E L E C T   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = kXEQRuh  R  @ I n c l u d e S u b d i r e c t o r y = 1 / 0   $Ny`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ I n c l u d e S u b d i r e c t o r y = 1 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 9hncS_MR(u7b҉rR$Ny`Q  |~{tXTԏVhQ^|~{tXTSԏV  H i d d e n = f a l s e   NS  A p p r o v e d = 1   vyv	
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = d"}
0S+T0N~vU_  |     S_MR(u7b
0/f0  A d m i n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - 
NTv  O r d e r B y   T  O r d e r B y O r d e r     NN  6   kNx/U Nv:S+R/f    O r d e r   B y   NS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 	 	 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 	 	 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 	 	 
 
 	 	 O R D E R   B Y   r e s . S c o r e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 	 	 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 	 	 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 	 	 
 
 	 	 O R D E R   B Y   r e s . S c o r e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = d"}
0S+T0N~vU_  |     S_MR(u7b
0
N/f0  A d m i n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - 
NTv  O r d e r B y   T  O r d e r B y O r d e r     NN  6   kNx/U Nv:S+R/f    O r d e r   B y   NS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   r e s . S c o r e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   r e s . S c o r e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 9hncS_MR(u7b҉rR$Ny`Q  |~{tXTԏVhQ^|~{tXTSԏV  H i d d e n = f a l s e   NS  A p p r o v e d = 1   vyv	
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = d"}
0
N0S+TN~vU_  |     S_MR(u7b
0/f0  A d m i n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - 
NTv  O r d e r B y   T  O r d e r B y O r d e r     NN  6   kNx/U Nv:S+R/f    O r d e r   B y   NS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 	 	 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 	 	 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 	 	 
 
 	 	 O R D E R   B Y   r e s . S c o r e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 	 	 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 	 	 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 	 	 
 
 	 	 O R D E R   B Y   r e s . S c o r e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = d"}
0
N0S+TN~vU_  |     S_MR(u7b
0
N/f0A d m i n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - 
NTv  O r d e r B y   T  O r d e r B y O r d e r     NN  6   kNx/U Nv:S+R/f    O r d e r   B y   NS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   r e s . S c o r e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 L E F T   J O I N   d b o . R e s o u r c e s T a g s   r e s t   O N   r e s t . R e s o u r c e s I D = r e s . [ I D ] 
 
 	 	 L E F T   J O I N   ( S e l e c t   [ E l e m e n t ]   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) )   s t   O N   ( R T R I M ( L T R I M ( I S N U L L ( r e s t . T a g , N ' ' ) ) )   L i k e   ( N ' % '   +   R T R I M ( L T R I M ( s t . [ E l e m e n t ] ) )   +   N ' % ' ) )   O R   ( d b o . U D F _ P u b l i c L i s t S t r i c t M a t c h ( s t . [ E l e m e n t ] , N ' + ' , r e s . T a g , N ' , ' ) = 1 ) 	 	 
 
 	 	 W H E R E   s t . [ E l e m e n t ]   I S   N O T   N U L L   A N D   s t . [ E l e m e n t ] < > N ' '   A N D   C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0   A N D   r e s . H i d d e n < > 1   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 	 	 
 
 	 	 O R D E R   B Y   r e s . S c o r e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 S E L E C T   
 
 	 * , 
 
 	 P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) )   
 
 
 
 F R O M   @ P a g i n g 
 
 
 
 W H E R E   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s Q u e r y B y T a g ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  R e s o u r c e s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) 	 	 - - S_MR  R e s o u r c e   v;_
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  R e s o u r c e s   -NvU_  R e s o u r c e s   h
N	g  T r i g g e r  Rd  R e s o u r c e s   U_TOKN Rd  R e s o u r c e s T a g s   h-N[^U_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . R e s o u r c e s   W H E R E   L o g i c a l P a t h = @ L o g i c a l P a t h 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s M o v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s M o v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s M o v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = yR  R e s o u r c e s 
 
 - - = = \  R e s o u r c e s   h-N  O l d L o g i c a l P a t h   [^vU_O9e:N  N e w L o g i c a l P a t h 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s M o v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ O l d L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) , 	 	 - - e  R e s o u r c e   U_v;_
 
 @ N e w L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) 	 	 - - e  R e s o u r c e   U_v;_
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \e  L o g i c a l P a t h   O9e:Ne  L o g i c a l P a t h 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . R e s o u r c e s   S E T   L o g i c a l P a t h = @ N e w L o g i c a l P a t h   W H E R E   L o g i c a l P a t h = @ O l d L o g i c a l P a t h 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s M o v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s C o p y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s C o p y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s C o p y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 
Y6R  R e s o u r c e s 
 
 - - = = T a g   \QYO0WOX[(W$N*NMOn1 .   R e s o u r c e s   hN  " , "    _vW[&{2N	        2 .   R e s o u r c e s T a g s     US N  T a g   N  R e s o u r c e s I D   [^  R e s o u r c e s   h	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 0 2 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s C o p y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S o u r c e L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) , 	 - - n  R e s o u r c e s 
 
 @ T a r g e t L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) 	 - - vh  R e s o u r c e s 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 
Y6R  R e s o u r c e s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F i l e D a t e   d a t e t i m e 
 
 D E C L A R E   @ D i m e n s i o n W i d t h   i n t 
 
 D E C L A R E   @ D i m e n s i o n H e i g h t   i n t 
 
 D E C L A R E   @ F i l e S i z e   b i g i n t 
 
 D E C L A R E   @ T a g   n v a r c h a r ( 1 0 0 0 ) 
 
 D E C L A R E   @ T i t l e   n v a r c h a r ( 2 0 0 ) 
 
 D E C L A R E   @ S u m m a r y   n v a r c h a r ( 4 0 0 0 ) 
 
 D E C L A R E   @ D e s c r i p t i o n   n v a r c h a r ( 4 0 0 0 ) 
 
 D E C L A R E   @ H i d d e n   b i t 
 
 D E C L A R E   @ A p p r o v e d   i n t 
 
 D E C L A R E   @ A p p r o v e M e s s a g e   n v a r c h a r ( 4 0 0 0 ) 
 
 D E C L A R E   @ A p p r o v e d B y   n v a r c h a r ( 5 0 ) 
 
 D E C L A R E   @ S c o r e   i n t 
 
 D E C L A R E   @ S c o r e C o u n t   i n t 
 
 
 
 S E L E C T   
 
 	 
 
 	 @ F i l e D a t e = r e s . F i l e D a t e , 
 
 	 @ D i m e n s i o n W i d t h = r e s . D i m e n s i o n W i d t h , 
 
 	 @ D i m e n s i o n H e i g h t = r e s . D i m e n s i o n H e i g h t , 
 
 	 @ F i l e S i z e = r e s . F i l e S i z e , 
 
 	 @ T a g = r e s . T a g , 
 
 	 @ T i t l e = r e s . T i t l e , 
 
 	 @ S u m m a r y = C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y ) , 
 
 	 @ D e s c r i p t i o n = C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] ) , 
 
 	 @ H i d d e n = r e s . H i d d e n , 
 
 	 @ A p p r o v e d = r e s . A p p r o v e d , 
 
 	 @ A p p r o v e M e s s a g e = C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e ) , 
 
 	 @ A p p r o v e d B y = r e s . A p p r o v e d B y , 
 
 	 @ S c o r e = r e s . S c o r e , 
 
 	 @ S c o r e C o u n t = r e s . S c o r e C o u n t   
 
 
 
 F R O M   d b o . R e s o u r c e s   r e s   
 
 W H E R E   r e s . L o g i c a l P a t h = @ S o u r c e L o g i c a l P a t h 
 
 
 
 I N S E R T   I N T O   d b o . R e s o u r c e s   ( L o g i c a l P a t h , F i l e D a t e , D i m e n s i o n W i d t h , D i m e n s i o n H e i g h t , F i l e S i z e , T a g , T i t l e , S u m m a r y , [ D e s c r i p t i o n ] , H i d d e n , A p p r o v e d , A p p r o v e M e s s a g e , A p p r o v e d B y , S c o r e , S c o r e C o u n t )   V A L U E S   ( @ T a r g e t L o g i c a l P a t h , @ F i l e D a t e , @ D i m e n s i o n W i d t h , @ D i m e n s i o n H e i g h t , @ F i l e S i z e , @ T a g , @ T i t l e , @ S u m m a r y , @ D e s c r i p t i o n , @ H i d d e n , @ A p p r o v e d , @ A p p r o v e M e s s a g e , @ A p p r o v e d B y , @ S c o r e , @ S c o r e C o u n t ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o N e w I D   I N T 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  T a g   S/f ,     _vRh	ROX[(W  R e s o u r c e s T a g s   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . R e s o u r c e s T a g s ( R e s o u r c e s I D , T a g )   S E L E C T   @ o N e w I D ,   E l e m e n t   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s C o p y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r G r o u p S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r G r o u p S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r G r o u p S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  U s e r G r o u p 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r G r o u p S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR{vU_(u7b
TCgP	
 
 
 
 @ G r o u p N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MR~
T
 
 @ R e g i s t e r D e f a u l t   i n t , 	 	 	 	 - - /f&TlQ(u7b؞~1 / 2 	
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spenm
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ G r o u p N a m e = L T R I M ( R T R I M ( @ G r o u p N a m e ) ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spehg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ G r o u p N a m e = N ' ' )   O R   ( @ G r o u p N a m e   I S   N U L L ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' ~
T
N:Nzz0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg~]~X[(WR>N
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   u g . [ I D ]   f r o m   d b o . U s e r G r o u p   u g   W h e r e   u g . G r o u p N a m e = @ G r o u p N a m e ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' ~]~X[(W0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  U s e r G r o u p 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . U s e r G r o u p   ( G r o u p N a m e , R e g i s t e r D e f a u l t )   V A L U E S   ( @ G r o u p N a m e , @ R e g i s t e r D e f a u l t ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e s s i o n   Qv,gh	
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r G r o u p S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r G r o u p s S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r G r o u p s S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r G r o u p s S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  U s e r G r o u p s 
 
 - - = = :NNHNUSrOX[  U s e r G r o u p s   
N/f(W  U s e r G r o u p S a v e   -NvcO(u  " a b c , e f t , x y z "    N{|vW[&{2N O  G r o u p M e m b e r s   vcOX[V:NQ(u7bϑ^'Yv`b_YgO(uW[&{2N O@b	g  G r o u p M e m b e r s   Rh_{(u0R  U D F _ P u b l i c S p l i t ( )   QpeQpeveQSpe	g  4 0 0 0   W[&{P6R0
 
 - - = = ,g  S P   S'Yϑ(uVdk_{OvQ'`0
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r G r o u p s S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR{vU_(u7b
TCgP	
 
 
 
 @ U s e r G r o u p I D   i n t , 	 	 	 	 - - ~  I D 
 
 @ G r o u p M e m b e r   n v a r c h a r ( 5 0 ) 	 	 	 - - bXT
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  U s e r G r o u p s   U_  la,g  S P   S'Yϑ(uVdk_{OvQ'`Vdkُ̑v^
NhgS_g  U s e r G r o u p   N/f&T]~OX[ǏS_MR  M e m b e r vSbN(W  U s e r G r o u p S a v e   ̑[  U s e r G r o u p s   h-Nv  M e m b e r   \O NntHQ	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . U s e r G r o u p s   ( U s e r G r o u p I D , [ U s e r ] )   V A L U E S   ( @ U s e r G r o u p I D , @ G r o u p M e m b e r ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r G r o u p s S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r G r o u p M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r G r o u p M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r G r o u p M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  U s e r G r o u p 
 
 - - = = O9e  U s e r G r o u p   TbN \  U s e r G r o u p s   N[^v  M e m b e r   hQ RdV:N(WЏL  S P   U s e r G r o u p M o d i f y     v:WT_6qOߍ@w'Yϑ  S P   U s e r G r o u p s S a v e   vЏLNOX[ev  M e m b e r   `QVdk\ev  M e m b e r   [ Rd/f^勄v0
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r G r o u p M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR{vU_(u7b
TCgP	
 
 
 
 @ I D   i n t , 	 	 	 	 	 	 - - O9e~v  I D 
 
 @ G r o u p N a m e   n v a r c h a r ( 5 0 ) , 	 	 	 - - e~
T
 
 @ R e g i s t e r D e f a u l t   i n t 	 	 	 	 - - /f&TlQ(u7b؞~1 / 2 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spenm
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ G r o u p N a m e = L T R I M ( R T R I M ( @ G r o u p N a m e ) ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spehg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ G r o u p N a m e = N ' ' )   O R   ( @ G r o u p N a m e   I S   N U L L ) 
 
 B E G I N 
 
 	 R A I S E R R O R ( N ' ~
T
N:Nzz0' , 1 6 , 1 ) 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  U s e r G r o u p 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . U s e r G r o u p   S E T   G r o u p N a m e = @ G r o u p N a m e ,   R e g i s t e r D e f a u l t = @ R e g i s t e r D e f a u l t     W H E R E   [ I D ] = @ I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd[^v  U s e r G r o u p s   U_  (W  U s e r G r o u p S a v e   c s   -NOQ!kOX[ev  G r o u p   bXTh	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . U s e r G r o u p s   W H E R E   U s e r G r o u p I D = @ I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r G r o u p M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r G r o u p S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r G r o u p S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r G r o u p S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV@b	g  U s e r G r o u p   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r G r o u p S e l e c t 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 S E L E C T   
 
 	 [ I D ] , 
 
 	 G r o u p N a m e , 
 
 	 R e g i s t e r D e f a u l t 
 
 
 
 F R O M   d b o . U s e r G r o u p   O R D E R   B Y   G r o u p N a m e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r G r o u p S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r G r o u p s S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r G r o u p s S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r G r o u p s S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  U s e r G r o u p s   hԏVS_MR  U s e r G r o u p   [^v    m e m b e r s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r G r o u p s S e l e c t 
 
 
 
 @ U s e r G r o u p I D   i n t 	 	 	 	 - - c[  U s e r G r o u p 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b  U s e r G r o u p s   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   
 
 	 u g s . [ I D ]   A S   [ I D ] , 
 
 	 u g s . U s e r G r o u p I D   A S     U s e r G r o u p I D , 
 
 	 u g s . [ U s e r ]   A S   G r o u p M e m b e r 
 
 
 
 F R O M   d b o . U s e r G r o u p s   u g s 
 
 
 
 W H E R E   u g s . U s e r G r o u p I D = @ U s e r G r o u p I D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r G r o u p s S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r G r o u p D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r G r o u p D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r G r o u p D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd(u7b~    U s e r G r o u p   -NO(uN  T r i g g e r  Rd  U s e r G r o u p   TOꁨR Rd[^v  U s e r G r o u p s   -NvU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r G r o u p D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ I D   i n t 	 	 	 	 - - sS\ Rdv  U s e r G r o u p   v  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = CgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rd  U s e r G r o u p 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . U s e r G r o u p   W H E R E   [ I D ] = @ I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r G r o u p D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r G r o u p Q u e r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r G r o u p Q u e r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r G r o u p Q u e r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ُ*N  S P   v\O(u9hncfYv~"}g(u7b~
 
 - - = = Spe@b	gh"}~"}\O:NSpeYgSpe:NN U L L ,   Ry
NSNh"}
 
 - - = = ^zRu:g6RHQ\ck8^g~gX[eQ N*N~g N7hFOYN N*NP a g i n g I D vhSϑ	9hncP a g i n g I D @ P a g e S i z e @ C u r r e n t P a g e 	SS_MRuvU_v^\;`upe\O:N N*NRhMOQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r G r o u p Q u e r y 
 
 
 
 @ G r o u p N a m e   n v a r c h a r ( 5 0 ) , 	 - - (u7b~
 
 
 
 @ P a g e S i z e   I N T , 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T , 	 	 - - ux:g6RS_MRu
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) 	 - - c^e_  A S C ,   D E S C 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spev8YtN(WX[(WR`Sv0WeO(u	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ G r o u p N a m e = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ G r o u p N a m e ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = CgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R`gS-NSQs  U n i c o d e   W[&{kYF i r s t N a m e = ' R' 	n v a r c h a r ( ) 
NǏ4 0 0 0 Nb$N*NR`S gT؏ޏc0R Nw@bN[IN:N  n v a r c h a r ( 4 0 0 0 ) 
 
 - - = = (uR`S Q L Seg[b~( laR
NS e t   N o c o u n t   o n   md[ g~QU_Ɩvq_T) 
 
 - - = = (uegg^W h e r e NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 )             
 
 D E C L A R E   @ D y n W h e r e   N V A R C H A R ( 4 0 0 0 )   
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^Ruh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = N '   S E T   N O C O U N T   O N       ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ P a g i n g   t a b l e   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ I D ]   I N T ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ G r o u p N a m e ]   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,     ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   R e g i s t e r D e f a u l t   I N T ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   G r o u p M e m b e r s C o u n t   I N T   ' 	 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = kXEQRuh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   d i s t i n c t       '     
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u g . [ I D ]   a s   [ I D ] ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u g . G r o u p N a m e   a s   G r o u p N a m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   u g . R e g i s t e r D e f a u l t   a s   R e g i s t e r D e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   ( s e l e c t   C O U N T ( u g s . [ I D ] )   f r o m   d b o . U s e r G r o u p s   u g s   w h e r e   u g s . U s e r G r o u p I D = u g . [ I D ] )   a s   G r o u p M e m b e r s C o u n t   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . U s e r G r o u p   u g   ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = W H E R E   1 = 1   ]Y0WMQNNbR`  W H E R E   NS-Nv   A N D    
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W H E R E   1 = 1   ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = vQ[R`  W H E R E   NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n W h e r e = N ' ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ G r o u p N a m e   ~~"}I{N0 bzzW[&{h:y
NSN~P6R:   ُ̑/ec!j|~  : 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ G r o u p N a m e   I S   N O T   N U L L       
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = nczz<h  ( V:N  @ G r o u p N a m e   S:NN U L L , @bN\ndzz<hvd\O>e0Ȓُ) 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ G r o u p N a m e = R T R I M ( L T R I M ( @ G r o u p N a m e ) )   
 
 	 I F   @ G r o u p N a m e < > N ' '   
 
 	 B E G I N 
 
 	 	 I f   C H A R I N D E X   ( N ' * '   ,   @ G r o u p N a m e )   > = 1 
 
 	 	 B e g i n       s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u g . [ G r o u p N a m e ] ) )   l i k e   ' ' '   +   R E P L A C E ( @ G r o u p N a m e , N ' * ' , N ' % ' )   +   N ' ' ' '   E n d 
 
 	 	 E l s e 
 
 	 	 B e g i n       s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   R T R I M ( L T R I M ( u g . [ G r o u p N a m e ] ) ) = ' ' '   +   @ G r o u p N a m e   +   N ' ' ' '   E n d 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = MRbv  S Q L   S gTR  vQ[R`  W H E R E   NS  @ D y n S Q L   -N]~S+T  W H E R E   1 = 1 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   @ D y n W h e r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R
N  O r d e r   B y   NS
 
 - - = = Yg  O r d e r B y = ' '   RO(u:w  o r d e r   b y   N a m e   A S C 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ O r d e r B y = L T R I M ( R T R I M ( @ O r d e r B y ) ) 
 
 S E T   @ O r d e r B y O r d e r = L T R I M ( R T R I M ( @ O r d e r B y O r d e r ) ) 
 
 
 
 I F   L E N ( @ O r d e r B y ) = 0   O R     L E N ( @ O r d e r B y O r d e r ) = 0 
 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ G r o u p N a m e ]   A S C   ' 
 
 	 E N D 
 
 E L S E 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ '   +   @ O r d e r B y   +   N ' ]   '   +   @ O r d e r B y O r d e r 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e t   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   * , P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ P a g e S i z e )   +   N ' ) )   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ F i r s t R e c o r d )   +   N '   a n d   P a g i n g I D < '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgR`Sv^
NSNǏ|~
NP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s D y n S Q L   I N T 
 
 E X E C   d b o . P u b l i c D y n S Q L L e n g t h C h e c k   @ D y n S Q L , @ o P a s s D y n S Q L   O U T 
 
 I F   @ o P a s s D y n S Q L = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLR`  S Q L   S   _Y~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r G r o u p Q u e r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r U s e r G r o u p s S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r U s e r G r o u p s S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r U s e r G r o u p s S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  U s e r G r o u p s   hԏVc[(u7bv  U s e r G r o u p I D   T  G r o u p N a m e   sSc[(u7b@b^\v~	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r U s e r G r o u p s S e l e c t 
 
 
 
 @ U s e r N a m e     n v a r c h a r ( 5 0 ) 	 	 	 	 - - c[(u7b
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b  U s e r G r o u p s   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   D I S T I N C T 
 
 
 
 	 u g s . U s e r G r o u p I D   A S     U s e r G r o u p I D , 
 
 	 u g . G r o u p N a m e   A S   G r o u p N a m e 
 
 
 
 F R O M   d b o . U s e r G r o u p s   u g s 
 
 I N N E R   J O I N   d b o . U s e r G r o u p   u g   O N   u g . [ I D ] = u g s . U s e r G r o u p I D 
 
 
 
 W H E R E   u g s . [ U s e r ] = @ U s e r N a m e 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r U s e r G r o u p s S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e P e r m i s s i o n S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e P e r m i s s i o n S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e P e r m i s s i o n S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v  K n o w l e d g e D i r e c t o r y   M a i n D i r e c t o r y ,   S u b D i r e c t o r y ,   P a g e D i r e c t o r y ,   K n o w l e d g e 	  ԏVv^v  E d i t o r ,   D e d i c a t e d T o ,   C o m m e n t s P e r m i s s i o n 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e P e r m i s s i o n S e l e c t 
 
 
 
 @ U s e r   N V A R C H A R ( 5 0 ) , 	 	 	 	 - - N  A S P X    OǏegv(u7b
 
 
 
 @ K n o w l e d g e D i r e c t o r y   N V A R C H A R ( 1 0 0 ) , 	 	 - - S_MR  K n o w l e d g e D i r e c t o r y 
 
 @ P a r e n t   I N T , 	 	 	 	 	 - - S_MR  K n o w l e d g e   v  P a r e n t   I D 
 
 
 
 @ C u l t u r e   N V A R C H A R ( 5 0 ) , 	 	 	 - - c[eS
 
 
 
 @ C u r r e n t P a g e   I N T 	 	 	 	 - - ux:g6RS_MRu
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
NT  K n o w l e d g e D i r e c t o r y   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ K n o w l e d g e D i r e c t o r y = N ' M a i n D i r e c t o r y ' 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = M a i n D i r e c t o r y 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 m d . [ I D ]   A S   [ I D ] , 
 
 	 	 	 m d . S e r i a l   A S   S e r i a l , 
 
 	 	 	 m d c . H i d d e n   A S   H i d d e n , 
 
 	 	 	 m d c . H i d d e n I n N a v i g a t i o n O n l y   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 m d . E d i t o r   A S   E d i t o r , 
 
 	 	 	 m d . D e d i c a t e d T o   A S   D e d i c a t e d T o , 
 
 	 	 	 m d . C o m m e n t s P e r m i s s i o n   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 m d c . T i t l e   A S   T i t l e 
 
 
 
 	 	 F R O M   d b o . M a i n D i r e c t o r y   m d 
 
 	 	 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d c . M a i n D i r e c t o r y I D = m d . [ I D ]   A N D   m d c . C u l t u r e = @ C u l t u r e 	 	 
 
 
 
 	 	 O R D E R   B Y   S e r i a l 
 
 	 E N D 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y = N ' S u b D i r e c t o r y ' 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S u b D i r e c t o r y 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 s d . [ I D ]   A S   [ I D ] , 
 
 	 	 	 s d . S e r i a l   A S   S e r i a l , 
 
 	 	 	 s d c . H i d d e n   A S   H i d d e n , 
 
 	 	 	 s d c . H i d d e n I n N a v i g a t i o n O n l y   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 s d . O v e r v i e w   A S   O v e r v i e w , 
 
 	 	 	 s d . E d i t o r   A S   E d i t o r , 
 
 	 	 	 s d . D e d i c a t e d T o   A S   D e d i c a t e d T o , 
 
 	 	 	 s d . C o m m e n t s P e r m i s s i o n   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 s d c . T i t l e   A S   T i t l e 
 
 
 
 	 	 F R O M   d b o . S u b D i r e c t o r y   s d 
 
 	 	 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d c . S u b D i r e c t o r y I D = s d . [ I D ]   A N D   s d c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 W H E R E   s d . [ M a i n D i r e c t o r y I D ] = @ P a r e n t 
 
 
 
 	 	 O R D E R   B Y   S e r i a l 
 
 	 E N D 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y = N ' P a g e D i r e c t o r y ' 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = P a g e D i r e c t o r y 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 	 	 S E L E C T 
 
 
 
 	 	 	 p d . [ I D ]   A S   [ I D ] , 
 
 	 	 	 p d . S e r i a l   A S   S e r i a l , 
 
 	 	 	 p d c . H i d d e n   A S   H i d d e n , 
 
 	 	 	 p d c . H i d d e n I n N a v i g a t i o n O n l y   A S   H i d d e n I n N a v i g a t i o n O n l y , 
 
 	 	 	 p d . O v e r v i e w   A S   O v e r v i e w , 
 
 	 	 	 p d . E d i t o r   A S   E d i t o r , 
 
 	 	 	 p d . D e d i c a t e d T o   A S   D e d i c a t e d T o , 
 
 	 	 	 p d . C o m m e n t s P e r m i s s i o n   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 p d c . T i t l e   A S   T i t l e 
 
 
 
 	 	 F R O M   d b o . P a g e D i r e c t o r y   p d 
 
 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   O N   p d c . P a g e D i r e c t o r y I D = p d . [ I D ]   A N D   p d c . C u l t u r e = @ C u l t u r e 
 
 
 
 	 	 W H E R E   p d . [ S u b D i r e c t o r y I D ] = @ P a r e n t 
 
 
 
 	 	 O R D E R   B Y   S e r i a l 
 
 	 E N D 
 
 
 
 E L S E   
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = K n o w l e d g e 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = _S_MR  P a g e D i r e c t o r y     v  T y p e   <PYg/f  1 RbNTbv~g\O(u  O r d e r   B y   S e r i a l   nfQ[N  S e r i a l   c^	  Yg/f  2   R  O r d e r   B y   U p d a t e T i m e   WNevQ[NS^ec^	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ T y p e   I N T 
 
 	 	 S E L E C T   @ T y p e = T y p e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ I D ] = @ P a r e n t 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = _  @ P a g e D i r e c t o r y N a m e     @b(Wv  P a g e D i r e c t o r y   U_-Nv  P a g e S i z e   <P
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ P a g e S i z e   I N T 
 
 	 	 S E L E C T   T O P   1   @ P a g e S i z e = P a g e S i z e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ I D ] = @ P a r e n t 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ^zRu
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ P a g i n g   T A B L E   
 
 	 	 (   
 
 	 	 	 P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   
 
 	 	 	 [ I D ]   i n t ,   
 
 	 	 	 S e r i a l   i n t , 
 
 	 	 	 H i d d e n   b i t , 
 
 	 	 	 A p p r o v e d   i n t , 
 
 	 	 	 U p d a t e T i m e   d a t e t i m e , 
 
 	 	 	 A u t h o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   	 	 
 
 	 	 	 E d i t o r   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 	 	 D e d i c a t e d T o   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 	 	 C o m m e n t s P e r m i s s i o n   n t e x t   C O L L A T E   d a t a b a s e _ d e f a u l t , 	 	 	 
 
 	 	 	 T i t l e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 	 	 P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t 
 
 	 	 )   
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = 9hnc  @ T y p e   
NT	c  S e r i a l   T  U p d a t e T i m e   c^
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ T y p e = 1 
 
 
 
 	 	 B E G I N 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 n o w c . H i d d e n   A S   H i d d e n , 
 
 	 	 	 	 n o w c . A p p r o v e d   A S   A p p r o v e d , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 n o w . D e d i c a t e d T o   A S   D e d i c a t e d T o , 
 
 	 	 	 	 n o w . C o m m e n t s P e r m i s s i o n   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 p d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p d   O N   p d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   n o w . [ P a g e D i r e c t o r y I D ] = @ P a r e n t 
 
 
 
 	 	 	 O R D E R   B Y   S e r i a l 
 
 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 B E G I N 
 
 	 	 	 I N S E R T   I N T O   @ P a g i n g 
 
 	 
 
 	 	 	 S E L E C T 
 
 	 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 	 n o w c . H i d d e n   A S   H i d d e n , 
 
 	 	 	 	 n o w c . A p p r o v e d   A S   A p p r o v e d , 
 
 	 	 	 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 	 	 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 	 	 	 n o w . E d i t o r   A S   E d i t o r , 
 
 	 	 	 	 n o w . D e d i c a t e d T o   A S   D e d i c a t e d T o , 
 
 	 	 	 	 n o w . C o m m e n t s P e r m i s s i o n   A S   C o m m e n t s P e r m i s s i o n , 
 
 	 	 	 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 	 	 	 p d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e 
 
 	 
 
 	 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p d   O N   p d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 	 W H E R E   n o w . [ P a g e D i r e c t o r y I D ] = @ P a r e n t 
 
 
 
 	 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 	 	 E N D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  gTN  @ P a g i n g   hSϑ-NSS_MRu,{ N*NT gT N*NU_vMOn
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ F i r s t R e c o r d   i n t 
 
 	 	 D E C L A R E   @ L a s t R e c o r d   i n t 
 
 	 	 	 	 
 
 	 	 S E T   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 
 
 	 	 S E T   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ԏVS_MRu-NvU_
 
 	 	 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 S E L E C T   	 
 
 	 	 	 * , 
 
 	 	 	 P a g e C o u n t = C E I L I N G ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) )   
 
 	 	 
 
 	 	 F R O M   @ P a g i n g   
 
 	 	 W H E R E   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e P e r m i s s i o n S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e A p p r o v e Q u e r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e A p p r o v e Q u e r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e A p p r o v e Q u e r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ُ*N  S P   v\O(uSS_MR(u7bE d m i n   E d i t o r 	CgPNvQ[[8hRh  
 
 - - = = [g*NQ[b	g
N~CgPv(u7bsSb	gg*NQ[
N~P a g e D i r e c t o r y ,   S u b D i r e c t o r y ,   M a i n D i r e c t o r y 	CgPNS  C h i e f E d i t o r ,   A d m i n   CgPv(u7b
 
 - - = = ^zRu:g6RHQ\ck8^g~gX[eQ N*N~g N7hFOYN N*NP a g i n g I D vhSϑ	9hncP a g i n g I D @ P a g e S i z e @ C u r r e n t P a g e 	SS_MRuvU_v^\;`upe\O:N N*NRhMOQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 8   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e A p p r o v e Q u e r y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z Oegv(u7b
 
 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) , 	 	 	 - - SԏVc[y
 
 @ A p p r o v e Q u e r y F l a g   i n t , 	 	 	 - - g   _[8h  |     ][8h  |     bv[8h       R+RS<P    0 1 2 	
 
 
 
 @ P a g e S i z e   I N T , 	 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T , 	 	 	 - - ux:g6RS_MRu
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) 	 	 - - c^e_  A S C ,   D E S C 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = CgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (uegg^  W h e r e   NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 )         
 
 D E C L A R E   @ D y n W h e r e   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^Ruh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = N '   S E T   N O C O U N T   O N       ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ P a g i n g   t a b l e   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ I D ]   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   K n o w l e d g e I D   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   U p d a t e T i m e   d a t e t i m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T i t l e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   B r e a d c r u m b   n v a r c h a r ( 1 5 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C u l t u r e   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   H i d d e n   b i t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A p p r o v e d   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A p p r o v e d B y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A u t h o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   E d i t o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g e D i r e c t o r y E d i t o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S u b D i r e c t o r y E d i t o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   M a i n D i r e c t o r y E d i t o r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = kXEQRuh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t         '     
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w c . [ I D ]   a s   [ I D ] ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w . [ I D ]   a s   K n o w l e d g e I D ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w . U p d a t e T i m e   a s   U p d a t e T i m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C a s e   n o w c . T i t l e   W h e n   N u l l   T h e n   N ' ' N o   T i t l e ' '   W h e n   N ' ' ' '   T h e n   N ' ' N o   T i t l e ' '   E l s e   n o w c . T i t l e   E n d   a s   T i t l e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   ( m d c . T i t l e   +   N ' '   - >   ' '   +   s d c . T i t l e   +   N ' '   - >   ' '   +   p d c . T i t l e )   a s   B r e a d c r u m b ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w c . C u l t u r e   a s   C u l t u r e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I S N U L L ( n o w c . H i d d e n , 0 )   a s   H i d d e n ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I S N U L L ( n o w c . A p p r o v e d , 0 )   a s   A p p r o v e d ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I S N U L L ( n o w c . A p p r o v e d B y , N ' ' ' ' )   a s   A p p r o v e d B y ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w . A u t h o r   a s   A u t h o r ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C a s e   w h e n   ( n o w . E d i t o r   i s   n o t   n u l l   a n d   c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) < > N ' ' ' ' )   t h e n   n o w . E d i t o r   w h e n   ( ( n o w . E d i t o r   i s   n u l l   o r   c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , n o w . E d i t o r ) = N ' ' ' ' )   a n d   ( s d . E d i t o r   i s   n o t   n u l l   a n d   c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , s d . E d i t o r ) < > N ' ' ' ' ) )   t h e n   s d . E d i t o r     E n d   a s   E d i t o r ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   p d . E d i t o r   a s   P a g e D i r e c t o r y E d i t o r ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   s d . E d i t o r   a s   S u b D i r e c t o r y E d i t o r ,   ' 
 
 - - S E T   @ D y n S Q L = @ D y n S Q L   +   N '   m d . E d i t o r   a s   M a i n D i r e c t o r y E d i t o r ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   p d . [ N a m e ]   a s   P a g e D i r e c t o r y N a m e   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . K n o w l e d g e C o n t e n t   n o w c   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . K n o w l e d g e   n o w   o n   n o w . [ I D ] = n o w c . K n o w l e d g e I D   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . P a g e D i r e c t o r y   p d   o n   p d . [ I D ] = n o w . P a g e D i r e c t o r y I D   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . P a g e D i r e c t o r y C o n t e n t   p d c   o n   p d . [ I D ] = p d c . P a g e D i r e c t o r y I D   A n d   p d c . C u l t u r e = n o w c . C u l t u r e   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . S u b D i r e c t o r y   s d   o n   s d . [ I D ] = p d . S u b D i r e c t o r y I D   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . S u b D i r e c t o r y C o n t e n t   s d c   o n   s d . [ I D ] = s d c . S u b D i r e c t o r y I D   A n d   s d c . C u l t u r e = n o w c . C u l t u r e   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . M a i n D i r e c t o r y   m d   o n   m d . [ I D ] = s d . M a i n D i r e c t o r y I D   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   o n   m d . [ I D ] = m d c . M a i n D i r e c t o r y I D   A n d   m d c . C u l t u r e = n o w c . C u l t u r e   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ A p p r o v e Q u e r y F l a g =   0 / 1 / 2   O(u
NTvagN    0   -   _[8h      1 -   ][8h      2   -   bv[8h	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ A p p r o v e Q u e r y F l a g C l a u s e   N V A R C H A R ( 1 0 0 0 ) 
 
 
 
 I F   @ A p p r o v e Q u e r y F l a g = 1 
 
 	 
 
 	 B E G I N 
 
 	 	 S E T   @ A p p r o v e Q u e r y F l a g C l a u s e = N '     n o w c . A p p r o v e d = 1     ' 
 
 	 E N D 
 
 
 
 E L S E   I F   @ A p p r o v e Q u e r y F l a g = 2 
 
 	 
 
 	 B E G I N 
 
 	 	 S E T   @ A p p r o v e Q u e r y F l a g C l a u s e = N '     n o w c . A p p r o v e d = 1   A N D   n o w c . A p p r o v e d B y = N ' ' '   +   @ U s e r   +   N ' ' '     ' 
 
 	 E N D 
 
 E L S E 
 
 	 
 
 	 B E G I N 
 
 	 	 S E T   @ A p p r o v e Q u e r y F l a g C l a u s e = N '     n o w c . A p p r o v e d < > 1     ' 	 	 
 
 	 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hncS_MR(u7bvCgPO(u
NTagN
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1   o r   d b o . U D F _ U s e r C h i e f E d i t o r ( @ U s e r ) = 1 ) 
 
 
 
 	 B E G I N 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '     W H E R E   '   +   @ A p p r o v e Q u e r y F l a g C l a u s e   +   N '   A N D   n o w c . C u l t u r e = N ' ' '   +   @ C u l t u r e   +   N ' ' '     ' 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '     W H E R E   ( d b o . U D F _ E d i t o r D e d i c a t e d T o ( N ' ' '   +   @ U s e r   +   N ' ' ' , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , p d . E d i t o r ) ) = 1   o r   d b o . U D F _ E d i t o r D e d i c a t e d T o ( N ' ' '   +   @ U s e r   +   N ' ' ' , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , s d . E d i t o r ) ) = 1   o r   d b o . U D F _ E d i t o r D e d i c a t e d T o ( N ' ' '   +   @ U s e r   +   N ' ' ' , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , m d . E d i t o r ) ) = 1 )   A n d   '   +     @ A p p r o v e Q u e r y F l a g C l a u s e   +   N '   A n d   n o w c . C u l t u r e = N ' ' '   +   @ C u l t u r e   +   N ' ' '     ' 
 
 	 E N D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R
N  O r d e r   B y   NS
 
 - - = = Yg  O r d e r B y = ' '   RO(u:w  o r d e r   b y   U p d a t e T i m e   D E S C 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ O r d e r B y = L T R I M ( R T R I M ( @ O r d e r B y ) ) 
 
 S E T   @ O r d e r B y O r d e r = L T R I M ( R T R I M ( @ O r d e r B y O r d e r ) ) 
 
 	 	 
 
 I F   L E N ( @ O r d e r B y ) = 0   O R     L E N ( @ O r d e r B y O r d e r ) = 0 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   U p d a t e T i m e   D E S C   ' 
 
 	 E N D 
 
 E L S E 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ '   +   @ O r d e r B y   +   N ' ]   '   +   @ O r d e r B y O r d e r 
 
 	 E N D 
 
 	 	 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e t   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   * , P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ P a g e S i z e )   +   N ' ) )   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ F i r s t R e c o r d )   +   N '   a n d   P a g i n g I D < '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgR`Sv^
NSNǏ|~
NP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s D y n S Q L   I N T 
 
 E X E C   d b o . P u b l i c D y n S Q L L e n g t h C h e c k   @ D y n S Q L , @ o P a s s D y n S Q L   O U T 
 
 I F   @ o P a s s D y n S Q L = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLR`  S Q L   S   _Y~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e A p p r o v e Q u e r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e A p p r o v e S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e A p p r o v e S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e A p p r o v e S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc~[v    K n o w l e d g e C o n t e n t   I D   N  _  K n o w l e d g e C o n t e n t   h-NNQ[[8h	gsQvOo`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e A p p r o v e S e l e c t 
 
 
 
 @ K n o w l e d g e C o n t e n t I D   I N T 	 	 	 	 - - K n o w l e d g e C o n t e n t   U_  I D 
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
 	 n o w c . [ I D ]   A S   [ I D ] , 
 
 	 n o w c . K n o w l e d g e I D   A S   K n o w l e d g e I D , 
 
 	 n o w c . C u l t u r e   A S   C u l t u r e , 
 
 	 n o w . A u t h o r   A S   A u t h o r , 
 
 	 ( S e l e c t   T o p   1   u s . E m a i l   F r o m   d b o . U s e r s   u s   W h e r e   u s . [ N a m e ] = n o w . A u t h o r )   A S   A u t h o r E m a i l , 
 
 	 n o w . U p d a t e T i m e   A S   U p d a t e T i m e , 
 
 	 n o w c . T i t l e   A S   T i t l e , 
 
 	 n o w c . H i d d e n   A S   H i d d e n , 
 
 	 n o w c . A p p r o v e d   A S   A p p r o v e d , 
 
 	 n o w c . A p p r o v e M e s s a g e   A S   A p p r o v e M e s s a g e , 
 
 	 n o w c . A p p r o v e d B y   A S   A p p r o v e d B y , 
 
 	 
 
 	 p d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e 
 
 
 
 F R O M   d b o . K n o w l e d g e C o n t e n t   n o w c 
 
 L E F T   J O I N   d b o . K n o w l e d g e   n o w   O N   n o w . [ I D ] = n o w c . K n o w l e d g e I D 
 
 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p d   O N   p d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 
 
 W H E R E   n o w c . [ I D ] = @ K n o w l e d g e C o n t e n t I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e A p p r o v e S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e A p p r o v e S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e A p p r o v e S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e A p p r o v e S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[Q[[8hOo`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 8 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e A p p r o v e S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ K n o w l e d g e C o n t e n t I D   i n t , 	 	 - - S_MR  K n o w l e d g e   C o n t e n t   v  I D 
 
 
 
 @ H i d d e n   b i t , 	 	 	 	 - - /f&Tυ  N ' t r u e '     /     N ' f a l s e ' 	
 
 @ A p p r o v e d   i n t , 	 	 	 	 - - /f&T[8hǏ  0   /   1 	
 
 @ A p p r o v e M e s s a g e   n t e x t 	 	 - - [8ha
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ K n o w l e d g e I D   _  P a g e D i r e c t o r y I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ P a g e D i r e c t o r y I D   I N T 
 
 S E L E C T   @ P a g e D i r e c t o r y I D = n o w . P a g e D i r e c t o r y I D   F R O M   d b o . K n o w l e d g e   n o w   W H E R E   n o w . [ I D ] = ( S e l e c t   n o w c . K n o w l e d g e I D   F r o m   d b o . K n o w l e d g e C o n t e n t   n o w c   W h e r e   n o w c . [ I D ] = @ K n o w l e d g e C o n t e n t I D ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' P a g e D i r e c t o r y ' , @ P a g e D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  K n o w l e d g e C o n t e n t   hO9e[8hOo`NS  H i d d e n   Oo`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . K n o w l e d g e C o n t e n t   S E T   H i d d e n = @ H i d d e n ,   A p p r o v e d = @ A p p r o v e d ,   A p p r o v e M e s s a g e = @ A p p r o v e M e s s a g e ,   A p p r o v e d B y = @ U s e r   W H E R E   [ I D ] = @ K n o w l e d g e C o n t e n t I D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e A p p r o v e S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . X T o o l O p t i o n A d d         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ X T o o l O p t i o n A d d ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ X T o o l O p t i o n A d d ] 
 
 G O 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~]wQ  -   ]wQ(ueg:N  O p t i o n   heEQ  K e y   /   V a l u e   
 
 - - = = kYbN`(W  O p t i o n   hv  L o g o   C a t   -NXR N*Nyvُ*NeyvvS:N  8   sS\Segv  8   NS  8   Tbvy_T$c N*Npe	
 
 - - = = TebN؏NT7hvSt[  O p t i o n C o n t e n t   hۏLYt
 
 - - = = ]wQS(uN|~S(uN _SrGS~ g~(u7b
NSNO(u]wQۏLNUOd\O
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . X T o o l O p t i o n A d d 
 
 
 
 @ I D   i n t , 	 	 	 	 	 	 - - eX  O p t i o n   v  I D 
 
 @ C a t   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - eX  O p t i o n   v  C a t 
 
 @ R i g h t I n d e n t   I N T , 	 	 	 	 - - eX  O p t i o n   v  R i g h t I n d e n t   ^\'`؞:N  0 	
 
 @ K e y   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - eX  O p t i o n   v  K e y 
 
 @ V a l u e   n t e x t , 	 	 	 	 	 - - eX  O p t i o n   v  V a l u e 
 
 - - @ V a l u e   n v a r c h a r ( 3 0 0 0 ) , 	 	 	 - - eX  O p t i o n   v  V a l u e 
 
 @ L e g e n d   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - eX  O p t i o n   v  L e g e n d 
 
 @ N u m b e r O n l y   n v a r c h a r ( 5 0 ) , 	 	 	 - - /f&TSeQpeW[
 
 @ T e x t A r e a   n v a r c h a r ( 5 0 ) , 	 	 	 - - /f&T  T e x t A r e a   N
 
 @ M u l t i C u l t u r e   n v a r c h a r ( 5 0 ) , 	 	 	 - - /f&TYyN
 
 @ F o r T h e m e   n v a r c h a r ( 5 0 ) , 	 	 	 - - /f&T(uN;N
 
 @ V a l i d a t i o n   n v a r c h a r ( 5 0 ) , 	 	 	 - - /f`7hv  V a l i d a t i o n   [IN  C / L 	
 
 @ C u l t u r e s   I N T 	 	 	 	 	 - - 	gY\*Ny
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgSpe  @ I D = 0   Rvc Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ I D = 0 
 
 B E G I N 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  O p t i o n   hTbmRe~U_I D   O(u  - 1 	bN gTQtevQ  I D   OKNte0R^(WvMOn	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . [ O p t i o n ] 
 
 ( 
 
 	 [ I D ] , 
 
 	 [ C a t ] , 
 
 	 [ R i g h t I n d e n t ] , 
 
 	 [ K e y ] , 
 
 	 [ V a l u e ] , 
 
 	 [ L e g e n d ] , 
 
 	 [ N u m b e r O n l y ] , 
 
 	 [ T e x t A r e a ] , 
 
 	 [ M u l t i C u l t u r e ] , 
 
 	 [ F o r T h e m e ] , 
 
 	 [ V a l i d a t i o n ] 
 
 ) 
 
 
 
 V A L U E S       
 
 
 
 ( 
 
 	 - 1 , 
 
 	 @ C a t , 
 
 	 @ R i g h t I n d e n t , 
 
 	 @ K e y , 
 
 	 @ V a l u e , 
 
 	 @ L e g e n d , 
 
 	 @ N u m b e r O n l y , 
 
 	 @ T e x t A r e a , 
 
 	 @ M u l t i C u l t u r e , 
 
 	 @ F o r T h e m e , 
 
 	 @ V a l i d a t i o n 
 
 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \~[  @ I D   MOnKNT+T  @ I D 	v@b	gU_v  I D + + 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n ]   S E T   [ I D ] = [ I D ] + 1   W H E R E   [ I D ] > = @ I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gT\eXvag  O p t i o n   U_vQ  I D   :N  - 1 	v  I D   O9e:Ncknxv  I D   @ I D 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n ]   S E T   [ I D ] = @ I D   W H E R E   [ I D ] = - 1   
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  O p t i o n C o n t e n t   hmR  @ C u l t u r e s   *N  O p t i o n C o n t e n t   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u l t u r e C o u n t e r   I N T 
 
 S E T   @ C u l t u r e C o u n t e r = 1 
 
 
 
 W H I L E   @ C u l t u r e C o u n t e r < = @ C u l t u r e s 
 
 
 
 B E G I N 
 
 
 
 	 I N S E R T   I N T O   d b o . [ O p t i o n C o n t e n t ] 
 
 	 ( 
 
 	 	 [ I D ] , 
 
 	 	 [ O p t i o n I D ] , 
 
 	 	 [ C u l t u r e ] , 
 
 	 	 [ T i t l e ] , 
 
 	 	 [ C a t T i t l e ] , 
 
 	 	 [ D e s c r i p t i o n ] 
 
 	 ) 
 
 
 
 	 V A L U E S       
 
 
 
 	 ( 
 
 	 	 - @ C u l t u r e C o u n t e r , 
 
 	 	 - 1 , 
 
 	 	 N ' ' , 
 
 	 	 N ' ' , 
 
 	 	 N ' ' , 
 
 	 	 N ' ' 
 
 	 ) 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = @ C u l t u r e C o u n t e r + + 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ C u l t u r e C o u n t e r = @ C u l t u r e C o u n t e r + 1 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~~
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 C O N T I N U E 
 
 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  O p t i o n C o n t e n t   h-N  O p t i o n I D > = @ I D   vU_v  I D + + 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T   [ I D ] = [ I D ] + @ C u l t u r e s , O p t i o n I D = O p t i o n I D + 1   W H E R E   O p t i o n I D > = @ I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gT\  O p t i o n C o n t e n t   h-NeXv  @ C u l t u r e s   *Ne~U_v  I D   O9e:Ncknx<PُNU_@b^Yvw[MOn	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u l t u r e C o u n t e r 2   I N T 
 
 S E T   @ C u l t u r e C o u n t e r 2 = 1 
 
 
 
 W H I L E   @ C u l t u r e C o u n t e r 2 < = @ C u l t u r e s 
 
 
 
 B E G I N 
 
 
 
 	 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T   [ I D ] = ( @ I D - 1 ) * @ C u l t u r e s + @ C u l t u r e C o u n t e r 2 ,   O p t i o n I D = @ I D     W H E R E   [ I D ]   =   -   @ C u l t u r e C o u n t e r 2 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = @ C u l t u r e C o u n t e r 2 + + 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ C u l t u r e C o u n t e r 2 = @ C u l t u r e C o u n t e r 2 + 1 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~~
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 C O N T I N U E 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 / * 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _S_MR  O p t i o n     h gT NagU_v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ N e w V i r t u a l O p t i o n I D   I N T 
 
 S E L E C T   @ N e w V i r t u a l O p t i o n I D = M A X ( [ I D ] ) + 1   F R O M   d b o . [ O p t i o n ]   
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  O p t i o n   hTbR NagZbU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . [ O p t i o n ] 
 
 ( 
 
 	 [ I D ] , 
 
 	 [ C a t ] , 
 
 	 [ R i g h t I n d e n t ] , 
 
 	 [ K e y ] , 
 
 	 [ V a l u e ] , 
 
 	 [ L e g e n d ] , 
 
 	 [ N u m b e r O n l y ] , 
 
 	 [ T e x t A r e a ] , 
 
 	 [ M u l t i C u l t u r e ] , 
 
 	 [ F o r T h e m e ] , 
 
 	 [ V a l i d a t i o n ] 
 
 ) 
 
 
 
 V A L U E S       
 
 
 
 ( 
 
 	 @ N e w V i r t u a l O p t i o n I D , 
 
 	 N ' ' , 
 
 	 0 , 
 
 	 N ' ' , 
 
 	 N ' ' , 
 
 	 N ' ' , 
 
 	 N ' ' , 
 
 	 N ' ' , 
 
 	 N ' '   , 
 
 	 N ' '   , 
 
 	 N ' ' 
 
 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = NvMR  O p t i o n   hv gT,{NagU_ _Y_MRp Nv0RbN ceQeU_vMOn\ُNU_O!kTy
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ O p t i o n C o u n t e r   I N T 
 
 S E T   @ O p t i o n C o u n t e r = @ N e w V i r t u a l O p t i o n I D - 1 
 
 
 
 W H I L E   @ O p t i o n C o u n t e r > = @ I D 
 
 
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = NS_MRMOnQU_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E C L A R E   @ C a t T e m p   n v a r c h a r ( 1 0 0 ) 	 	 
 
 	 D E C L A R E   @ R i g h t I n d e n t T e m p   I N T 
 
 	 D E C L A R E   @ K e y T e m p   n v a r c h a r ( 1 0 0 ) 	 
 
 	 D E C L A R E   @ V a l u e T e m p   n v a r c h a r ( 3 0 0 0 ) 	 
 
 	 D E C L A R E   @ L e g e n d T e m p   n v a r c h a r ( 5 0 ) 	 	 
 
 	 D E C L A R E   @ N u m b e r O n l y T e m p   n v a r c h a r ( 5 0 ) 	 
 
 	 D E C L A R E   @ T e x t A r e a T e m p   n v a r c h a r ( 5 0 ) 	 	 
 
 	 D E C L A R E   @ M u l t i C u l t u r e T e m p   n v a r c h a r ( 5 0 ) 	 	 
 
 	 D E C L A R E   @ F o r T h e m e T e m p   n v a r c h a r ( 5 0 ) 	 	 
 
 	 D E C L A R E   @ V a l i d a t i o n T e m p   n v a r c h a r ( 5 0 ) 	 	 
 
 
 
 	 S E L E C T   	 	 
 
 
 
 	 	 @ C a t T e m p = [ C a t ] , 
 
 	 	 @ R i g h t I n d e n t T e m p = [ R i g h t I n d e n t ] , 
 
 	 	 @ K e y T e m p = [ K e y ] , 
 
 	 	 @ V a l u e T e m p = [ V a l u e ] , 
 
 	 	 @ L e g e n d T e m p = [ L e g e n d ] , 
 
 	 	 @ N u m b e r O n l y T e m p = [ N u m b e r O n l y ] , 
 
 	 	 @ T e x t A r e a T e m p = [ T e x t A r e a ] , 
 
 	 	 @ M u l t i C u l t u r e T e m p = [ M u l t i C u l t u r e ] , 
 
 	 	 @ F o r T h e m e T e m p = [ F o r T h e m e ] , 
 
 	 	 @ V a l i d a t i o n T e m p = [ V a l i d a t i o n ] 
 
 
 
 	 F R O M   d b o . [ O p t i o n ]   W H E R E   [ I D ] = @ O p t i o n C o u n t e r 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = fe0RS_MRU_TbvU_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 U P D A T E   d b o . [ O p t i o n ]   S E T 
 
 
 
 	 	 [ C a t ] = @ C a t T e m p , 
 
 	 	 [ R i g h t I n d e n t ] = @ R i g h t I n d e n t T e m p , 
 
 	 	 [ K e y ] = @ K e y T e m p , 
 
 	 	 [ V a l u e ] = @ V a l u e T e m p , 
 
 	 	 [ L e g e n d ] = @ L e g e n d T e m p , 
 
 	 	 [ N u m b e r O n l y ] = @ N u m b e r O n l y T e m p , 
 
 	 	 [ T e x t A r e a ] = @ T e x t A r e a T e m p , 
 
 	 	 [ M u l t i C u l t u r e ] = @ M u l t i C u l t u r e T e m p , 
 
 	 	 [ F o r T h e m e ] = @ F o r T h e m e T e m p , 
 
 	 	 [ V a l i d a t i o n ] = @ V a l i d a t i o n T e m p 
 
 
 
 	 W H E R E   [ I D ] = @ O p t i o n C o u n t e r + 1 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = @ O p t i o n C o u n t e r - - 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ O p t i o n C o u n t e r = @ O p t i o n C o u n t e r - 1 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~~ۏL
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 C O N T I N U E 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  S P   Spe-NcOveQ[fe0R  @ I D   MOn
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n ]   S E T 
 
 
 
 	 [ C a t ] = @ C a t , 
 
 	 [ R i g h t I n d e n t ] = @ R i g h t I n d e n t , 
 
 	 [ K e y ] = @ K e y , 
 
 	 [ V a l u e ] = @ V a l u e , 
 
 	 [ L e g e n d ] = @ L e g e n d , 
 
 	 [ N u m b e r O n l y ] = @ N u m b e r O n l y , 
 
 	 [ T e x t A r e a ] = @ T e x t A r e a , 
 
 	 [ M u l t i C u l t u r e ] = @ M u l t i C u l t u r e , 
 
 	 [ F o r T h e m e ] = @ F o r T h e m e , 
 
 	 [ V a l i d a t i o n ] = @ V a l i d a t i o n 
 
 
 
 
 
 W H E R E   [ I D ] = @ I D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _S_MR  O p t i o n C o n t e n t     h gT NagU_v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ N e w V i r t u a l O p t i o n C o n t e n t I D   I N T 
 
 S E L E C T   @ N e w V i r t u a l O p t i o n C o n t e n t I D = M A X ( [ I D ] ) + 1   F R O M   d b o . [ O p t i o n C o n t e n t ]   
 
 
 
 D E C L A R E   @ O p t i o n C o n t e n t C o u n t e r   I N T 
 
 S E T   @ O p t i o n C o n t e n t C o u n t e r = @ N e w V i r t u a l O p t i o n C o n t e n t I D 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  O p t i o n C o n t e n t   hTbR  N   agZbU_  ( N = @ C u l t u r e s   peϑ) 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 W H I L E   @ O p t i o n C o n t e n t C o u n t e r < = @ N e w V i r t u a l O p t i o n C o n t e n t I D + @ C u l t u r e s - 1 
 
 
 
 B E G I N 
 
 
 
 	 I N S E R T   I N T O   d b o . [ O p t i o n C o n t e n t ] 
 
 
 	 ( 
 
 	 	 [ I D ] , 
 
 	 	 [ O p t i o n I D ] , 
 
 	 	 [ C u l t u r e ] , 
 
 	 	 [ T i t l e ] , 
 
 	 	 [ C a t T i t l e ] , 
 
 	 	 [ D e s c r i p t i o n ] 
 
 	 ) 
 
 
 
 	 V A L U E S       
 
 
 
 	 ( 
 
 	 	 @ O p t i o n C o n t e n t C o u n t e r , 
 
 	 	 0 , 
 
 	 	 N ' ' , 
 
 	 	 N ' ' , 
 
 	 	 N ' ' , 
 
 	 	 N ' ' 
 
 	 ) 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = @ O p t i o n C o n t e n t C o u n t e r + + 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ O p t i o n C o n t e n t C o u n t e r = @ O p t i o n C o n t e n t C o u n t e r + 1 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~~
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 C O N T I N U E 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Q!k7Re  @ O p t i o n C o n t e n t C o u n t e r 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ O p t i o n C o n t e n t C o u n t e r = @ N e w V i r t u a l O p t i o n C o n t e n t I D - 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = NvMR  O p t i o n   hv gT,{NagU_ _Y_MRp Nv0RbN ceQeU_vMOn\ُNU_O!kTy
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 W H I L E   @ O p t i o n C o n t e n t C o u n t e r > = ( @ I D - 1 ) * @ C u l t u r e s + 1 
 
 
 
 B E G I N 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = NS_MRMOnQU_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E C L A R E   @ O p t i o n I D T e m p   i n t 
 
 	 D E C L A R E   @ C u l t u r e T e m p   [ n v a r c h a r ]   ( 1 0 0 )   
 
 	 D E C L A R E   @ T i t l e T e m p   [ n v a r c h a r ]   ( 2 0 0 )   
 
 	 D E C L A R E   @ C a t T i t l e T e m p   [ n v a r c h a r ]   ( 2 0 0 ) 
 
 	 D E C L A R E   @ D e s c r i p t i o n T e m p   [ n v a r c h a r ]   ( 3 0 0 0 ) 
 
 
 
 	 S E L E C T   	 	 
 
 
 
 	 	 @ O p t i o n I D T e m p = [ O p t i o n I D ] + 1 , 
 
 	 	 @ C u l t u r e T e m p = [ C u l t u r e ] , 
 
 	 	 @ T i t l e T e m p = [ T i t l e ] , 
 
 	 	 @ C a t T i t l e T e m p = [ C a t T i t l e ] , 
 
 	 	 @ D e s c r i p t i o n T e m p = [ D e s c r i p t i o n ] 
 
 
 
 	 F R O M   d b o . [ O p t i o n C o n t e n t ]   W H E R E   [ I D ] = @ O p t i o n C o n t e n t C o u n t e r 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = fe0RS_MRU_Tbv,{  N   agU_  N = @ C u l t u r e s 	
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T 
 
 
 
 	 	 [ O p t i o n I D ] = @ O p t i o n I D T e m p , 
 
 	 	 [ C u l t u r e ] = @ C u l t u r e T e m p , 
 
 	 	 [ T i t l e ] = @ T i t l e T e m p , 
 
 	 	 [ C a t T i t l e ] = @ C a t T i t l e T e m p , 
 
 	 	 [ D e s c r i p t i o n ] = @ D e s c r i p t i o n T e m p 
 
 
 
 	 W H E R E   [ I D ] = @ O p t i o n C o n t e n t C o u n t e r + @ C u l t u r e s 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = @ O p t i o n C o n t e n t C o u n t e r - - 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E T   @ O p t i o n C o n t e n t C o u n t e r = @ O p t i o n C o n t e n t C o u n t e r - 1 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~~ۏL
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 C O N T I N U E 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Q!k7Re  O p t i o n C o n t e n t C o u n t e r 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ O p t i o n C o n t e n t C o u n t e r = 0 
 
 
 
 W H I L E   @ O p t i o n C o n t e n t C o u n t e r < = @ C u l t u r e s - 1 
 
 B E G I N 
 
 	 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T 
 
 
 
 	 	 [ O p t i o n I D ] = @ I D , 
 
 	 	 [ C u l t u r e ] = N ' ' , 
 
 	 	 [ T i t l e ] = N ' ' , 
 
 	 	 [ C a t T i t l e ] = N ' ' , 
 
 	 	 [ D e s c r i p t i o n ] = N ' ' 
 
 
 
 	 W H E R E   [ I D ] = @ I D * @ C u l t u r e s - @ O p t i o n C o n t e n t C o u n t e r 
 
 
 
 	 S E T   @ O p t i o n C o n t e n t C o u n t e r = @ O p t i o n C o n t e n t C o u n t e r + 1 
 
 	 C O N T I N U E 
 
 E N D 
 
 
 
 * / 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ X T o o l O p t i o n A d d ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . X T o o l O p t i o n D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ X T o o l O p t i o n D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ X T o o l O p t i o n D e l e t e ] 
 
 G O 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~]wQ  -   ]wQ(uegN  O p t i o n   h Rdg*N  K e y   /   V a l u e   
 
 - - = = TeN  O p t i o n C o n t e n t   \yv[^vQ[ Rd  
 
 - - = =  RdKNT؏\v^v  I D   QS  1   bN
N^g  O p t i o n   T  O p t i o n C o n t e n t   I D   Qszzm	
 
 - - = = yr+Rla}TNR
NSޏ~ЏLkY`O Rd  4 9 , 5 0   $N*N  O p t i o n R
NSЏL  X T o o l O p t i o n D e l e t e   4 9           X T o o l O p t i o n D e l e t e   5 0 V:NЏLN,{ N*NTSegv  5 0   _NSb  4 9   Ncknxv(ul^/f  X T o o l O p t i o n D e l e t e   4 9         X T o o l O p t i o n D e l e t e   4 9     
 
 - - = = ]wQS(uN|~S(uN _SrGS~ g~(u7b
NSNO(u]wQۏLNUOd\O
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . X T o o l O p t i o n D e l e t e 
 
 
 
 @ I D   i n t 	 	 	 	 	 	 - - \ Rdv  O p t i o n   v  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = [  O p t i o n   c[U_gbL Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . [ O p t i o n ]   W H E R E   [ I D ] = @ I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  RdT[  I D   TbvU_v  I D   Q  1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n ]   S E T   [ I D ] = [ I D ] - 1   W H E R E   [ I D ] > @ I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = QYt  O p t i o n C o n t e n t   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = ԏV@b	g
N͑
YveSX[0R4Neh    
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 D E C L A R E   @ C u l t u r e   T A B L E       
 
     
 
 (     
 
 	 C u l t u r e   n v a r c h a r ( 1 0 0 )   C O L L A T E   C h i n e s e _ P R C _ C I _ A S   N U L L       
 
 )     
 
     
 
 I N S E R T   I N T O   @ C u l t u r e     
 
     
 
 (     
 
 	 C u l t u r e     
 
 )     
 
     
 
 S E L E C T   D I S T I N C T     
 
     
 
 (     
 
 	 C u l t u r e     
 
 )     
 
     
 
 F R O M   d b o . O p t i o n C o n t e n t     
 
     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = {  C u l t u r e   vpev    
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 D E C L A R E   @ C u l t u r e C o u n t   I N T     
 
 S E L E C T   @ C u l t u r e C o u n t = C O U N T ( C u l t u r e )   F R O M   @ C u l t u r e       
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  Rdc[U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . O p t i o n C o n t e n t   W H E R E   O p t i o n I D = @ I D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  @ I D   Tbv  O p t i o n I D - 1 ;   [ I D ] - @ C u l t u r e C o u n t 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . O p t i o n C o n t e n t   S E T   O p t i o n I D = O p t i o n I D - 1 ,   [ I D ] = [ I D ] - @ C u l t u r e C o u n t   W H E R E   O p t i o n I D > @ I D 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ X T o o l O p t i o n D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . X T o o l O p t i o n M o v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ X T o o l O p t i o n M o v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ X T o o l O p t i o n M o v e ] 
 
 G O 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~]wQ  -   ]wQ\  O p t i o n   h-NvyvMRybTy
 
 - - = = kYbN`b  O p t i o n   h-Nv  I D = 5   vyvTyR  2   *NMOn
 
 - - = = yRRMRyTTy  - n   T  n 	YgyRv  O f f s e t   :N  0 R
NR\O
 
 - - = = ]wQS(uN|~S(uN _SrGS~ g~(u7b
NSNO(u]wQۏLNUOd\O
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . X T o o l O p t i o n M o v e 
 
 
 
 @ I D   i n t , 	 	 	 	 	 	 - -  yRv  O p t i o n   v  I D 
 
 @ O f f s e t   i n t , 	 	 	 	 	 - - yRY\*NMOn  + / -   $Ny<P+   h:yTy-   h:yMRy	
 
 @ C u l t u r e s   I N T 	 	 	 	 	 - - 	gY\*Ny
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg/f  @ I D   /f gT N*N  O p t i o n   v  I D N  @ O f f s e t > = 1   b@ I D   /f,{ N*N  O p t i o n     v  I D N  @ O f f s e t < = - 1 b  @ O f f s e t = 0   Rvc Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ M a x I D   I N T 
 
 D E C L A R E   @ M i n I D   I N T 
 
 
 
 S E L E C T   @ M a x I D = M A X ( o p t . [ I D ] )   F R O M   d b o . [ O p t i o n ]   o p t 
 
 S E L E C T   @ M i n I D = M I N ( o p t . [ I D ] )   F R O M   d b o . [ O p t i o n ]   o p t 
 
 
 
 I F   ( @ I D = @ M a x I D   A n d   @ O f f s e t > = 1 )   O R   ( @ I D = @ M i n I D   A n d   @ O f f s e t < = - 1 )   O R   ( @ O f f s e t = 0 ) 
 
 
 
 B E G I N 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ\  @ I D   MOnv  O p t i o n   v  I D   O9e:N  - 1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n ]   S E T   [ I D ] = - 1   W H E R E   [ I D ] = @ I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  @ I D   MOnv  O p t i o n C o n t e n t   v  O p t i o n I D   O9e:N  - 1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T   [ O p t i o n I D ] = - 1   W H E R E   [ O p t i o n I D ] = @ I D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  O f f s e t   :N  + / -   $Ny`b_R+RۏL  l  O f f s e t = 0   `b_SN
NYt	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   @ O f f s e t > 0 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \  @ I D   0R  @ I D + @ O f f s e t   KNvU_v  I D - - 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . [ O p t i o n ]   S E T   [ I D ] = [ I D ] - 1   W H E R E   [ I D ] > = @ I D + 1   A N D   [ I D ] < = @ I D + @ O f f s e t 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \  O p t i o n C o n t e n t   -Nv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T   [ I D ] = [ I D ] - @ C u l t u r e s ,   O p t i o n I D = O p t i o n I D - 1   W H E R E   O p t i o n I D > = @ I D + 1   A N D   O p t i o n I D < = @ I D + @ O f f s e t 
 
 	 E N D 
 
 
 
 E L S E   I F   @ O f f s e t < 0 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \  @ I D + @ O f f s e t   0R  @ I D   KNvU_v  I D + + 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . [ O p t i o n ]   S E T   [ I D ] = [ I D ] + 1   W H E R E     [ I D ] > = @ I D + @ O f f s e t   A N D   [ I D ] < = @ I D - 1 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \  O p t i o n C o n t e n t   -Nv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T   [ I D ] = [ I D ] + @ C u l t u r e s ,   O p t i o n I D = O p t i o n I D + 1   W H E R E   O p t i o n I D > = @ I D + @ O f f s e t   A N D   O p t i o n I D < =   @ I D - 1 
 
 	 E N D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gT\  [ I D ] = - 1   vU_v  I D   O9e:NcknxvMOn
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n ]   S E T   [ I D ] = @ I D + @ O f f s e t   W H E R E   [ I D ] = - 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gT\  [ O p t i o n I D ] = - 1   vU_v  O p t i o n I D   O9e:NcknxvMOn
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T   [ O p t i o n I D ] = @ I D + @ O f f s e t ,   [ I D ] = [ I D ]   +   ( @ O f f s e t   *   @ C u l t u r e s )   W H E R E   [ O p t i o n I D ] = - 1 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 / * 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  O f f s e t   :N  + / -   $Ny`b_R+RۏL
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   @ O f f s e t > 0 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg/fTy\S_MR  O p t i o n   y(W  @ I D   +   @ O f f s e t   +   1   ُ*NMOn
Y6R N*Nev  E n t r y 6qTQV0R  @ I D   MOn\ُ*N  O p t i o n   yv Rd  
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQ/fe
Y6R  E n t r y   vceQp  I D 	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ N e w P o s i t i o n   I N T 
 
 	 	 S E T   @ N e w P o s i t i o n = @ I D   +   @ O f f s e t   +   1 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = (WevceQp  X T o o l O p t i o n A d d    N*Ne  O p t i o n   yv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ C a t   n v a r c h a r ( 1 0 0 ) 
 
 	 	 D E C L A R E   @ R i g h t I n d e n t   i n t 
 
 	 	 D E C L A R E   @ K e y   n v a r c h a r ( 1 0 0 ) 
 
 	 	 D E C L A R E   @ V a l u e   n v a r c h a r ( 3 0 0 0 ) 
 
 	 	 D E C L A R E   @ L e g e n d   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ N u m b e r O n l y   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ T e x t A r e a   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ M u l t i C u l t u r e   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ F o r T h e m e   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ V a l i d a t i o n   n v a r c h a r ( 5 0 ) 
 
 
 
 	 	 S E L E C T   
 
 	 	 	 @ C a t = o p t . C a t , 
 
 	 	 	 @ R i g h t I n d e n t = o p t . R i g h t I n d e n t , 
 
 	 	 	 @ K e y = o p t . [ K e y ] , 
 
 	 	 	 @ V a l u e = o p t . V a l u e , 
 
 	 	 	 @ L e g e n d = o p t . L e g e n d , 
 
 	 	 	 @ N u m b e r O n l y = o p t . N u m b e r O n l y , 
 
 	 	 	 @ T e x t A r e a = o p t . T e x t A r e a , 
 
 	 	 	 @ M u l t i C u l t u r e = o p t . M u l t i C u l t u r e , 
 
 	 	 	 @ F o r T h e m e = o p t . F o r T h e m e , 
 
 	 	 	 @ V a l i d a t i o n = o p t . V a l i d a t i o n 
 
 
 
 	 	 F R O M   d b o . [ O p t i o n ]   o p t 
 
 	 	 W H E R E   o p t . [ I D ] = @ I D 
 
 
 
 	 	 E X E C   d b o . X T o o l O p t i o n A d d   @ N e w P o s i t i o n , @ C a t , @ R i g h t I n d e n t , @ K e y , @ V a l u e , @ L e g e n d , @ N u m b e r O n l y , @ T e x t A r e a , @ M u l t i C u l t u r e , @ F o r T h e m e , @ V a l i d a t i o n , @ C u l t u r e s 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = (W  O p t i o n C o n t e n t   -N\v^<P_NKQ0ReMOn
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ C u l t u r e C o u n t e r   I N T 
 
 	 	 S E T   @ C u l t u r e C o u n t e r = 1 
 
 
 
 	 	 W H I L E   @ C u l t u r e C o u n t e r < = @ C u l t u r e s 
 
 
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = _yRv  O p t i o n   yv  O p t i o n C o n t e n t   (WS_MR  C u l t u r e   N[^vU_NO  c l o n e   0ReceQp[^v  O p t i o n C o n t e n t 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 D E C L A R E   @ C u l t u r e O r i g i n a l   [ n v a r c h a r ]   ( 1 0 0 )   
 
 	 	 	 D E C L A R E   @ T i t l e O r i g i n a l   [ n v a r c h a r ]   ( 2 0 0 )   
 
 	 	 	 D E C L A R E   @ C a t T i t l e O r i g i n a l   [ n v a r c h a r ]   ( 2 0 0 ) 
 
 	 	 	 D E C L A R E   @ D e s c r i p t i o n O r i g i n a l   [ n v a r c h a r ]   ( 3 0 0 0 ) 
 
 
 
 	 	 	 S E L E C T   
 
 	 	 	 	 @ C u l t u r e O r i g i n a l = o p t c . C u l t u r e , 
 
 	 	 	 	 @ T i t l e O r i g i n a l = o p t c . T i t l e , 
 
 	 	 	 	 @ C a t T i t l e O r i g i n a l = o p t c . C a t T i t l e , 
 
 	 	 	 	 @ D e s c r i p t i o n O r i g i n a l = o p t c . [ D e s c r i p t i o n ] 
 
 
 
 	 	 	 F R O M   d b o . [ O p t i o n C o n t e n t ]   o p t c 
 
 	 	 	 W H E R E   o p t c . [ I D ] = ( @ I D   -   1 )   *   @ C u l t u r e s   +   @ C u l t u r e C o u n t e r 
 
 
 
 
 
 	 	 	 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T 
 
 
 
 	 	 	 	 C u l t u r e = @ C u l t u r e O r i g i n a l , 
 
 	 	 	 	 T i t l e = @ T i t l e O r i g i n a l , 
 
 	 	 	 	 C a t T i t l e = @ C a t T i t l e O r i g i n a l , 
 
 	 	 	 	 [ D e s c r i p t i o n ] = @ D e s c r i p t i o n O r i g i n a l 
 
 
 
 	 	 	 W H E R E   [ I D ] = ( @ N e w P o s i t i o n   -   1 )   *   @ C u l t u r e s   +   @ C u l t u r e C o u n t e r 
 
 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = @ C u l t u r e C o u n t e r + + 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 S E T   @ C u l t u r e C o u n t e r = @ C u l t u r e C o u n t e r   +   1 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = ~~ۏL
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 C O N T I N U E 
 
 	 	 E N D 	 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  gTbN Rd*N    O r i g i n a l   O p t i o n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . X T o o l O p t i o n D e l e t e   @ I D 
 
 
 
 	 E N D 
 
 
 
 E L S E   I F   @ O f f s e t < 0 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = Yg/fMRy\S_MR  O p t i o n   y(W  @ I D   -   A B S ( @ O f f s e t )     ُ*NMOn
Y6R N*Nev  E n t r y 6qTQV0R  @ I D + 1   MOn\ُ*N  O p t i o n   yv Rd  
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQ/fe
Y6R  E n t r y   vceQp  I D 	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ N e w P o s i t i o n 2   I N T 
 
 	 	 S E T   @ N e w P o s i t i o n 2 = @ I D   -   A B S ( @ O f f s e t ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = (WevceQp  X T o o l O p t i o n A d d    N*Ne  O p t i o n   yv
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ C a t 2   n v a r c h a r ( 1 0 0 ) 
 
 	 	 D E C L A R E   @ R i g h t I n d e n t 2   i n t 
 
 	 	 D E C L A R E   @ K e y 2   n v a r c h a r ( 1 0 0 ) 
 
 	 	 D E C L A R E   @ V a l u e 2   n v a r c h a r ( 3 0 0 0 ) 
 
 	 	 D E C L A R E   @ L e g e n d 2   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ N u m b e r O n l y 2   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ T e x t A r e a 2   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ M u l t i C u l t u r e 2   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ F o r T h e m e 2   n v a r c h a r ( 5 0 ) 
 
 	 	 D E C L A R E   @ V a l i d a t i o n 2   n v a r c h a r ( 5 0 ) 
 
 
 
 	 	 S E L E C T   
 
 	 	 	 @ C a t 2 = o p t . C a t , 
 
 	 	 	 @ R i g h t I n d e n t 2 = o p t . R i g h t I n d e n t , 
 
 	 	 	 @ K e y 2 = o p t . [ K e y ] , 
 
 	 	 	 @ V a l u e 2 = o p t . V a l u e , 
 
 	 	 	 @ L e g e n d 2 = o p t . L e g e n d , 
 
 	 	 	 @ N u m b e r O n l y 2 = o p t . N u m b e r O n l y , 
 
 	 	 	 @ T e x t A r e a 2 = o p t . T e x t A r e a , 
 
 	 	 	 @ M u l t i C u l t u r e 2 = o p t . M u l t i C u l t u r e , 
 
 	 	 	 @ F o r T h e m e 2 = o p t . F o r T h e m e , 
 
 	 	 	 @ V a l i d a t i o n 2 = o p t . V a l i d a t i o n 
 
 
 
 	 	 F R O M   d b o . [ O p t i o n ]   o p t 
 
 	 	 W H E R E   o p t . [ I D ] = @ I D 
 
 
 
 	 	 E X E C   d b o . X T o o l O p t i o n A d d   @ N e w P o s i t i o n 2 , @ C a t 2 , @ R i g h t I n d e n t 2 , @ K e y 2 , @ V a l u e 2 , @ L e g e n d 2 , @ N u m b e r O n l y 2 , @ T e x t A r e a 2 , @ M u l t i C u l t u r e 2 , @ F o r T h e m e 2 , @ V a l i d a t i o n 2 , @ C u l t u r e s 
 
 	 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = (W  O p t i o n C o n t e n t   -N\v^<P_NKQ0ReMOn  laُeO r i g i n a l   O p t i o n I D   ]~  + 1   NV:NbN(WMRbceQNe<P	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ C u l t u r e C o u n t e r 2   I N T 
 
 	 	 S E T   @ C u l t u r e C o u n t e r 2 = 1 
 
 
 
 	 	 W H I L E   @ C u l t u r e C o u n t e r 2 < = @ C u l t u r e s 
 
 
 
 	 	 B E G I N 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = _yRv  O p t i o n   yv  O p t i o n C o n t e n t   (WS_MR  C u l t u r e   N[^vU_NO  c l o n e   0ReceQp[^v  O p t i o n C o n t e n t 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 D E C L A R E   @ C u l t u r e O r i g i n a l 2   [ n v a r c h a r ]   ( 1 0 0 )   
 
 	 	 	 D E C L A R E   @ T i t l e O r i g i n a l 2   [ n v a r c h a r ]   ( 2 0 0 )   
 
 	 	 	 D E C L A R E   @ C a t T i t l e O r i g i n a l 2   [ n v a r c h a r ]   ( 2 0 0 ) 
 
 	 	 	 D E C L A R E   @ D e s c r i p t i o n O r i g i n a l 2   [ n v a r c h a r ]   ( 3 0 0 0 ) 
 
 
 
 	 	 	 S E L E C T   
 
 	 	 	 	 @ C u l t u r e O r i g i n a l 2 = o p t c . C u l t u r e , 
 
 	 	 	 	 @ T i t l e O r i g i n a l 2 = o p t c . T i t l e , 
 
 	 	 	 	 @ C a t T i t l e O r i g i n a l 2 = o p t c . C a t T i t l e , 
 
 	 	 	 	 @ D e s c r i p t i o n O r i g i n a l 2 = o p t c . [ D e s c r i p t i o n ] 
 
 
 
 	 	 	 F R O M   d b o . [ O p t i o n C o n t e n t ]   o p t c 
 
 	 	 	 W H E R E   o p t c . [ I D ] = ( @ I D   +   1   -   1 )   *   @ C u l t u r e s   +   @ C u l t u r e C o u n t e r 2 
 
 
 
 
 
 	 	 	 U P D A T E   d b o . [ O p t i o n C o n t e n t ]   S E T 
 
 
 
 	 	 	 	 C u l t u r e = @ C u l t u r e O r i g i n a l 2 , 
 
 	 	 	 	 T i t l e = @ T i t l e O r i g i n a l 2 , 
 
 	 	 	 	 C a t T i t l e = @ C a t T i t l e O r i g i n a l 2 , 
 
 	 	 	 	 [ D e s c r i p t i o n ] = @ D e s c r i p t i o n O r i g i n a l 2 
 
 
 
 	 	 	 W H E R E   [ I D ] = ( @ N e w P o s i t i o n 2   -   1 )   *   @ C u l t u r e s   +   @ C u l t u r e C o u n t e r 2 
 
 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = @ C u l t u r e C o u n t e r + + 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 S E T   @ C u l t u r e C o u n t e r 2 = @ C u l t u r e C o u n t e r 2   +   1 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = ~~ۏL
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 C O N T I N U E 
 
 	 	 E N D 	 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = =  gTbN Rd*N    O r i g i n a l   O p t i o n     s(W[v  I D   ]~  + 1   N	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 D E C L A R E   @ I D P l u s   I N T 
 
 	 	 S E T   @ I D P l u s = @ I D + 1 
 
 
 
 	 	 E X E C   d b o . X T o o l O p t i o n D e l e t e   @ I D P l u s 
 
 
 
 	 E N D 
 
 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ X T o o l O p t i o n M o v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . U s e r A c c o u n t C o n t a c t C a r d S e l e c t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ U s e r A c c o u n t C o n t a c t C a r d S e l e c t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ U s e r A c c o u n t C o n t a c t C a r d S e l e c t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u  U D F _ U s e r R e s o l v e   ԏV~[(u7b(u7b~mTRh g~㉐gQegv[te(u7bRhSvQDe
 
 - - = = (ueg(W  C o n t a c t C a r d G e n e r a t e . c s   -NubU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 4 - 1 2   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . U s e r A c c o u n t C o n t a c t C a r d S e l e c t   
 
 
 
   @ U s e r s   n v a r c h a r ( 4 0 0 0 ) 	 	 	 - - (u7bS(u7b~mTRh
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 S E L E C T   D I S T I N C T 
 
 
 
 	 [ N a m e ] , 
 
 	 I S N U L L ( F i r s t N a m e , N ' ' )   A S   F i r s t N a m e , 
 
 	 I S N U L L ( L a s t N a m e , N ' ' )   A S   L a s t N a m e , 
 
 	 I S N U L L ( T e l , N ' ' )   A S   T e l , 
 
 	 I S N U L L ( E m a i l , N ' ' )   A S   E m a i l , 
 
 	 I S N U L L ( M o b i l e , N ' ' )   A S   M o b i l e , 
 
 	 I S N U L L ( F a x , N ' ' )   A S   F a x , 
 
 	 I S N U L L ( M S N , N ' ' )   A S   M S N , 
 
 	 I S N U L L ( S k y p e , N ' ' )   A S   S k y p e , 
 
 	 I S N U L L ( T w i t t e r , N ' ' )   A S   T w i t t e r , 
 
 	 I S N U L L ( Q Q , N ' ' )   A S   Q Q , 
 
 	 I S N U L L ( A d d r e s s , N ' ' )   A S   A d d r e s s , 
 
 	 C A S E   S e x   W H E N   1   T H E N   N ' M '   E L S E   N ' F '   E N D   A S   S e x , 
 
 	 I S N U L L ( O r g a n i z a t i o n , N ' ' )   A S   O r g a n i z a t i o n , 
 
 	 I S N U L L ( [ P o s i t i o n ] , N ' ' )   A S   [ P o s i t i o n ] , 
 
 	 I S N U L L ( R a n k , 1 0 0 0 0 0 0 )   A S   R a n k , 
 
 	 I S N U L L ( P o r t r a i t N a m e , N ' ' )   A S   P o r t r a i t N a m e , 
 
 	 I S N U L L ( R e m a r k , N ' ' )   A S   R e m a r k 
 
 
 
 F R O M   d b o . U s e r s 
 
 
 
 W H E R E   [ N a m e ]   I N   ( S e l e c t   [ U s e r ]   F r o m   d b o . U D F _ U s e r R e s o l v e ( @ U s e r s ) ) 
 
 
 
 O R D E R   B Y   R a n k   A S C 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ U s e r A c c o u n t C o n t a c t C a r d S e l e c t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S i t e L o g S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S i t e L o g S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S i t e L o g S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  S i t e L o g   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = sQN  A c t i v i t y 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 0 .   {vU_
 
 
 
 - - = = 1 .   Omȉez
 
 - - = = 2 .   Omȉ^P[
 
 
 
 - - = = 3 .   mR;NvU_
 
 - - = = 4 .   mRP[vU_
 
 - - = = 5 .   mRuvU_
 
 - - = = 6 .   mRQ[
 
 - - = = 7 .   mRċ
 
 - - = = 8 .   mR^P[
 
 - - = = 9 .   mRߍ^
 
 
 
 - - = = 1 0 . O9e;NvU_
 
 - - = = 1 1 . O9eP[vU_
 
 - - = = 1 2 . O9euvU_
 
 - - = = 1 3 . O9eQ[
 
 - - = = 1 4 . O9e^P[
 
 - - = = 1 5 . O9eߍ^
 
 
 
 - - = = 1 6 .  Rd;NvU_
 
 - - = = 1 7 .  RdP[vU_
 
 - - = = 1 8 .  RduvU_
 
 - - = = 1 9 .  RdQ[
 
 - - = = 2 0 .  Rdċ
 
 - - = = 2 1 .  Rd^P[
 
 - - = = 2 2 .  Rdߍ^
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S i t e L o g S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - S_MR(u7b
TN  A S P X   z N OǏegv	
 
 @ A c t i v i t y   i n t , 	 	 	 	 	 - - (u7b;mR0 - 1 9 TNh
NT+TIN	
 
 @ T a r g e t I D   i n t 	 	 	 	 	 - - (u7b;mR  T a r g e t   I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  ,g  S P   /f|~ЏL~bve CgPhg	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S_MRe
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u r r e n t T i m e   n v a r c h a r ( 5 0 ) 
 
 S E T   @ C u r r e n t T i m e = G E T D A T E ( ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  S i t e L o g   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . S i t e L o g ( [ U s e r ] , A c t i v i t y , T a r g e t I D , A c t i v i t y T i m e )   V A L U E S ( @ U s e r , @ A c t i v i t y , @ T a r g e t I D , @ C u r r e n t T i m e ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S i t e L o g S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S i t e L o g Q u e r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S i t e L o g Q u e r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S i t e L o g Q u e r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ُ*N  S P   v\O(u9hnccOv  @ A c t i v i t y   SpeԏV  S i t e L o g   -Nc[;mRvcL
 
 - - = = ^zRu:g6RHQ\ck8^g~gX[eQ N*N~g N7hFOYN N*NP a g i n g I D vhSϑ	9hncP a g i n g I D @ P a g e S i z e @ C u r r e n t P a g e 	SS_MRuvU_v^\;`upe\O:N N*NRhMOQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 1   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 1 - 0 3 - 1 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S i t e L o g Q u e r y 
 
 
 
 @ A c t i v i t y   i n t , 	 	 	 - - (u7b;mRS
 
 
 
 @ D a t e F r o m   d a t e t i m e , 	 	 - - ~ _Yeg
 
 @ D a t e T o   d a t e t i m e , 	 	 - - ~~_geg
 
 
 
 @ P a g e S i z e   I N T , 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T , 	 	 - - ux:g6RS_MRu
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) 	 - - c^e_  A S C ,   D E S C 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spev8YtN(WX[(WR`Sv0WeO(u  -   vMRfe	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = CgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  @ D a t e F r o m   T  @ D a t e T o   lbc:NSN(W  D y n S Q L   O(uv<h_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D a t e F r o m S t r i n g   N V A R C H A R ( 2 0 0 ) 
 
 D E C L A R E   @ D a t e T o S t r i n g   N V A R C H A R ( 2 0 0 ) 
 
 
 
 I F   ( @ D a t e F r o m   I S   N O T   N U L L )     A N D   ( @ D a t e T o   I S   N O T   N U L L ) 
 
 
 
 B E G I N 
 
 
 
 	 S E T   @ D a t e F r o m S t r i n g = N ' c o n v e r t ( d a t e t i m e , N ' ' '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , D A T E P A R T ( Y E A R , @ D a t e F r o m ) )   +   N ' - '   +     C O N V E R T ( N V A R C H A R ( 2 0 ) , D A T E P A R T ( M O N T H , @ D a t e F r o m ) )   +   N ' - '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , D A T E P A R T ( D A Y , @ D a t e F r o m ) )   +   N '   0 0 : 0 1 : 0 1 '   +   N ' ' ' , 1 0 2 )   ' 
 
 	 S E T   @ D a t e T o S t r i n g = N ' c o n v e r t ( d a t e t i m e , N ' ' '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , D A T E P A R T ( Y E A R , @ D a t e T o ) )   +   N ' - '   +     C O N V E R T ( N V A R C H A R ( 2 0 ) , D A T E P A R T ( M O N T H , @ D a t e T o ) )   +   N ' - '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , D A T E P A R T ( D A Y , @ D a t e T o ) )   +   N '   2 3 : 5 9 : 5 9 '   +   N ' ' ' , 1 0 2 )   ' 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R`gS-NSQs  U n i c o d e   W[&{kYF i r s t N a m e = ' R' 	n v a r c h a r ( ) 
NǏ4 0 0 0 Nb$N*NR`S gT؏ޏc0R Nw@bN[IN:N  n v a r c h a r ( 4 0 0 0 ) 
 
 - - = = (uR`S Q L Seg[b~( laR
NS e t   N o c o u n t   o n   md[ g~QU_Ɩvq_T) 
 
 - - = = (uegg^W h e r e NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 )             
 
 D E C L A R E   @ D y n W h e r e   N V A R C H A R ( 4 0 0 0 )   
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^Ruh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = N '   S E T   N O C O U N T   O N       ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ P a g i n g   t a b l e   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ U s e r ]   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,     ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A c t i v i t y   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A c t i v i t y C o u n t   i n t   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = kXEQRuh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   d i s t i n c t       '     
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   s l . [ U s e r ]   a s   [ U s e r ] ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   s l . A c t i v i t y   a s   A c t i v i t y ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C O U N T ( s l . A c t i v i t y )   a s   A c t i v i t y C o u n t   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . S i t e L o g   s l   ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = W H E R E   1 = 1   ]Y0WMQNNbR`  W H E R E   NS-Nv   A N D    
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W H E R E   1 = 1     ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = vQ[R`  W H E R E   NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n W h e r e = N ' ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ A c t i v i t y   ~~"}
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ A c t i v i t y   I S   N O T   N U L L   
 
 B E G I N 
 
 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   s l . A c t i v i t y = '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ A c t i v i t y ) 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = @ D a t e F r o m ,   @ D a t e T o   ~~"}
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( @ D a t e F r o m   I S   N O T   N U L L )     A N D   ( @ D a t e T o   I S   N O T   N U L L ) 
 
 B E G I N 
 
 	 s e t   @ D y n W h e r e = @ D y n W h e r e   +   N '   a n d   s l . A c t i v i t y T i m e > = '   + @ D a t e F r o m S t r i n g   +   N '   a n d   s l . A c t i v i t y T i m e < = '   +   @ D a t e T o S t r i n g 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = MRbv  S Q L   S gTR  vQ[R`  W H E R E   NS  @ D y n S Q L   -N]~S+T  W H E R E   1 = 1 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   @ D y n W h e r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R
N  G r o u p   B y   NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   g r o u p   b y   s l . [ U s e r ] , s l . A c t i v i t y   ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R
N  O r d e r   B y   NS
 
 - - = = Yg  O r d e r B y = ' '   RO(u:w  o r d e r   b y   A c t i v i t y C o u n t   D E S C 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ O r d e r B y = L T R I M ( R T R I M ( @ O r d e r B y ) ) 
 
 S E T   @ O r d e r B y O r d e r = L T R I M ( R T R I M ( @ O r d e r B y O r d e r ) ) 
 
 
 
 I F   L E N ( @ O r d e r B y ) = 0   O R     L E N ( @ O r d e r B y O r d e r ) = 0 
 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ A c t i v i t y C o u n t ]   D E S C   ' 
 
 	 E N D 
 
 E L S E 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ '   +   @ O r d e r B y   +   N ' ]   '   +   @ O r d e r B y O r d e r 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e t   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   * , P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ P a g e S i z e )   +   N ' ) )   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ F i r s t R e c o r d )   +   N '   a n d   P a g i n g I D < '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgR`Sv^
NSNǏ|~
NP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s D y n S Q L   I N T 
 
 E X E C   d b o . P u b l i c D y n S Q L L e n g t h C h e c k   @ D y n S Q L , @ o P a s s D y n S Q L   O U T 
 
 I F   @ o P a s s D y n S Q L = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLR`  S Q L   S   _Y~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 R E T U R N 
 
 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S i t e L o g Q u e r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . G r o u p M a i l R e s o l v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ G r o u p M a i l R e s o l v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ G r o u p M a i l R e s o l v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (WzQNS-NSN(WN0W@W-NkXQY   lQ(u7b;`, Oo`, T i m o t h y , L i l i e    KN{|v0W@W,g  S P   Nُ{|0W@Wh:y-N㉐gQ[^vN0W@WRh
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 1 2 - 0 1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . G r o u p M a i l R e s o l v e 
 
 
 
 @ U s e r   N V A R C H A R ( 5 0 ) , 	 	 	 	 - - S_MR{vU_(u7bN  A S P X   z OǏeg	
 
 @ T o   N V A R C H A R ( 4 0 0 0 ) 	 	 	 	 - - S0W@W   lQ(u7b;`, Oo`, T i m o t h y , L i l i e    KN{|vh:ye_    	
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgzQNSP[S	g  A d m i n   (u7b	gCgPۏL	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n U s e r A u t h e n t i c a t i o n   @ U s e r , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  @ T o   h:yW[&{2N㉐gQwck(u7b
Tv^N    U s e r s   hgُN(u7bv{0W@W gTQ㉐gQv{0W@WRh
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   D I S T I N C T 
 
 
 
 	 u s . E m a i l 
 
 
 
 F R O M   d b o . U D F _ U s e r R e s o l v e ( @ T o )   u s r 
 
 I N N E R   J O I N   d b o . U s e r s   u s   O N   u s . [ N a m e ] = u s r . [ U s e r ] 
 
 
 
 
 
 W H E R E   ( u s . E m a i l < > N ' ' )   A N D   ( u s . E m a i l   I S   N O T   N U L L ) 
 
 
 
 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ G r o u p M a i l R e s o l v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = :N~[v  S u b D i r e c t o r y   R^ N*N  O v e r v i e w   '`(v    P a g e D i r e c t o r y   GPY  S u b D i r e c t o r y   N
NX[(W  O v e r v i e w   P a g e D i r e c t o r y   v݋	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S u b D i r e c t o r y I D   i n t , 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   [^v  S u b D i r e c t o r y   v  I D 
 
 @ O v e r v i e w P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 - - Q[u
TW[  N  S u b D i r e c t o r y S a v e    Oeg	
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgُ̑(uv  S P   P a g e D i r e c t o r y S a v e   ,g]~	gCgPhg	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg  S u b D i r e c t o r y S a v e    Oegv  @ O v e r v i e w P a g e D i r e c t o r y N a m e   
N:NzzR(uKN&TRN|~S N*N/U Nv  N u m b e r   (uegg ُ*Ne  P a g e D i r e c t o r y   v
TW[
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ N a m e   N V A R C H A R ( 1 0 0 ) 
 
 
 
 I F   L E N ( R T R I M ( L T R I M ( @ O v e r v i e w P a g e D i r e c t o r y N a m e ) ) ) = 0 
 
 
 
 	 B E G I N 
 
 	 	 D E C L A R E   @ U n i q u e N u m b e r   I N T 
 
 	 	 E X E C   d b o . U n i q u e N u m b e r G e t   @ U n i q u e N u m b e r   O U T 
 
 	 	 S E L E C T   @ N a m e = N ' p '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ U n i q u e N u m b e r ) 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ N a m e = @ O v e r v i e w P a g e D i r e c t o r y N a m e 
 
 	 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  S u b   D i r e c t o r y   R^  O v e r v i e w   P a g e   D i r e c t o r y   `b_bNꁨRR^v  P a g e   D i r e c t o r y   ~b    S u b   D i r e c t o r y   v
TW[
 
 - - = = :g6Rf/T(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 D E C L A R E   @ N a m e   N V A R C H A R ( 1 0 0 ) 
 
 S E L E C T   @ N a m e = [ N a m e ]   F R O M   d b o . S u b D i r e c t o r y   W H E R E   [ I D ] = @ S u b D i r e c t o r y I D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~bvQ6r  S u b D i r e c t o r y   v  N e w W i n d o w   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ N e w W i n d o w   b i t 
 
 
 
 S E L E C T   @ N e w W i n d o w = s d . N e w W i n d o w   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . [ I D ] = @ S u b D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 E X E C   d b o . P a g e D i r e c t o r y S a v e   
 
 
 
 	 @ U s e r , 	 	 	 	 - - @ U s e r 
 
 
 
 	 @ S u b D i r e c t o r y I D , 	 	 - - @ S u b D i r e c t o r y I D 
 
 
 
 	 1 , 	 	 	 	 - - @ S e r i a l 
 
 	 @ N a m e , 	 	 	 - - @ N a m e 
 
 	 1 0 0 0 0 , 	 	 	 	 - - @ P a g e S i z e 
 
 	 @ N e w W i n d o w , 	 	 	 - - @ N e w W i n d o w   ~bvQ6r  S u b D i r e c t o r y   v	
 
 	 
 
 	 1 , 	 	 	 	 - - @ O v e r v i e w 
 
 	 0 , 	 	 	 	 - - @ F a s t A c c e s s 
 
 	 0 , 	 	 	 	 - - @ H o m e 
 
 
 
 	 0 , 	 	 	 	 - - @ R i g h t I n d e n t 
 
 
 
 	 0 , 	 	 	 	 - - @ j Q u e r y 
 
 
 
 	 0 , 	 	 	 	 - - @ L o g o H i d e 
 
 	 0 , 	 	 	 	 - - @ M a i n M e n u H i d e 
 
 	 0 , 	 	 	 	 - - @ B a n n e r H i d e 
 
 	 0 , 	 	 	 	 - - @ B r e a d c r u m b H i d e 
 
 	 0 , 	 	 	 	 - - @ P a g e M e n u H i d e 
 
 	 0 , 	 	 	 	 - - @ P a g e B a r H i d e 
 
 	 0 , 	 	 	 	 - - @ C o p y r i g h t H i d e 
 
 
 
 	 1 , 	 	 	 	 - - @ T y p e 
 
 	 1 , 	 	 	 	 - - @ P r e s e n t a t i o n 
 
 	 0 , 	 	 	 	 - - @ J u m p T o C o n t e n t 
 
 
 
 	 0 , 	 	 	 	 - - @ S h o w T i t l e 
 
 	 0 , 	 	 	 	 - - @ S h o w A u t h o r 
 
 	 0 , 	 	 	 	 - - @ S h o w U p d a t e T i m e 
 
 	 0 , 	 	 	 	 - - @ S h o w H i t C o u n t 
 
 	 0 , 	 	 	 	 - - @ S h o w C o m m e n t s 
 
 	 0 , 	 	 	 	 - - @ S h o w S t a t i c U r l 
 
 	 0 , 	 	 	 	 - - @ S h o w K n o w l e d g e H t m l 
 
 	 0 , 	 	 	 	 - - @ S h o w R e l a t i v e 
 
 
 
 	 N ' ' , 	 	 	 	 - - @ E d i t o r 
 
 	 N ' ' , 	 	 	 	 - - @ D e d i c a t e d T o 
 
 	 N ' ' , 	 	 	 	 - - @ C o m m e n t s P e r m i s s i o n 
 
 
 
 	 @ o N e w I D   O U T 	 	 	 - - @ o N e w I D 	 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y C o n t e n t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y C o n t e n t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y C o n t e n t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = :N~[v  S u b D i r e c t o r y   R^v  O v e r v i e w   '`(v    P a g e D i r e c t o r y   vQ[U_vR^@b	gy	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y C o n t e n t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y I D   i n t , 	 	 	 	 	 - - S_MR  P a g e D i r e c t o r y   [^v  S u b D i r e c t o r y   v  I D 
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 	 	 - - eU_v  I D   QSpe  Y  C u l t u r e   e[EaIN	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgُ̑(uv  S P   P a g e D i r e c t o r y C o n t e n t S a v e   ,g]~	gCgPhg	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~yRh  C u r o s r 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u l t u r e   N V A R C H A R ( 1 0 0 ) 
 
 D E C L A R E   C u l t u r e s _ C u r s o r   C U R S O R   F O R   S E L E C T   C u l t u r e   F R O M   d b o . U D F _ P u b l i c C u l t u r e s ( ) 
 
 O P E N   C u l t u r e s _ C u r s o r 
 
 F E T C H   N E X T   F R O M   C u l t u r e s _ C u r s o r   I N T O   @ C u l t u r e 
 
 
 
 W H I L E   @ @ F E T C H _ S T A T U S = 0 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~b  S u b D i r e c t o r y   S_MR  C u l t u r e   Nv  T i t l e   T  D e s c r i p t i o n 
 
 	 - - = = l,g  S P   (W  S P   S u b D i r e c t o r y S a v e   -N(uveP(WЏLS u b D i r e c t o r y S a v e   vePS u b D i r e c t o r y C o n t e n t S a v e   ؏leg_SgbLVdk~b0Rv  T i t l e   T  D e s c r i p t i o n   NN/f  N U L L   bzz<P
 
 	 - - = = le6qُ7h:NNHN؏OYuNNNxV:N,g  S P   ؏\  S P   K n o w l e d g e M o v e   (u  S P   K n o w l e d g e M o v e   -NNbُkNx1\	gaINN
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 D E C L A R E   @ T i t l e   N V A R C H A R ( 2 0 0 ) 
 
 	 D E C L A R E   @ D e s c r i p t i o n   N V A R C H A R ( 1 0 0 0 ) 
 
 
 
 	 S E L E C T   
 
 
 
 	 	 @ T i t l e = s d c . [ T i t l e ] , 
 
 	 	 @ D e s c r i p t i o n = s d c . [ D e s c r i p t i o n ] 
 
 
 
 	 F R O M   d b o . P a g e D i r e c t o r y   p d 
 
 	 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p d . S u b D i r e c t o r y I D 
 
 	 L E F T   J O I N   d b o . S u b D i r e c t o r y C o n t e n t   s d c   O N   s d . [ I D ] = s d c . S u b D i r e c t o r y I D 
 
 
 
 	 W H E R E   p d . [ I D ] = @ P a g e D i r e c t o r y I D   A N D   s d c . [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = N  O p t i o n   hg؞v  S e o T i t l e ,   S e o D e s c r i p t i o n ,   S e o K e y w o r d s   	N*N  S E O   vsQvhQ@\Spe
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 D E C L A R E   @ S e o T i t l e   N V A R C H A R ( 2 0 0 ) 
 
 	 D E C L A R E   @ S e o D e s c r i p t i o n   N V A R C H A R ( 4 0 0 0 ) 
 
 	 D E C L A R E   @ S e o K e y w o r d s   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 	 S E L E C T   @ S e o T i t l e = d b o . U D F _ M u l t i C u l t u r e O p t i o n V a l u e G e t ( N ' S e o T i t l e ' , @ C u l t u r e ) 
 
 	 S E L E C T   @ S e o D e s c r i p t i o n = d b o . U D F _ M u l t i C u l t u r e O p t i o n V a l u e G e t ( N ' S e o D e s c r i p t i o n ' , @ C u l t u r e ) 
 
 	 S E L E C T   @ S e o K e y w o r d s = d b o . U D F _ M u l t i C u l t u r e O p t i o n V a l u e G e t ( N ' S e o K e y w o r d s ' , @ C u l t u r e ) 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = =  _YmR,gyNv؞  P a g e D i r e c t o r y C o n t e n t 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 E X E C   d b o . P a g e D i r e c t o r y C o n t e n t S a v e   
 
 	 
 
 	 	 @ U s e r , 	 	 	 	 - - @ U s e r 
 
 	 
 
 	 	 @ P a g e D i r e c t o r y I D , 	 	 - - @ P a g e D i r e c t o r y I D 
 
 	 
 
 	 	 @ S e o T i t l e , 	 	 	 - - @ S e o T i t l e 
 
 	 	 @ S e o D e s c r i p t i o n , 	 	 - - @ S e o D e s c r i p t i o n 
 
 	 	 @ S e o K e y w o r d s , 	 	 	 - - @ S e o K e y w o r d s 
 
 
 
 	 	 @ T i t l e , 	 	 	 	 - - @ T i t l e 
 
 	 	 @ D e s c r i p t i o n , 	 	 	 - - @ D e s c r i p t i o n 
 
 
 
 	 	 N ' ' , 	 	 	 	 - - @ T e m p l a t e 
 
 	 	 0 , 	 	 	 	 - - @ H i d d e n 
 
 	 	 0 , 	 	 	 	 - - @ H i d d e n I n N a v i g a t i o n O n l y 
 
 
 
 	 	 N ' ' , 	 	 	 	 - - @ P a g e H e a d e r 
 
 	 	 N ' ' , 	 	 	 	 - - @ P a g e F o o t e r 
 
 
 
 	 	 N ' G e t K n o w l e d g e . a s p x ' , 	 	 - - @ U r l 
 
 	 	 0 , 	 	 	 	 - - @ T h i s I s L i n k 
 
 
 
 	 	 @ C u l t u r e , 	 	 	 - - @ C u l t u r e 
 
 	 
 
 	 	 @ o N e w I D   O U T 	 	 	 - - @ o N e w I D 	 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = N N*Ny
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 F E T C H   N E X T   F R O M   C u l t u r e s _ C u r s o r   I N T O   @ C u l t u r e 
 
 
 
 E N D 
 
 
 
 C L O S E     C u l t u r e s _ C u r s o r 
 
 D E A L L O C A T E     C u l t u r e s _ C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S u b D i r e c t o r y C r e a t e O v e r v i e w P a g e D i r e c t o r y C o n t e n t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = :N~[v  M a i n D i r e c t o r y   R^ N*N  O v e r v i e w   '`(v    S u b D i r e c t o r y   GPY  M a i n D i r e c t o r y   N
NX[(W  O v e r v i e w   S u b D i r e c t o r y   v݋	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 3 - 0 9 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ M a i n D i r e c t o r y I D   i n t , 	 	 	 	 - - eR^  S u b D i r e c t o r y   [^v  M a i n D i r e c t o r y   v  I D 
 
 @ O v e r v i e w P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 - - Q[u
TW[  N  M a i n D i r e c t o r y S a v e    Oeg	
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 	 - - eU_v  I D   QSpe
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgُ̑(uv  S P   S u b D i r e c t o r y S a v e   ,g]~	gCgPhg	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQN|~S N*N/U Nv  N u m b e r   (uegg ُ*Ne  S u b D i r e c t o r y   v
TW[
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ N a m e   N V A R C H A R ( 1 0 0 ) 
 
 
 
 D E C L A R E   @ U n i q u e N u m b e r   I N T 
 
 E X E C   d b o . U n i q u e N u m b e r G e t   @ U n i q u e N u m b e r   O U T 
 
 	 	 
 
 S E L E C T   @ N a m e = N ' s '   +   C O N V E R T ( N V A R C H A R ( 2 0 ) , @ U n i q u e N u m b e r ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (W  M a i n   D i r e c t o r y   R^  O v e r v i e w   S u b   D i r e c t o r y   `b_bNꁨRR^v  S u b   D i r e c t o r y   ~b    M a i n   D i r e c t o r y   v
TW[
 
 - - = = :g6Rf/T(u
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 / * 
 
 D E C L A R E   @ N a m e   N V A R C H A R ( 1 0 0 ) 
 
 S E L E C T   @ N a m e = [ N a m e ]   F R O M   d b o . M a i n D i r e c t o r y   W H E R E   [ I D ] = @ M a i n D i r e c t o r y I D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~bvQ6r  M a i n D i r e c t o r y   v  N e w W i n d o w   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ N e w W i n d o w   b i t 
 
 
 
 S E L E C T   @ N e w W i n d o w = m d . N e w W i n d o w   F R O M   d b o . M a i n D i r e c t o r y   m d   W H E R E   m d . [ I D ] = @ M a i n D i r e c t o r y I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 E X E C   d b o . S u b D i r e c t o r y S a v e   
 
 
 
 	 @ U s e r , 	 	 	 	 - - @ U s e r 
 
 
 
 	 @ M a i n D i r e c t o r y I D , 	 	 - - @ M a i n D i r e c t o r y I D 
 
 
 
 	 1 , 	 	 	 	 - - @ S e r i a l 
 
 
 
 	 @ N a m e , 	 	 	 - - @ N a m e 
 
 	 @ O v e r v i e w P a g e D i r e c t o r y N a m e , 	 - - @ O v e r v i e w P a g e D i r e c t o r y N a m e 
 
 	 @ N e w W i n d o w , 	 	 	 - - @ N e w W i n d o w   ~bvQ6r  M a i n D i r e c t o r y   v	
 
 	 1 , 	 	 	 	 - - @ O v e r v i e w 
 
 	 0 , 	 	 	 	 - - @ W i z a r d 
 
 
 
 	 N ' ' , 	 	 	 	 - - @ E d i t o r 
 
 	 N ' ' , 	 	 	 	 - - @ D e d i c a t e d T o 
 
 	 N ' ' , 	 	 	 	 - - @ C o m m e n t s P e r m i s s i o n 
 
 
 
 	 @ o N e w I D   O U T 	 	 	 - - @ o N e w I D 	 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y C o n t e n t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y C o n t e n t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y C o n t e n t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = :N~[v  M a i n D i r e c t o r y   R^v  O v e r v i e w   '`(v    S u b D i r e c t o r y   vQ[U_vR^@b	gy	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 4   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y C o n t e n t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S u b D i r e c t o r y I D   i n t , 	 	 	 - - sS\R^v  S u b D i r e c t o r y C o n t e n t   [^v  S u b D i r e c t o r y   v  I D 
 
 
 
 @ o N e w I D   i n t   O U T 	 	 	 - - eU_v  I D   QSpe  Y  C u l t u r e   e[EaIN	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgُ̑(uv  S P   S u b D i r e c t o r y C o n t e n t S a v e   ,g]~	gCgPhg	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~yRh  C u r o s r 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ C u l t u r e   N V A R C H A R ( 1 0 0 ) 
 
 D E C L A R E   C u l t u r e s _ C u r s o r   C U R S O R   F O R   S E L E C T   C u l t u r e   F R O M   d b o . U D F _ P u b l i c C u l t u r e s ( ) 
 
 O P E N   C u l t u r e s _ C u r s o r 
 
 F E T C H   N E X T   F R O M   C u l t u r e s _ C u r s o r   I N T O   @ C u l t u r e 
 
 
 
 W H I L E   @ @ F E T C H _ S T A T U S = 0 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ~b  M a i n D i r e c t o r y   S_MR  C u l t u r e   Nv  T i t l e   T  D e s c r i p t i o n 
 
 	 - - = = l,g  S P   (W  S P   M a i n D i r e c t o r y S a v e   -N(uveP(WЏL  M a i n D i r e c t o r y S a v e   vePM a i n D i r e c t o r y C o n t e n t S a v e   ؏leg_SgbLVdk~b0Rv  T i t l e   T  D e s c r i p t i o n   NN/f  N U L L   bzz<P
 
 	 - - = = le6qُ7h:NNHN؏OYuNNNxV:N,g  S P   ؏\  S P   K n o w l e d g e M o v e   (u  S P   K n o w l e d g e M o v e   -NNbُkNx1\	gaINN
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 D E C L A R E   @ T i t l e   N V A R C H A R ( 2 0 0 ) 
 
 	 D E C L A R E   @ D e s c r i p t i o n   N V A R C H A R ( 1 0 0 0 ) 
 
 
 
 	 S E L E C T   
 
 
 
 	 	 @ T i t l e = m d c . [ T i t l e ] , 
 
 	 	 @ D e s c r i p t i o n = m d c . [ D e s c r i p t i o n ] 
 
 
 
 	 F R O M   d b o . S u b D i r e c t o r y   s d 
 
 	 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 	 L E F T   J O I N   d b o . M a i n D i r e c t o r y C o n t e n t   m d c   O N   m d . [ I D ] = m d c . M a i n D i r e c t o r y I D 
 
 
 
 	 W H E R E   s d . [ I D ] = @ S u b D i r e c t o r y I D   A N D   m d c . [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = =  _YmR,gyNv؞  S u b D i r e c t o r y C o n t e n t 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 E X E C   d b o . S u b D i r e c t o r y C o n t e n t S a v e   
 
 	 
 
 	 	 @ U s e r , 	 	 	 	 - - @ U s e r 
 
 	 
 
 	 	 @ S u b D i r e c t o r y I D , 	 	 - - @ S u b D i r e c t o r y I D 
 
 
 
 	 	 @ T i t l e , 	 	 	 	 - - @ T i t l e     ~bvQ6r  M a i n D i r e c t o r y C o n t e n t   v	
 
 	 	 @ D e s c r i p t i o n , 	 	 	 - - @ D e s c r i p t i o n   ~bvQ6r  M a i n D i r e c t o r y C o n t e n t   v	
 
 
 
 	 	 N ' ' , 	 	 	 	 - - @ W i z a r d P r e v i o u s T i t l e 
 
 	 	 N ' ' , 	 	 	 	 - - @ W i z a r d N e x t T i t l e 
 
 	 	 0 , 	 	 	 	 - - @ H i d d e n 
 
 	 	 0 , 	 	 	 	 - - @ H i d d e n I n N a v i g a t i o n O n l y 
 
 
 
 	 	 N ' ' , 	 	 	 	 - - @ P a g e H e a d e r 
 
 	 	 N ' ' , 	 	 	 	 - - @ P a g e F o o t e r 
 
 
 
 	 	 N ' G e t K n o w l e d g e . a s p x ' , 	 	 - - @ U r l 
 
 	 	 0 , 	 	 	 	 - - @ T h i s I s L i n k 
 
 
 
 	 	 @ C u l t u r e , 	 	 	 - - @ C u l t u r e 
 
 
 
 	 	 @ o N e w I D 	 	 	 - - @ o N e w I D 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = N N*Ny
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 F E T C H   N E X T   F R O M   C u l t u r e s _ C u r s o r   I N T O   @ C u l t u r e 
 
 
 
 E N D 
 
 
 
 C L O S E     C u l t u r e s _ C u r s o r 
 
 D E A L L O C A T E     C u l t u r e s _ C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ M a i n D i r e c t o r y C r e a t e O v e r v i e w S u b D i r e c t o r y C o n t e n t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y G e t N e i g h b o u r         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y G e t N e i g h b o u r ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y G e t N e i g h b o u r ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ُ/f  P a g e D i r e c t o r y G e t N e i g h b o u r   v  C o m m u n i t y   Hr
 
 - - = = Yg|~{tXTvMRMON>y:S:SWU R L   -N_[S+T N*N  F o r u m I D = x x x   Q S   SpebN9hncُ*N  F o r u m I D   SNwS_MR@bYv  F o r u m   ~wS@bYv  C o m m u n i t y 
 
 - - = = Yg/f Rd  F o r u m Rhg Rdv  F o r u m   /f&Tp`}YS_MR@bYv  F o r u m Yg/fR Rd~_gTbN͑[T0R  N e i g h b o u r   F o r u m   
N
 
 - - = = Yg/f Rd  C o m m u n i t y RQN Rdv    C o m m u n i t y   /f&Tp`}YS_MR@bYv  C o m m u n i t y R Rd~_gTbN͑[T0R  N e i g h b o u r   C o m m u n i t y   
N
 
 - - = = Yg RdTC o m m u n i t y   ]~ RIQR0R  A d m i n   ܃US
 
 - - = = l N*N  C o m m u n i t y   Nv  F o r u m   
NX[(W RIQv`b_V:N|~	g*N:g6ROb  C o m m u n i t y   N/U Nv  F o r u m   
N Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 0 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y G e t N e i g h b o u r 
 
 
 
 @ F o r u m I D   i n t , 	 	 	 	 - - ~[v  F o r u m I D 
 
 
 
 @ C o m m u n i t y D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 - - /f  C o m m u n i t y ,   F o r u m ? 
 
 @ C o m m u n i t y I t e m   i n t , 	 	 	 - -  Rdagvv  I D 
 
 
 
 @ N e i g h b o u r I D   i n t   O U T , 	 	 	 - - ԏVSpe, ԏVv  N e i g h b o u r   v  I D   F o r u m 	
 
 @ N e i g h b o u r   n v a r c h a r ( 1 0 0 )   O U T 	 	 - - ԏVSpe,   ԏVv  N e i g h b o u r   v
TW[  F o r u m 	
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ F o r u m I D   [^v    F o r u m N a m e ,   C o m m u n i t y I D ,   C o m m u n i t y S e r i a l ,     F o r u m S e r i a l 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m N a m e   N V A R C H A R ( 1 0 0 ) 
 
 D E C L A R E   @ C o m m u n i t y I D   I N T 
 
 D E C L A R E   @ F o r u m S e r i a l   I N T 
 
 D E C L A R E   @ C o m m u n i t y S e r i a l   I N T 
 
 
 
 S E L E C T   
 
 
 
 	 @ F o r u m N a m e = f o . [ N a m e ] , 
 
 	 @ C o m m u n i t y I D = c o . [ I D ] , 
 
 	 @ F o r u m S e r i a l = f o . S e r i a l , 
 
 	 @ C o m m u n i t y S e r i a l = c o . S e r i a l 
 
 
 
 F R O M   d b o . F o r u m   f o   
 
 L E F T   J O I N   d b o . C o m m u n i t y   c o   O N   c o . [ I D ] = f o . C o m m u n i t y I D 
 
 
 
 W H E R E   f o . [ I D ] = @ F o r u m I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ F o r u m I D ,   @ C o m m u n i t y I D   vE\  I D   Yg	g  S e r i a l   'Y N*Nv(u'Y N*Nv&TR(u\ N*Nv	
 
 - - = = HQRYS:N    @ F o r u m N e i g h b o u r I D = @ F o r u m I D @ C o m m u n i t y N e i g h b o u r I D = @ C o m m u n i t y I D     ( N[
N(WTbbN\d[[[N]~ce(WYN) 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m N e i g h b o u r I D   I N T 
 
 D E C L A R E   @ C o m m u n i t y N e i g h b o u r I D   I N T 
 
 
 
 S E T   @ F o r u m N e i g h b o u r I D = @ F o r u m I D 
 
 S E T   @ C o m m u n i t y N e i g h b o u r I D = @ C o m m u n i t y I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ F o r u m N e i g h b o u r I D   ~b  S e r i a l   4Nяvb  I D   4Nяv  	geP  S e r i a l   S9h,glǏ/f  1 ُ/f1\~b  I D   4Nяv	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   f o . [ I D ]   F r o m   d b o . F o r u m   f o   W h e r e   f o . S e r i a l > @ F o r u m S e r i a l   A n d   f o . C o m m u n i t y I D = @ C o m m u n i t y I D ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ F o r u m N e i g h b o u r I D = ( S e l e c t   T o p   1   f o . [ I D ]     F r o m   d b o . F o r u m   f o   W h e r e   f o . S e r i a l > @ F o r u m S e r i a l   A n d   f o . C o m m u n i t y I D = @ C o m m u n i t y I D   O r d e r   B y   f o . S e r i a l   A S C ) 
 
 	 E N D 
 
 
 
 E L S E   I F   E X I S T S   ( S e l e c t   f o . [ I D ]   F r o m   d b o . F o r u m   f o   W h e r e   f o . S e r i a l < @ F o r u m S e r i a l   A n d   f o . C o m m u n i t y I D = @ C o m m u n i t y I D ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ F o r u m N e i g h b o u r I D = ( S e l e c t   T o p   1   f o . [ I D ]     F r o m   d b o . F o r u m   f o   W h e r e   f o . S e r i a l < @ F o r u m S e r i a l   A n d   f o . C o m m u n i t y I D = @ C o m m u n i t y I D   O r d e r   B y   f o . S e r i a l   D E S C ) 
 
 	 E N D 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   f o . [ I D ]   F r o m   d b o . F o r u m   f o   W h e r e   f o . [ I D ] > @ F o r u m I D   A n d   f o . C o m m u n i t y I D = @ C o m m u n i t y I D ) 
 
 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ F o r u m N e i g h b o u r I D = ( S e l e c t   T o p   1   f o . [ I D ]     F r o m   d b o . F o r u m   f o   W h e r e   f o . [ I D ] > @ F o r u m I D   A n d   f o . C o m m u n i t y I D = @ C o m m u n i t y I D   O r d e r   B y   f o . [ I D ]   A S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ F o r u m N e i g h b o u r I D = ( S e l e c t   T o p   1   f o . [ I D ]     F r o m   d b o . F o r u m   f o   W h e r e   f o . [ I D ] < @ F o r u m I D   A n d   f o . C o m m u n i t y I D = @ C o m m u n i t y I D   O r d e r   B y   f o . [ I D ]   D E S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _  @ C o m m u n i t y N e i g h b o u r I D   ~b  S e r i a l   4Nяvb  I D   4Nяv  	geP  S e r i a l   S9h,glǏ/f  1 ُ/f1\~b  I D   4Nяv	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   E X I S T S   ( S e l e c t   c o . [ I D ]   F r o m   d b o . C o m m u n i t y   c o   W h e r e   c o . S e r i a l > @ C o m m u n i t y S e r i a l ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ C o m m u n i t y N e i g h b o u r I D = ( S e l e c t   T o p   1   c o . [ I D ]     F r o m   d b o . C o m m u n i t y   c o   W h e r e   c o . S e r i a l > @ C o m m u n i t y S e r i a l   O r d e r   B y   c o . S e r i a l   A S C ) 
 
 	 E N D 
 
 
 
 E L S E   I F   E X I S T S   ( S e l e c t   c o . [ I D ]   F r o m   d b o . C o m m u n i t y   c o   W h e r e   c o . S e r i a l < @ C o m m u n i t y S e r i a l ) 
 
 
 
 	 B E G I N 
 
 	 	 S E L E C T   @ C o m m u n i t y N e i g h b o u r I D = ( S e l e c t   T o p   1   c o . [ I D ]     F r o m   d b o . C o m m u n i t y   c o   W h e r e   c o . S e r i a l < @ C o m m u n i t y S e r i a l   O r d e r   B y   c o . S e r i a l   D E S C ) 
 
 	 E N D 
 
 
 
 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   c o . [ I D ]   F r o m   d b o . C o m m u n i t y   c o   W h e r e   c o . [ I D ] > @ C o m m u n i t y I D ) 
 
 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ C o m m u n i t y N e i g h b o u r I D = ( S e l e c t   T o p   1   c o . [ I D ]     F r o m   d b o . C o m m u n i t y   c o   W h e r e   c o . [ I D ] > @ C o m m u n i t y I D   O r d e r   B y   c o . [ I D ]   A S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 	 E L S E 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ C o m m u n i t y N e i g h b o u r I D = ( S e l e c t   T o p   1   c o . [ I D ]     F r o m   d b o . C o m m u n i t y   c o   W h e r e   c o . [ I D ] < @ C o m m u n i t y I D   O r d e r   B y   c o . [ I D ]   D E S C ) 	 	 	 
 
 	 	 	 E N D 
 
 	 E N D 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  @ C o m m u n i t y D i r e c t o r y =     C o m m u n i t y   |     F o r u m     $Ny`b_Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 I F   @ C o m m u n i t y D i r e c t o r y = N ' F o r u m ' 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 - - = = Yg/f  F o r u m   `b_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQww/f
N/fd[[[N/fv݋9hncbN(W  S P   F o r u m D e l e t e   -Nv~[d[[[Nv RdOybkȒُ_N1\
NX[(WQ  N e i g h b o u r   vvcQ  @ F o r u m I D     \O:N  @ N e i g h b o u r I D   Q
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 
 
 	 	 D E C L A R E   @ F o r u m C o u n t   I N T 
 
 	 	 S E L E C T   @ F o r u m C o u n t = C O U N T ( f o . [ I D ] )   F R O M   d b o . F o r u m   f o   W H E R E   f o . C o m m u n i t y I D = @ C o m m u n i t y I D 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = /f&Td[[[N
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ F o r u m C o u n t < = 1 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Yg
0/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ N e i g h b o u r I D = @ F o r u m I D 
 
 	 	 	 	 S E L E C T   @ N e i g h b o u r = @ F o r u m N a m e 
 
 	 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = = Yg
0
N/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = R/f&T] R]R+RQ
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   @ F o r u m I D = @ C o m m u n i t y I t e m 
 
 	 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0/f0] R]  . . . 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T   @ N e i g h b o u r I D = @ F o r u m N e i g h b o u r I D 
 
 	 	 	 	 	 	 S E L E C T     @ N e i g h b o u r = ( S e l e c t   f o . [ N a m e ]   F r o m   d b o . F o r u m   f o   W h e r e   f o . [ I D ] = @ F o r u m N e i g h b o u r I D ) 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 	 E L S E 
 
 	 	 	 	 	 B E G I N 	 	 	 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0
N/f0] R]vcQ  @ F o r u m I D   \O:N  @ N e i g h b o u r I D   O U T 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T   @ N e i g h b o u r I D = @ F o r u m I D 
 
 	 	 	 	 	 	 S E L E C T   @ N e i g h b o u r = @ F o r u m N a m e 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 E N D 
 
 
 
 
 
 	 E N D 
 
 
 
 
 
 E L S E 
 
 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 - - = = Yg/f  C o m m u n i t y   `b_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = HQww/f
N/fd[[[N/fv݋Q  @ N e i g h b o u r I D = 0       A S P X   zw0Rzzv  @ N e i g h b o u r I D   O0R|~{t̑
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 
 
 	 	 D E C L A R E   @ C o m m u n i t y C o u n t   I N T 
 
 	 	 S E L E C T   @ C o m m u n i t y C o u n t = C O U N T ( c o . [ I D ] )   F R O M   d b o . C o m m u n i t y   c o 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = /f&Td[[[N
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ C o m m u n i t y C o u n t < = 1 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = Yg
0/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 	 	 	 	 S E L E C T   @ N e i g h b o u r I D = 0 
 
 	 	 	 	 S E L E C T   @ N e i g h b o u r = N ' ' 
 
 	 	 	 E N D 
 
 
 
 	 	 E L S E 
 
 
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 - - = Yg
0
N/f0d[[[N
 
 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 B E G I N 
 
 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = R/f&T] R]R+RQ
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 I F   @ C o m m u n i t y I D = @ C o m m u n i t y I t e m 
 
 	 
 
 	 	 	 	 	 B E G I N 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0/f0] R]  . . . 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T     @ N e i g h b o u r I D = ( S e l e c t   T o p   1   f o . [ I D ]   F r o m   d b o . F o r u m   f o   W h e r e   f o . C o m m u n i t y I D = @ C o m m u n i t y N e i g h b o u r I D   O r d e r   B y   f o . S e r i a l   A S C ) 
 
 	 	 	 	 	 	 S E L E C T     @ N e i g h b o u r = ( S e l e c t   T o p   1   f o . [ N a m e ]   F r o m   d b o . F o r u m   f o   W h e r e   f o . C o m m u n i t y I D = @ C o m m u n i t y N e i g h b o u r I D   O r d e r   B y   f o . S e r i a l   A S C ) 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 	 E L S E 
 
 	 	 	 	 	 B E G I N 	 	 	 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 	 	 - - = = Yg
0
N/f0] R]vcQ  @ P a g e D i r e c t o r y N a m e   \O:N  @ N e i g h b o u r   O U T 
 
 	 	 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 	 
 
 	 	 	 	 	 	 S E L E C T   @ N e i g h b o u r I D = @ F o r u m I D 
 
 	 	 	 	 	 	 S E L E C T   @ N e i g h b o u r = @ F o r u m N a m e 
 
 	 	 	 	 	 E N D 
 
 
 
 	 	 	 E N D 
 
 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y G e t N e i g h b o u r ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C u r r e n t S e r i a l         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C u r r e n t S e r i a l ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C u r r e n t S e r i a l ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~[  K n o w l e d g e D i r e c t o r y   M a i n D i r e c t o r y ,   S u b D i r c e t o r y ,   P a g e D i r e c t o r y ,   K n o w l e d g e 	
 
 - - = = ~[S_MR  P a r e n t 
 
 - - = = {S_MR  S e r i a l    g'Y<PQR  1   1\/fsS\eR^  K n o w l e d g e   v؞  S e r i a l 
 
 - - = = (uemR  M a i n D i r e c t o r y / S u b D i r e c t o r y / P a g e D i r e c t o r y / K n o w l e d g e     vePꁨR:NKNRM N*N g`Tv  S e r i a l 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 1 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C u r r e n t S e r i a l 
 
 
 
 @ K n o w l e d g e D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - mRv  K n o w l e d g e   ~+R  M a i n D i r e c t o r y ,   S u b D i r c e t o r y ,   P a g e D i r e c t o r y ,   K n o w l e d g e 	
 
 @ P a r e n t   I N T , 	 	 	 	 	 - - mRv  K n o w l e d g e   @b^\
N~vU_v  I D 
 
 
 
 @ S e r i a l   I N T   O U T 	 	 	 	 - - S_MR  S e r i a l   
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ؞n  @ S e r i a l = 1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ S e r i a l = 1 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  @ K n o w l e d g e D i r e c t o r y   
NT`b_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ K n o w l e d g e D i r e c t o r y = N ' M a i n D i r e c t o r y ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   m d . S e r i a l   F r o m   d b o . M a i n D i r e c t o r y   m d   W h e r e   m d . [ S y s t e m ] < > 1 ) 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   @ S e r i a l = M A X ( I S N U L L ( m d . S e r i a l , 1 ) )   +   1   F R O M   d b o . M a i n D i r e c t o r y   m d   W H E R E   m d . [ S y s t e m ] < > 1 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y = N ' S u b D i r e c t o r y ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   s d . S e r i a l   F r o m   d b o . S u b D i r e c t o r y   s d   W h e r e   s d . M a i n D i r e c t o r y I D = @ P a r e n t ) 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   @ S e r i a l = M A X ( I S N U L L ( s d . S e r i a l , 1 ) )   +   1   F R O M   d b o . S u b D i r e c t o r y   s d   W H E R E   s d . M a i n D i r e c t o r y I D = @ P a r e n t 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y = N ' P a g e D i r e c t o r y ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   p d . S e r i a l   F r o m   d b o . P a g e D i r e c t o r y   p d   W h e r e   p d . S u b D i r e c t o r y I D = @ P a r e n t ) 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   @ S e r i a l = M A X ( I S N U L L ( p d . S e r i a l , 1 ) )   +   1   F R O M   d b o . P a g e D i r e c t o r y   p d   W H E R E   p d . S u b D i r e c t o r y I D = @ P a r e n t 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E L S E   I F   @ K n o w l e d g e D i r e c t o r y = N ' K n o w l e d g e ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   n o w . S e r i a l   F r o m   d b o . K n o w l e d g e   n o w   W h e r e   n o w . P a g e D i r e c t o r y I D = @ P a r e n t ) 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   @ S e r i a l = M A X ( I S N U L L ( n o w . S e r i a l , 1 ) )   +   1   F R O M   d b o . K n o w l e d g e   n o w   W H E R E   n o w . P a g e D i r e c t o r y I D = @ P a r e n t 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C u r r e n t S e r i a l ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y C u r r e n t S e r i a l         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y C u r r e n t S e r i a l ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y C u r r e n t S e r i a l ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ~[  C o m m u n i t y D i r e c t o r y   C o m m u n i t y ,   F o r u m 	
 
 - - = = ~[S_MR  P a r e n t 
 
 - - = = {S_MR  S e r i a l    g'Y<PQR  1   1\/fsS\eR^  C o m m u n i t y / F o r u m     v؞  S e r i a l 
 
 - - = = (u(WmR>y:S/ [WvePSNꁨR:Ne>y:S/ [Wn g`Tv  S e r i a l 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 4 - 1 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y C u r r e n t S e r i a l 
 
 
 
 @ C o m m u n i t y D i r e c t o r y   n v a r c h a r ( 1 0 0 ) , 	 	 - - mRv  C o m m u n i t y / F o r u m   ~+R  C o m m u n i t y ,   F o r u m 	
 
 @ P a r e n t   I N T , 	 	 	 	 	 - - mRv  C o m m u n i t y / F o r u m   @b^\
N~vU_v  I D 
 
 
 
 @ S e r i a l   I N T   O U T 	 	 	 	 - - S_MR  S e r i a l   
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ؞n  @ S e r i a l = 1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   @ S e r i a l = 1 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R  @ C o m m u n i t y D i r e c t o r y   
NT`b_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ C o m m u n i t y D i r e c t o r y = N ' C o m m u n i t y ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   c o . S e r i a l   F r o m   d b o . C o m m u n i t y   c o ) 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   @ S e r i a l = M A X ( I S N U L L ( c o . S e r i a l , 1 ) )   +   1   F R O M   d b o . C o m m u n i t y   c o 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E L S E   I F   @ C o m m u n i t y D i r e c t o r y = N ' F o r u m ' 
 
 
 
 	 B E G I N 
 
 
 
 	 	 I F   E X I S T S   ( S e l e c t   f o . S e r i a l   F r o m   d b o . F o r u m   f o   W h e r e   f o . C o m m u n i t y I D = @ P a r e n t ) 
 
 	 	 B E G I N 
 
 	 	 	 S E L E C T   @ S e r i a l = M A X ( I S N U L L ( f o . S e r i a l , 1 ) )   +   1   F R O M   d b o . F o r u m   f o   W H E R E   f o . C o m m u n i t y I D = @ P a r e n t 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y C u r r e n t S e r i a l ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o m m e n t s B a t c h D e l e t e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o m m e n t s B a t c h D e l e t e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o m m e n t s B a t c h D e l e t e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ybϑ Rd  K n o w l e d g e C o m m e n t s     
 
 - - = =  CgPhgS $R[S_MR{vFbb^\N  A d m i n   sSS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 5 - 1 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o m m e n t s B a t c h D e l e t e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 @ K n o w l e d g e C o m m e n t s T o B e D e l e t e d   n v a r c h a r ( 4 0 0 0 ) , 	 	 - - \ybϑ Rdv  C o m m e n t s   v  I D   Rh
 
 
 
 @ P a g e S i z e   i n t , 	 	 	 	 	 	 	 - - O(uSpe{ RdgbLTP a g e C o u n t   <PNO(W Rds:Wux[MO  kY RdeMON,{5 u RdTYON4 uRbN:_uxV0R,{4 u	
 
 @ P a g e C o u n t   i n t   O U T 	 	 	 	 	 	 - -  RdTv;`upe
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Yg Rd  K n o w l e d g e C o m m e n t s   Rh^zz
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   L E N ( R T R I M ( L T R I M ( @ K n o w l e d g e C o m m e n t s T o B e D e l e t e d ) ) ) > 0 
 
 
 
 B E G I N 
 
 	 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S  @ K n o w l e d g e C o m m e n t s T o B e D e l e t e d   -Nv,{ N*NU_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E C L A R E   @ K n o w l e d g e C o m m e n t s I D   I N T 
 
 	 S E L E C T   @ K n o w l e d g e C o m m e n t s I D = ( S e l e c t   T o p   1   E l e m e n t   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ K n o w l e d g e C o m m e n t s T o B e D e l e t e d , N ' , ' ) ) 
 
 	 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 9hnc  @ K n o w l e d g e C o m m e n t s T o B e D e l e t e d   -Nv,{ N*NU__  K n o w l e d g e I D   NOO(u  S P   A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   $ReS_MR(u7b/f&T	gCgP Rd
 
 	 - - = = vQ-N  @ K n o w l e d g e C o n t e n t I D   /fTb  S i t e L o g S a v e   O(uv
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E C L A R E   @ K n o w l e d g e I D   I N T 
 
 	 D E C L A R E   @ K n o w l e d g e C o n t e n t I D   I N T 
 
 	 
 
 	 S E L E C T   @ K n o w l e d g e I D = n o w . [ I D ]   ,   @ K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] 
 
 	 
 
 	 F R O M   d b o . K n o w l e d g e   n o w   
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 L E F T   J O I N   d b o . K n o w l e d g e C o m m e n t s   n o w c o m   O N   n o w c o m . K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] 
 
 	 
 
 	 W H E R E   n o w c o m . [ I D ] = @ K n o w l e d g e C o m m e n t s I D 
 
 	 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = (u7bCgPhg
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E C L A R E   @ o P a s s   I N T 
 
 	 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' K n o w l e d g e ' , @ K n o w l e d g e I D , @ o P a s s   O U T 
 
 	 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 	 
 
 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = gbL Rd
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 D E L E T E   F R O M   d b o . K n o w l e d g e C o m m e n t s   W H E R E   [ I D ]   I N   ( S e l e c t   E l e m e n t   F r o m   d b o . U D F _ P u b l i c S p l i t ( @ K n o w l e d g e C o m m e n t s T o B e D e l e t e d , N ' , ' ) ) 
 
 	 
 
 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = OX[TԏVev  P a g e C o u n t 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T   @ P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   K n o w l e d g e C o m m e n t s   w h e r e   K n o w l e d g e C o n t e n t I D = @ K n o w l e d g e C o n t e n t I D ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) ) 
 
 	 
 
 	 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 	 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = U_ Rdlُ̑U_v/f RdN  @ K n o w l e d g e C o n t e n t I D   Nv  C o m m e n t s 
N/fwQSOv    @ C o m m e n t s I D 	
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   2 0 ,   @ K n o w l e d g e C o n t e n t I D 
 
 
 
 	 / * 
 
 	 D E C L A R E   @ C o m m e n t s I D   I N T 
 
 	 D E C L A R E   C o m m e n t s I D _ C u r s o r   C U R S O R   F O R   S E L E C T   E l e m e n t   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ K n o w l e d g e C o m m e n t s T o B e D e l e t e d , N ' , ' ) 
 
 	 O P E N   C o m m e n t s I D _ C u r s o r 
 
 
 
 	 F E T C H   N E X T   F R O M   C o m m e n t s I D _ C u r s o r   I N T O   @ C o m m e n t s I D 
 
 	 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = \S_MR;mRU_(WHh(W  @ K n o w l e d g e C o n t e n t I D   N RdNċ	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   2 0 ,   @ K n o w l e d g e C o n t e n t I D 
 
 
 
 	 	 F E T C H   N E X T   F R O M   C o m m e n t s I D _ C u r s o r   I N T O   @ C o m m e n t s I D 
 
 	 E N D 
 
 
 
 	 C L O S E   C o m m e n t s I D _ C u r s o r 
 
 	 D E A L L O C A T E   C o m m e n t s I D _ C u r s o r 
 
 	 * / 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o m m e n t s B a t c h D e l e t e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . S y s t e m E n t r y P a g e N a m e G e t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ S y s t e m E n t r y P a g e N a m e G e t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ S y s t e m E n t r y P a g e N a m e G e t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  P a g e D i r e c t o r y   h_vQ  M a i n D i r e c t o r y . S y s t e m = t r u e   *NU_v  N a m e 
 
 - - = = (uNԏV|~:S܃USv  E n t r y   y[^v  P a g e M e n u N a m e   A c t i v e P a g e M e n u N a m e 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 6 - 1 6   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . S y s t e m E n t r y P a g e N a m e G e t 
 
 
 
 @ S y s t e m E n t r y P a g e N a m e   n v a r c h a r ( 1 0 0 )   O U T 	 	 - - ԏVSpe, S y s t e m   E n t r y   P a g e   uv
TW[  
 
 
 
 A S 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ԏV  M a i n D i r e c t o r y . S y s t e m = 1   v*NU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T   T O P   1 
 
 
 
 	 @ S y s t e m E n t r y P a g e N a m e = p d . [ N a m e ]   
 
 
 
 F R O M   d b o . P a g e D i r e c t o r y   p d 
 
 L E F T   J O I N   d b o . S u b D i r e c t o r y   s d   O N   s d . [ I D ] = p d . S u b D i r e c t o r y I D 
 
 L E F T   J O I N   d b o . M a i n D i r e c t o r y   m d   O N   m d . [ I D ] = s d . M a i n D i r e c t o r y I D 
 
 
 
 W H E R E   m d . [ S y s t e m ] = 1 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ S y s t e m E n t r y P a g e N a m e G e t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e G e t T i t l e s         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e G e t T i t l e s ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e G e t T i t l e s ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  K n o w l e d g e   T  K n o w l e d g e C o n t e n t   hԏVc[  @ P a g e D i r e c t o r y N a m e   Nv  T i t l e   U_S>f:yMR  5   ag	
 
 - - = = S_g*NubO v e r v i e w   ub	n:N  O u t l i n e   !j_vePbN^g(Wُ*Nub>f:yvQ@b	gN^\hvv'Y~
 
 - - = = kY(W N*N;NvU_,gv  O v e r v i e w   Q[ub>f:y;NvU_N@b	gP[vU_uvU_NvMR  5   agQ[
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 9 - 0 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e G e t T i t l e s 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 - - P a g e   D i r e t o r y   v  N a m e 
 
 @ C u l t u r e   n v a r c h a r ( 1 0 0 ) 	 	 	 	 	 	 - - S_MReS
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = _S_MR  P a g e D i r e c t o r y     v  T y p e   <PYg/f  1 RbNTbv~g\O(u  O r d e r   B y   S e r i a l   nfQ[N  S e r i a l   c^	  Yg/f  2   R  O r d e r   B y   U p d a t e T i m e   WNevQ[NS^ec^	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ T y p e   I N T 
 
 S E L E C T   @ T y p e = T y p e   F R O M   d b o . P a g e D i r e c t o r y   W H E R E   [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hԏV  K n o w l e d g e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ K n o w l e d g e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' K n o w l e d g e A p p r o v e ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  T y p e = 1 / 2   Q[TbO(u  O R D E R   B Y   S e r i a l   ؏/f  U p d a t e T i m e   NN$NkNxdN  O r d e r   B y   KNYvQ[0We[hQ N	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ T y p e = 1 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 S E L E C T   T O P   5 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 	 	 O R D E R   B Y   S e r i a l 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b
0
N/f0  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 S E L E C T   T O P   5 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '   o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D     n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 
 
 	 	 O R D E R   B Y   S e r i a l 
 
 	 E N D 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r   ؏/fnf(u7b
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F     d b o . U D F _ U s e r A d m i n E d i t o r ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b/f  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 S E L E C T   T O P   5 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e 
 
 
 
 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7b
0
N/f0  A d m i n   E d i t o r 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 S E L E C T   T O P   5 
 
 
 
 	 	 	 n o w . [ I D ]   A S   [ I D ] , 
 
 	 	 	 n o w . P a g e D i r e c t o r y I D   A S   P a g e D i r e c t o r y I D , 
 
 	 	 	 n o w . S e r i a l   A S   S e r i a l , 
 
 	 	 	 I S N U L L ( n o w c . H i d d e n , 0 )   A S   H i d d e n , 
 
 	 	 	 I S N U L L ( n o w c . A p p r o v e d , 0 )   A S   A p p r o v e d , 
 
 
 
 	 	 	 n o w c . [ I D ]   A S   K n o w l e d g e C o n t e n t I D , 
 
 	 	 	 n o w c . T i t l e   A S   T i t l e 
 
 
 
 	 	 F R O M   d b o . K n o w l e d g e   n o w 
 
 	 	 L E F T   J O I N   d b o . V i e w _ K n o w l e d g e P e r m i s s i o n   n o w p   O N   n o w p . K n o w l e d g e I D = n o w . [ I D ] 
 
 	 	 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ]   A N D   n o w c . C u l t u r e = @ C u l t u r e 
 
 	 	 L E F T   J O I N   d b o . P a g e D i r e c t o r y   p a d   O N   p a d . [ I D ] = n o w . P a g e D i r e c t o r y I D 
 
 	 	 W H E R E   p a d . [ N a m e ] = @ P a g e D i r e c t o r y N a m e   A N D   ( R E P L A C E ( n o w p . D e d i c a t e d T o , N ' , ' , N ' ' ) = N ' '     o r   d b o . U D F _ U s e r D e d i c a t e d T o ( @ U s e r , n o w p . D e d i c a t e d T o ) = 1 )     A N D   n o w c . H i d d e n < > 1   A N D   ( n o w c . A p p r o v e d = 1   O R   @ K n o w l e d g e A p p r o v e = N ' f a l s e ' ) 
 
 
 
 	 	 O R D E R   B Y   U p d a t e T i m e   D E S C 
 
 	 E N D 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e G e t T i t l e s ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . P a g e D i r e c t o r y C o n t e n t S e t O u t l i n e M o d e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t S e t O u t l i n e M o d e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t S e t O u t l i n e M o d e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \c[yNv  P a g e D i r e c t o r y C o n t e n t   yvv  O u t l i n e     ^\'`n:N  t r u e 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 8 - 2 9 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . P a g e D i r e c t o r y C o n t e n t S e t O u t l i n e M o d e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ P a g e D i r e c t o r y I D   i n t , 	 	 	 - - S_MR  P a g e D i r e c t o r y   v  I D 
 
 @ C u l t u r e   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MRy
 
 @ O u t l i n e M o d e   b i t 	 	 	 - - /f&T  O u t l i n e M o d e   1 / 0 	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' P a g e D i r e c t o r y ' , @ P a g e D i r e c t o r y I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR  P a g e D i r e c t o r y   v  O u t l i n e M o d e     n:N  1 / 0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . P a g e D i r e c t o r y C o n t e n t   S E T   O u t l i n e M o d e = @ O u t l i n e M o d e   W H E R E   P a g e D i r e c t o r y I D = @ P a g e D i r e c t o r y I D   A N D   [ C u l t u r e ] = @ C u l t u r e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ P a g e D i r e c t o r y C o n t e n t S e t O u t l i n e M o d e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s S e l e c t L i g h t W e i g h t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s S e l e c t L i g h t W e i g h t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s S e l e c t L i g h t W e i g h t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Qc[  R e s o u r c e s   v  L o g i c a l P a t h ,   H i d d e n ,   A p p r o v e d ,   T i t l e   Q*N^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 0 9 - 1 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s S e l e c t L i g h t W e i g h t 
 
 
 
 @ L o g i c a l P a t h   N V A R C H A R ( 2 0 0 0 ) 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - D E C L A R E   @ o P a s s   I N T 
 
 - - E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 - - I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
     
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 I F   ( @ L o g i c a l P a t h = N ' ' )   O R   ( @ L o g i c a l P a t h   I S   N U L L )   O R   ( @ L o g i c a l P a t h = N U L L ) 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 	bhQ  R e s o u r c e s   h
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 
 
 	 	 r e s . L o g i c a l P a t h   A S   L o g i c a l P a t h , 
 
 	 	 r e s . T i t l e   A S   T i t l e , 
 
 	 	 r e s . H i d d e n   A S   H i d d e n , 
 
 	 	 r e s . A p p r o v e d   A S   A p p r o v e d 
 
 
 
 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 	bc[  R e s o u r c e 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T 
 
 
 
 	 	 r e s . L o g i c a l P a t h   A S   L o g i c a l P a t h , 
 
 	 	 r e s . T i t l e   A S   T i t l e , 
 
 	 	 r e s . H i d d e n   A S   H i d d e n , 
 
 	 	 r e s . A p p r o v e d   A S   A p p r o v e d 
 
 
 
 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 
 
 	 W H E R E   r e s . L o g i c a l P a t h = @ L o g i c a l P a t h 
 
 
 
 E N D 
 
 	 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s S e l e c t L i g h t W e i g h t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s A p p r o v e S a v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s A p p r o v e S a v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s A p p r o v e S a v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[Dn[8hOo`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 0 2 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s A p p r o v e S a v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ N a m e   n v a r c h a r ( 2 0 0 0 ) , 	 	 	 - - S_MR  R e s o u r c e   v
TW[;_	
 
 @ F i l e D a t e   d a t e t i m e , 	 	 	 - - S_MR  R e s o u r c e   veg
 
 
 
 @ D i m e n s i o n W i d t h   i n t , 	 	 	 - - GPY/fVGrȒُ:NVGrv[^
 
 @ D i m e n s i o n H e i g h t   i n t , 	 	 	 - - GPY/fVGrȒُ:NVGrvؚ^
 
 
 
 @ F i l e S i z e   b i g i n t , 	 	 	 	 - - eN:\[
 
 
 
 @ H i d d e n   b i t , 	 	 	 	 - - /f&Tυ  N ' t r u e '     /     N ' f a l s e ' 	
 
 @ A p p r o v e d   i n t , 	 	 	 	 - - /f&T[8hǏ  0   /   1 	
 
 @ A p p r o v e M e s s a g e   n t e x t , 	 	 - - [8ha
 
 @ S c o r e   i n t 	 	 	 	 - - ċR
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	    
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 D E C L A R E   @ o P a s s   I N T     
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n ' , 0 , @ o P a s s   O U T     
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D     
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = RS_MR  R e s o u r c e   U_
0/f&T0X[(W$Ny`Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 
 
 I F   N O T   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . R e s o u r c e s   W h e r e   L o g i c a l P a t h = @ N a m e ) 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = Yg  R e s o u r c e s   -N
0
NX[(W0勇eNRmR
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = mR  R e s o u r c e   U_0R  R e s o u r c e s   h
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I N S E R T   d b o . R e s o u r c e s   ( L o g i c a l P a t h , F i l e D a t e , D i m e n s i o n W i d t h , D i m e n s i o n H e i g h t , F i l e S i z e , T a g , T i t l e , S u m m a r y , [ D e s c r i p t i o n ] , H i d d e n , A p p r o v e d , A p p r o v e M e s s a g e , A p p r o v e d B y , S c o r e , S c o r e C o u n t )   V A L U E S   ( @ N a m e , @ F i l e D a t e , @ D i m e n s i o n W i d t h , @ D i m e n s i o n H e i g h t , @ F i l e S i z e , N ' ' , N ' ' , N ' ' , N ' ' , @ H i d d e n , @ A p p r o v e d , @ A p p r o v e M e s s a g e , @ U s e r , @ S c o r e , 0 ) 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = Yg  R e s o u r c e s   -N]~
0X[(W0勇eNRO9e
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = O9e  R e s o u r c e s     hO9e[8hOo`NS  H i d d e n   Oo`
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 U P D A T E   d b o . R e s o u r c e s   S E T   H i d d e n = @ H i d d e n ,   A p p r o v e d = @ A p p r o v e d ,   A p p r o v e M e s s a g e = @ A p p r o v e M e s s a g e ,   A p p r o v e d B y = @ U s e r ,   S c o r e = @ S c o r e   W H E R E   L o g i c a l P a t h = @ N a m e 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s A p p r o v e S a v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s A p p r o v e Q u e r y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s A p p r o v e Q u e r y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s A p p r o v e Q u e r y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ُ*N  S P   v\O(uSS_MR(u7bE d m i n   E d i t o r 	CgPNvDn[8hRh  
 
 - - = = ^zRu:g6RHQ\ck8^g~gX[eQ N*N~g N7hFOYN N*NP a g i n g I D vhSϑ	9hncP a g i n g I D @ P a g e S i z e @ C u r r e n t P a g e 	SS_MRuvU_v^\;`upe\O:N N*NRhMOQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 1 - 0 6 - 2 6 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s A p p r o v e Q u e r y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z Oegv(u7b
 
 
 
 @ A p p r o v e Q u e r y F l a g   i n t , 	 	 	 - - g   _[8h  |     ][8h  |     bv[8h       R+RS<P    0 1 2 	
 
 
 
 @ P a g e S i z e   I N T , 	 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T , 	 	 	 - - ux:g6RS_MRu
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) 	 	 - - c^e_  A S C ,   D E S C 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = CgPhg
N 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (uegg^  W h e r e   NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 )         
 
 D E C L A R E   @ D y n W h e r e   N V A R C H A R ( 4 0 0 0 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^Ruh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = N '   S E T   N O C O U N T   O N       ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ P a g i n g   t a b l e   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ I D ]   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F i l e D a t e   d a t e t i m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D i m e n s i o n W i d t h   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D i m e n s i o n H e i g h t   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F i l e S i z e   b i g i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   T i t l e   n v a r c h a r ( 2 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   H i d d e n   b i t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A p p r o v e d   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   A p p r o v e d B y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = kXEQRuh
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n s e r t   i n t o   @ P a g i n g   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t         '     
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   r e s . [ I D ]   a s   [ I D ] ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   r e s . F i l e D a t e   a s   F i l e D a t e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I S N U L L ( r e s . D i m e n s i o n W i d t h , 0 )   a s   D i m e n s i o n W i d t h ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I S N U L L ( r e s . D i m e n s i o n H e i g h t , 0 )   a s   D i m e n s i o n H e i g h t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I S N U L L ( r e s . F i l e S i z e , 0 )   a s   F i l e S i z e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C a s e   r e s . T i t l e   W h e n   N u l l   T h e n   d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l p a t h )   W h e n   N ' ' ' '   T h e n   d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   E l s e   r e s . T i t l e   E n d   a s   T i t l e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I S N U L L ( r e s . H i d d e n , 0 )   a s   H i d d e n ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I S N U L L ( r e s . A p p r o v e d , 0 )   a s   A p p r o v e d ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I S N U L L ( r e s . A p p r o v e d B y , N ' ' ' ' )   a s   A p p r o v e d B y   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . R e s o u r c e s   r e s   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ A p p r o v e Q u e r y F l a g =   0 / 1 / 2   O(u
NTvagN    0   -   _[8h      1 -   ][8h      2   -   bv[8h	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ A p p r o v e Q u e r y F l a g C l a u s e   N V A R C H A R ( 1 0 0 0 ) 
 
 
 
 I F   @ A p p r o v e Q u e r y F l a g = 1 
 
 	 
 
 	 B E G I N 
 
 	 	 S E T   @ A p p r o v e Q u e r y F l a g C l a u s e = N '     r e s . A p p r o v e d = 1     ' 
 
 	 E N D 
 
 
 
 E L S E   I F   @ A p p r o v e Q u e r y F l a g = 2 
 
 	 
 
 	 B E G I N 
 
 	 	 S E T   @ A p p r o v e Q u e r y F l a g C l a u s e = N '     r e s . A p p r o v e d = 1   A N D   r e s . A p p r o v e d B y = N ' ' '   +   @ U s e r   +   N ' ' '     ' 
 
 	 E N D 
 
 E L S E 
 
 	 
 
 	 B E G I N 
 
 	 	 S E T   @ A p p r o v e Q u e r y F l a g C l a u s e = N '     r e s . A p p r o v e d < > 1     ' 	 	 
 
 	 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hncS_MR(u7bvCgPO(u
NTagN
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '     W H E R E   '   +   @ A p p r o v e Q u e r y F l a g C l a u s e 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R
N  O r d e r   B y   NS
 
 - - = = Yg  O r d e r B y = ' '   RO(u:w  o r d e r   b y   U p d a t e T i m e   D E S C 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ O r d e r B y = L T R I M ( R T R I M ( @ O r d e r B y ) ) 
 
 S E T   @ O r d e r B y O r d e r = L T R I M ( R T R I M ( @ O r d e r B y O r d e r ) ) 
 
 	 	 
 
 I F   L E N ( @ O r d e r B y ) = 0   O R     L E N ( @ O r d e r B y O r d e r ) = 0 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   F i l e D a t e   D E S C   ' 
 
 	 E N D 
 
 E L S E 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   [ '   +   @ O r d e r B y   +   N ' ]   '   +   @ O r d e r B y O r d e r 
 
 	 E N D 
 
 	 	 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e t   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   * , P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ P a g e S i z e )   +   N ' ) )   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ F i r s t R e c o r d )   +   N '   a n d   P a g i n g I D < '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgR`Sv^
NSNǏ|~
NP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s D y n S Q L   I N T 
 
 E X E C   d b o . P u b l i c D y n S Q L L e n g t h C h e c k   @ D y n S Q L , @ o P a s s D y n S Q L   O U T 
 
 I F   @ o P a s s D y n S Q L = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLR`  S Q L   S   _Y~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s A p p r o v e Q u e r y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O N   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s S a v e L i g h t W e i g h t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s S a v e L i g h t W e i g h t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s S a v e L i g h t W e i g h t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = OX[  R e s o u r c e s   v{ϑHr,gNDn^*NSeNُNeNS/f  F T P   
NegvُNeNvOo`؏leQpenc^bNO(u,g  S P   \ُNeNvOo`*NTek
Neg
 
 - - = = SOX[  R e s o u r c e s   h-N
NX[(WvU_  ]~X[(Wvf/fǏ+Rve_]~OX[
NegN	
 
 - - = = SOX[  L o g i c a l P a t h ,   F i l e D a t e ,   D i m e n s i o n W i d t h , D i m e n s i o n H e i g h t , F i l e S i z e   Q*NW[k  H i d d e n ,   A p p r o v e d   O(u؞<P  0 , 0 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 0 2 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s S a v e L i g h t W e i g h t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) , 	 	 - - S_MR  R e s o u r c e   v;_
 
 @ F i l e D a t e   d a t e t i m e , 	 	 	 - - S_MR  R e s o u r c e   veNeg gT N!kO9eveg	
 
 @ D i m e n s i o n W i d t h   i n t , 	 	 	 - - S_MR  R e s o u r c e   Yg/fVGr	vVGr[^
 
 @ D i m e n s i o n H e i g h t   i n t , 	 	 	 - - S_MR  R e s o u r c e   Yg/fVGr	vVGrؚ^
 
 @ F i l e S i z e   b i g i n t , 	 	 	 	 - - S_MR  R e s o u r c e   veN:\[
 
 
 
 @ o R e s u l t   i n t   O U T 	 	 	 - - YgDn؏l	geQ^mRTԏV  1 YgDn]~(Wpenc^-NX[(WԏV  0   bN(W  S P   vm9:WTO9hncُ*NԏV~gJTɋ|~[RRMSvDneNO(u
NTrۏLhl	
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 
NX[(WRmR
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   N O T   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . R e s o u r c e s   W h e r e   L o g i c a l P a t h = @ L o g i c a l P a t h ) 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = mR  R e s o u r c e s   U_
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I N S E R T   I N T O   d b o . R e s o u r c e s ( L o g i c a l P a t h , F i l e D a t e , D i m e n s i o n W i d t h , D i m e n s i o n H e i g h t , F i l e S i z e , T a g , T i t l e , S u m m a r y , [ D e s c r i p t i o n ] , H i d d e n , A p p r o v e d , A p p r o v e M e s s a g e , A p p r o v e d B y , S c o r e , S c o r e C o u n t )   V A L U E S ( @ L o g i c a l P a t h , @ F i l e D a t e , @ D i m e n s i o n W i d t h , @ D i m e n s i o n H e i g h t , @ F i l e S i z e , N ' ' , N ' ' , N ' ' , N ' ' , 0 , 0 , N ' ' , N ' ' , 0 , 0 ) 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = eN
NX[(WmRTԏV  1 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T   @ o R e s u l t = 1 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N     
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = eN]~X[(WRQ:_7Re NN  F i l e D a t e ,   D i m e n s i o n W i d t h ,   D i m e n s i o n H e i g h t ,   F i l e S i z e 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 U P D A T E   d b o . R e s o u r c e s   S E T   F i l e D a t e = @ F i l e D a t e ,   D i m e n s i o n W i d t h = @ D i m e n s i o n W i d t h ,   D i m e n s i o n H e i g h t = @ D i m e n s i o n H e i g h t ,   F i l e S i z e = @ F i l e S i z e   W H E R E   L o g i c a l P a t h = @ L o g i c a l P a t h 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = eN]~X[(WԏV  0 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T   @ o R e s u l t = 0 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s S a v e L i g h t W e i g h t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s Q u e r y B y F i l e N a m e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s Q u e r y B y F i l e N a m e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s Q u e r y B y F i l e N a m e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  F i l e N a m e   d"}  R e s o u r c e s 
 
 - - = = ^zRu:g6RHQ\ck8^g~gX[eQ N*N~g N7hFOYN N*NP a g i n g I D vhSϑ	9hncP a g i n g I D @ P a g e S i z e @ C u r r e n t P a g e 	SS_MRuvU_v^\;`upe\O:N N*NRhMOQ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 0 2 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s Q u e r y B y F i l e N a m e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  a s p x   z OǏegv(u7b
T
 
 
 
 @ F i l e N a m e   n v a r c h a r ( 2 0 0 0 ) , 	 	 - - d"}  T a g   Y  N ' L o g o , B a n n e r '             b    N ' * '           b      N ' Ɖ+ ^JT' 	
 
 
 
 @ S e a r c h D i r e c t o r y   n v a r c h a r ( 2 0 0 0 ) , 	 - - NT*NvU_Nd"}    l(W(u  S P   e:N  S P   cOSpeveP@ S e a r c h D i r e c t o r y   ]~nxOS+TN gTv  " / " Y  / w r i t a b l e / r e s o u r c e /   	
 
 @ I n c l u d e S u b d i r e c t o r y   b i t , 	 	 - - d"}veP/f&TS+TN~vU_
 
 
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) , 	 	 - - c^e_  A S C ,   D E S C 
 
 
 
 @ P a g e S i z e   I N T , 	 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T 	 	 	 - - ux:g6RS_MRu
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = [  @ F i l e N a m e   SpeۏLYt\vQ-Nv   *    M&{bcb  % 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ F i l e N a m e = R E P L A C E ( @ F i l e N a m e , N ' * ' , N ' % ' ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	l2 0 1 0 - 0 7 - 1 2 1uN_eQN  R e s o u r c e   R e f e r e n c e   :g6RVdks(W
NQP6R  S P   vCgPV:N(W  R e s o u r c e   R e f e r e n c e   -N_SSunfvub_(u  R e s o u r c e   v`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - D E C L A R E   @ o P a s s   I N T 
 
 - - E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 - - I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^Ruh  
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   N O C O U N T   O N 
 
 
 
 D E C L A R E   @ P a g i n g   T A B L E 
 
 (   
 
 	 P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   
 
 	 [ I D ]   i n t ,   
 
 	 L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 [ F i l e N a m e ]   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   
 
 	 F i l e D a t e   d a t e t i m e , 
 
 	 D i m e n s i o n W i d t h   i n t , 
 
 	 D i m e n s i o n H e i g h t   i n t , 
 
 	 F i l e S i z e   b i g i n t , 
 
 	 T a g   n v a r c h a r ( 1 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 T i t l e   n v a r c h a r ( 2 0 0 )     C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 S u m m a r y   n v a r c h a r ( 4 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 [ D e s c r i p t i o n ]   n v a r c h a r ( 4 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 H i d d e n   b i t , 
 
 	 A p p r o v e d   i n t , 
 
 	 A p p r o v e M e s s a g e   n v a r c h a r ( 4 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 A p p r o v e d B y   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t , 
 
 	 S c o r e   i n t , 
 
 	 S c o r e C o u n t   i n t 
 
   )   
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N  O p t i o n   hgw  R e s o u r c e A p p r o v e   ^\'`
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ R e s o u r c e A p p r o v e   N V A R C H A R ( 5 0 ) 
 
 S E L E C T   @ R e s o u r c e A p p r o v e = C O N V E R T ( N V A R C H A R ( 5 0 ) , o p t . [ V a l u e ] )   F R O M   d b o . [ O p t i o n ]   o p t   W H E R E   o p t . [ K e y ] = N ' R e s o u r c e A p p r o v e ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spe  @ O r d e r B y   T  @ O r d e r B y O r d e r   RYS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ O r d e r B y = N ' '   O R   @ O r d e r B y = N U L L   O R   @ O r d e r B y   I S   N U L L 
 
 
 
 B E G I N 
 
 	 S E L E C T   @ O r d e r B y = N ' F i l e D a t e ' 
 
 E N D 
 
 
 
 I F   @ O r d e r B y O r d e r = N ' '   O R   @ O r d e r B y O r d e r = N U L L   O R   @ O r d e r B y O r d e r   I S   N U L L 
 
 
 
 B E G I N 
 
 	 S E L E C T   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = kXEQRuh  R  @ I n c l u d e S u b d i r e c t o r y = 1 / 0   $Ny`b_	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   @ I n c l u d e S u b d i r e c t o r y = 1 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 9hncS_MR(u7b҉rR$Ny`Q  |~{tXTԏVhQ^|~{tXTSԏV  H i d d e n = f a l s e   NS  A p p r o v e d = 1   vyv	
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = d"}
0S+T0N~vU_  |     S_MR(u7b
0/f0  A d m i n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - 
NTv  O r d e r B y   T  O r d e r B y O r d e r     NN  6   kNx/U Nv:S+R/f    O r d e r   B y   NS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 ) 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   A S C 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 ) 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   A S C 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 ) 
 
 	 	 O R D E R   B Y   r e s . S c o r e   A S C 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 ) 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   D E S C 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 ) 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   D E S C 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 ) 
 
 	 	 O R D E R   B Y   r e s . S c o r e   D E S C 	 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = d"}
0S+T0N~vU_  |     S_MR(u7b
0
N/f0  A d m i n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - 
NTv  O r d e r B y   T  O r d e r B y O r d e r     NN  6   kNx/U Nv:S+R/f    O r d e r   B y   NS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 	 	 
 
 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 	 	 
 
 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 	 	 
 
 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   r e s . S c o r e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 	 	 
 
 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 	 	 
 
 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 	 	 
 
 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( @ S e a r c h D i r e c t o r y , r e s . L o g i c a l P a t h ) > 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   r e s . S c o r e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E N D 
 
 
 
 E L S E 
 
 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = 9hncS_MR(u7b҉rR$Ny`Q  |~{tXTԏVhQ^|~{tXTSԏV  H i d d e n = f a l s e   NS  A p p r o v e d = 1   vyv	
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 I F   d b o . U D F _ U s e r A d m i n ( @ U s e r ) = 1 
 
 
 
 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = d"}
0
N0S+TN~vU_  |     S_MR(u7b
0/f0A d m i n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - 
NTv  O r d e r B y   T  O r d e r B y O r d e r     NN  6   kNx/U Nv:S+R/f    O r d e r   B y   NS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 ) 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 ) 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 ) 
 
 	 	 O R D E R   B Y   r e s . S c o r e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 ) 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 ) 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 ) 
 
 	 	 O R D E R   B Y   r e s . S c o r e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 	 E L S E 
 
 
 
 	 B E G I N 
 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = d"}
0
N0S+TN~vU_  |     S_MR(u7b
0
N/f0  A d m i n 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - 
NTv  O r d e r B y   T  O r d e r B y O r d e r     NN  6   kNx/U Nv:S+R/f    O r d e r   B y   NS	
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' A S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   r e s . S c o r e   A S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e N a m e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   [ F i l e N a m e ]   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e D a t e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   r e s . F i l e D a t e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 	 E L S E   I F   @ O r d e r B y = N ' F i l e S c o r e '   A N D   @ O r d e r B y O r d e r = N ' D E S C ' 
 
 
 
 	 	 B E G I N 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 I N S E R T   I N T O   @ P a g i n g   	 	 
 
 	 	 S E L E C T       D I S T I N C T 
 
 	 	 
 
 	 	 	 r e s . [ I D ]   a s   [ I D ] ,   
 
 	 	 	 r e s . L o g i c a l P a t h   a s   L o g i c a l P a t h ,   
 
 	 	 	 d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   a s   [ F i l e N a m e ] , 
 
 	 	 	 r e s . F i l e D a t e   a s   F i l e D a t e , 
 
 	 	 	 r e s . D i m e n s i o n W i d t h   a s   D i m e n s i o n W i d t h , 
 
 	 	 	 r e s . D i m e n s i o n H e i g h t   a s   D i m e n s i o n H e i g h t , 
 
 	 	 	 r e s . F i l e S i z e   a s   F i l e S i z e , 
 
 	 	 	 r e s . T a g   a s   T a g , 
 
 	 	 	 r e s . T i t l e   a s   T i t l e , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . S u m m a r y )   a s   S u m m a r y , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . [ D e s c r i p t i o n ] )   a s   [ D e s c r i p t i o n ] , 
 
 	 	 	 r e s . H i d d e n   a s   H i d d e n , 
 
 	 	 	 r e s . A p p r o v e d   a s   A p p r o v e d , 
 
 	 	 	 C O N V E R T ( N V A R C H A R ( 4 0 0 0 ) , r e s . A p p r o v e M e s s a g e )   a s   A p p r o v e M e s s a g e , 
 
 	 	 	 r e s . A p p r o v e d B y   a s   A p p r o v e d B y , 
 
 	 	 	 r e s . S c o r e   a s   S c o r e , 
 
 	 	 	 r e s . S c o r e C o u n t   a s   S c o r e C o u n t 
 
 	 	 
 
 	 	 F R O M   d b o . R e s o u r c e s   r e s 
 
 	 	 W H E R E   ( d b o . U D F _ P u b l i c R e s o l v e F i l e N a m e ( r e s . L o g i c a l P a t h )   L I K E   ( N ' % '   +   @ F i l e N a m e   +   N ' % ' ) )   A N D   ( C H A R I N D E X ( N ' / ' , R E P L A C E ( r e s . L o g i c a l P a t h , @ S e a r c h D i r e c t o r y , N ' ' ) ) = 0 )   A N D   ( r e s . H i d d e n < > 1 )   A N D   ( r e s . A p p r o v e d = 1   O R   @ R e s o u r c e A p p r o v e = N ' f a l s e ' ) 
 
 	 	 O R D E R   B Y   r e s . S c o r e   D E S C 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 	 	 E N D 
 
 
 
 	 E N D 
 
 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 	 	 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 	 	 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 S E L E C T   
 
 	 * , 
 
 	 P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , @ P a g e S i z e ) )   
 
 
 
 F R O M   @ P a g i n g 
 
 
 
 W H E R E   P a g i n g I D > @ F i r s t R e c o r d   A N D   P a g i n g I D < @ L a s t R e c o r d 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s Q u e r y B y F i l e N a m e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s M o d i f y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s M o d i f y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s M o d i f y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9e  R e s o u r c e s 
 
 - - = = T a g   \QYO0WOX[(W$N*NMOn1 .   R e s o u r c e s   hN  " , "    _vW[&{2N	        2 .   R e s o u r c e s T a g s     US N  T a g   N  R e s o u r c e s I D   [^  R e s o u r c e s   h	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~  S c o r e   :g6RdN(W  R e s o u r c e s   h	g  S c o r e   T  S c o r e C o u n t   U_KNYR e s o u r c e s S c o r e   h؏\OX[k N!kSbRU_R e s o u r c e I D SbRv  I P SbReRpe	k!kSbRꁨR{Qs^GW<PQYOOX[0R  R e s o u r c e s   hv  S c o r e   RSbR!kpe_NQYOOX[0R  S c o r e C o u n t   R0ُ7hZPvvv/f:NN_ԏVg*NDnvRpeNSbR!kpe
N_k!ks{
 
 - - = = |~{tXT(W  M o d i f y R e s o u r c e   -NSN:_Lv  S c o r e   Rv<PFO  S c o r e C o u n t   
NOvV:N  R e s o u r c e s . S c o r e   e/f gevVdk|~{tXTۏeQ  M o d i f y R e s o u r c e   Lubw0RvRpe_N/fQnxvNYg
N`vُ*NSbRSN
NO9evcOX[ُWYRpeO6qOc
NS
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 0 2 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s M o d i f y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ O l d L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) , 	 - - S_MR  R e s o u r c e   v
0e0;_
 
 @ N e w L o g i c a l P a t h   n v a r c h a r ( 2 0 0 0 ) , 	 - - S_MR  R e s o u r c e   v
0e0;_
 
 
 
 @ F i l e D a t e   d a t e t i m e , 	 	 	 - - S_MR  R e s o u r c e   veNeg gT N!kO9eveg	
 
 
 
 @ D i m e n s i o n W i d t h   i n t , 	 	 	 - - Yg/fVGrvQ[^
 
 @ D i m e n s i o n H e i g h t   i n t , 	 	 	 - - Yg/fVGrvQؚ^
 
 @ F i l e S i z e   b i g i n t , 	 	 	 	 - - eN:\[
 
 
 
 @ T a g   n v a r c h a r ( 1 0 0 0 ) , 	 	 	 - - S_MR  R e s o u r c e   vh~{N  " , "   Y*Nh~{	
 
 @ T i t l e   n v a r c h a r ( 2 0 0 ) , 	 	 	 - - S_MR  R e s o u r c e   vh
 
 @ S u m m a r y   n t e x t , 	 	 	 - - S_MR  R e s o u r c e   vi
 
 @ D e s c r i p t i o n   n t e x t , 	 	 	 - - S_MR  R e s o u r c e   vc
 
 @ H i d d e n   b i t , 	 	 	 	 - - S_MR  R e s o u r c e   /f&Tυ
 
 @ A p p r o v e d   i n t , 	 	 	 	 - - S_MR  R e s o u r c e   /f&T[8hǏ
 
 @ A p p r o v e M e s s a g e   n t e x t , 	 	 - - S_MR  R e s o u r c e   v[8ha
 
 @ S c o r e   i n t 	 	 	 	 - - S_MR  R e s o u r c e   vċR
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O9ev  R e s o u r c e s   vU_  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ R e s o u r c e s I D   I N T 
 
 S E L E C T   @ R e s o u r c e s I D = r e s . [ I D ]   F R O M   d b o . R e s o u r c e s   r e s   W H E R E   r e s . L o g i c a l P a t h = @ O l d L o g i c a l P a t h 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S c o r e C o u n t   Oc
NSSpeS	g(W(u7bSbRvePMbO/}R0Ȓُ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ S c o r e C o u n t   I N T 
 
 S E L E C T   @ S c o r e C o u n t = r e s . S c o r e C o u n t   F R O M   d b o . R e s o u r c e s   r e s   W H E R E   r e s . [ I D ] = @ R e s o u r c e s I D 
 
 
 
 I F   @ S c o r e C o u n t = N U L L   O R   @ S c o r e C o u n t   I S   N U L L 
 
 B E G I N 
 
 	 S E L E C T   @ S c o r e C o u n t = 0 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ Rd  R e s o u r c e s     -NS]~X[(WNv勇eNvU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . R e s o u r c e s   W H E R E   [ I D ] = @ R e s o u r c e s I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = c@w Rd  R e s o u r c e s T a g s     -N[^v  T a g   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . R e s o u r c e s T a g s   W H E R E   R e s o u r c e s I D = @ R e s o u r c e s I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = mR  R e s o u r c e s   U_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . R e s o u r c e s ( L o g i c a l P a t h , F i l e D a t e , D i m e n s i o n W i d t h , D i m e n s i o n H e i g h t , F i l e S i z e , T a g , T i t l e , S u m m a r y , [ D e s c r i p t i o n ] , H i d d e n , A p p r o v e d , A p p r o v e M e s s a g e , A p p r o v e d B y , S c o r e , S c o r e C o u n t )   V A L U E S ( @ N e w L o g i c a l P a t h , @ F i l e D a t e , @ D i m e n s i o n W i d t h , @ D i m e n s i o n H e i g h t , @ F i l e S i z e , @ T a g , @ T i t l e , @ S u m m a r y , @ D e s c r i p t i o n , @ H i d d e n , @ A p p r o v e d , @ A p p r o v e M e s s a g e , @ U s e r , @ S c o r e , @ S c o r e C o u n t ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = zsSUcRROX[vagmo`v  I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o N e w I D   I N T 
 
 S E L E C T   @ o N e w I D = S C O P E _ I D E N T I T Y ( ) 	 - - QSpeI{NRRubveU_vI D S C O P E _ I D E N T I T Y ( )   asT@wNPN,g  S e e s i o n   Qv,gh	
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  T a g   S/f ,     _vRh	ROX[(W  R e s o u r c e s T a g s   h
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I N S E R T   I N T O   d b o . R e s o u r c e s T a g s ( R e s o u r c e s I D , T a g )   S E L E C T   @ o N e w I D ,   E l e m e n t   F R O M   d b o . U D F _ P u b l i c S p l i t ( @ T a g , N ' , ' ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s M o d i f y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s F o l d e r M o v e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 1   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s F o l d e r M o v e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s F o l d e r M o v e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = yRg*NvU_NvhQ  R e s o u r c e s 
 
 - - = = [  R e s o u r c e s   h@b	gU_\vQ  L o g i c a l P a t h   MRbv    O l d F o l d e r     vU_RO9e:N  N e w F o l d e r   vU_R
 
 - - = = kYYg\  a v i   vU_yR0R  m p p p   vU_NR\  / w r i t a b l e / r e s o u r c e s / a v i / . . .     O9e:N  / w r i t a b l e / r e s o u r c e s / m p p p / a v i / . . . 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 0 9   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 0 9 - 0 9 - 2 5 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s F o l d e r M o v e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ O l d F o l d e r   n v a r c h a r ( 2 0 0 0 ) , 	 	 - - 1\  R e s o u r c e s   eN9Y@b(WvU__
 
 @ N e w F o l d e r   n v a r c h a r ( 2 0 0 0 ) 	 	 - - yRTveeN9Y]~S+TNꁫR	@b(WvU__
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \  L o g i c a l P a t h   -NMRb:N  @ O l d F o l d e r   vRO9e:N  @ N e w F o l d e r 
 
 - - = = :NNHNO(u  N ' ? ' + L o g i c a l P a t h ُ7hZPvvv/f:NNnxOSN_v] _YvMOnۏLfbcN2SuN      / w r i t a b l e / r e s o u r c e / m p p p / m y / w r i t a b l e / r e s o u r c e / m p p p / a v i     -Nfbc  / w r i t a b l e / r e s o u r c e / m p p p /   [_-Nv  / w r i t a b l e / r e s o u r c e / m p p p /   _NfbcvN`  V:NbNvfbc/fS[_]OvRv	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 U P D A T E   d b o . R e s o u r c e s   S E T   L o g i c a l P a t h =   R E P L A C E ( N ' ? ' + L o g i c a l P a t h , N ' ? ' + @ O l d F o l d e r , @ N e w F o l d e r )   W H E R E   C H A R I N D E X ( N ' ? ' + @ O l d F o l d e r , N ' ? ' + L o g i c a l P a t h ) > 0 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s F o l d e r M o v e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . R e s o u r c e s F o l d e r C o p y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ R e s o u r c e s F o l d e r C o p y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ R e s o u r c e s F o l d e r C o p y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 
Y6Rg*NvU_NvhQ  R e s o u r c e s   0R N*NevU_
 
 - - = = [  R e s o u r c e s   h@b	gU_\vQ  L o g i c a l P a t h   MRb:N    O l d F o l d e r     RvU_ۏL
Y6Rv^\  O l d F o l d e r   RO9e:N  N e w F o l d e r   R
 
 - - = = kYYg\  a v i   vU_
Y6R0R  m p p p   vU_NR\  L o g i c a l P a t h   MRbS+T  / w r i t a b l e / r e s o u r c e s / a v i / . . .     vU_
Y6RTv^\vQ  L o g i c a l P a t h   v    / w r i t a b l e / r e s o u r c e s / a v i /   RO9e:N  / w r i t a b l e / r e s o u r c e s / m p p p / a v i / . . . 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 0 2 - 2 3 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . R e s o u r c e s F o l d e r C o p y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ S o u r c e F o l d e r   n v a r c h a r ( 2 0 0 0 ) , 	 	 - - 
Y6Rv  R e s o u r c e   eN9Y@b(WvvU__
 
 @ T a r g e t F o l d e r   n v a r c h a r ( 2 0 0 0 ) 	 	 - - vheN9Y@b(WvvU__
 
 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg  S/f  A d m i n   C h i e f E d i t o r ,   C o l u m n E d i t o r   	N*NCgPSN	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' A d m i n E d i t o r ' , 0 , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S  @ S o u r c e F o l d e r   N@b	gU_ub  C U R S O R 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ L o g i c a l P a t h   N V A R C H A R ( 2 0 0 0 ) 
 
 D E C L A R E   @ F i l e D a t e   D A T E T I M E 
 
 D E C L A R E   @ D i m e n s i o n W i d t h   I N T 
 
 D E C L A R E   @ D i m e n s i o n H e i g h t   I N T 
 
 D E C L A R E   @ F i l e S i z e   B I G I N T 
 
 D E C L A R E   @ T a g   N V A R C H A R ( 1 0 0 0 ) 
 
 D E C L A R E   @ T i t l e   N V A R C H A R ( 2 0 0 ) 
 
 D E C L A R E   @ S u m m a r y   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ D e s c r i p t i o n   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ H i d d e n   B I T 
 
 D E C L A R E   @ A p p r o v e d   I N T 
 
 D E C L A R E   @ A p p r o v e M e s s a g e   N V A R C H A R ( 4 0 0 0 ) 
 
 D E C L A R E   @ A p p r o v e d B y   N V A R C H A R ( 5 0 ) 
 
 D E C L A R E   @ S c o r e   I N T 
 
 D E C L A R E   @ S c o r e C o u n t   I N T 
 
 
 
 D E C L A R E   S o u r c e _ C u r s o r   C U R S O R   F O R   S E L E C T   r e s . L o g i c a l P a t h ,   r e s . F i l e D a t e ,   r e s . D i m e n s i o n W i d t h , r e s . D i m e n s i o n H e i g h t , r e s . F i l e S i z e , r e s . T a g ,   r e s . T i t l e , r e s . S u m m a r y ,   r e s . [ D e s c r i p t i o n ] ,   r e s . H i d d e n ,   r e s . A p p r o v e d ,   r e s . A p p r o v e M e s s a g e ,   r e s . A p p r o v e d B y ,   r e s . S c o r e ,   r e s . S c o r e C o u n t   F R O M   d b o . R e s o u r c e s   r e s   W H E R E   C H A R I N D E X ( N ' ? ' + @ S o u r c e F o l d e r , N ' ? ' + r e s . L o g i c a l P a t h ) > 0 
 
 O P E N   S o u r c e _ C u r s o r 
 
 
 
 F E T C H   N E X T   F R O M   S o u r c e _ C u r s o r   
 
 I N T O   @ L o g i c a l P a t h ,   @ F i l e D a t e ,   @ D i m e n s i o n W i d t h ,   @ D i m e n s i o n H e i g h t ,   @ F i l e S i z e ,   @ T a g ,   @ T i t l e ,   @ S u m m a r y ,   @ D e s c r i p t i o n ,   @ H i d d e n ,   @ A p p r o v e d ,   @ A p p r o v e M e s s a g e ,   @ A p p r o v e d B y ,   @ S c o r e ,   @ S c o r e C o u n t 
 
 
 
 W H I L E   @ @ F E T C H _ S T A T U S   =   0 
 
 B E G I N 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = \S_MR
Y6Rv  @ L o g i c a l P a t h   O9e:N  @ T a r g e t F o l d e r   Nv
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 S E L E C T   @ L o g i c a l P a t h = R E P L A C E ( N ' ? ' + @ L o g i c a l P a t h , N ' ? ' + @ S o u r c e F o l d e r , @ T a r g e t F o l d e r ) 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = \S_MRU_
Y6R  (u  S P   R e s o u r c e s S a v e 	
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 E X E C     d b o . R e s o u r c e s S a v e   @ U s e r ,   @ L o g i c a l P a t h ,   @ F i l e D a t e ,   @ D i m e n s i o n W i d t h ,   @ D i m e n s i o n H e i g h t ,   @ F i l e S i z e ,   @ T a g ,   @ T i t l e ,   @ S u m m a r y ,   @ D e s c r i p t i o n ,   @ H i d d e n ,   @ A p p r o v e d ,   @ A p p r o v e M e s s a g e ,   @ S c o r e 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = ؏e
N  S P   R e s o u r c e s S a v e   @b
NwQYv$N*NR  @ A p p r o v e d B y   T  @ S c o r e C o u n t 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 U P D A T E   d b o . R e s o u r c e s   S E T   A p p r o v e d B y = @ A p p r o v e d B y ,   S c o r e C o u n t = @ S c o r e C o u n t   W H E R E   L o g i c a l P a t h = @ L o g i c a l P a t h 
 
 
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 - - = = N N*N
 
 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 F E T C H   N E X T   F R O M   S o u r c e _ C u r s o r   
 
 	 I N T O   @ L o g i c a l P a t h ,   @ F i l e D a t e ,   @ D i m e n s i o n W i d t h ,   @ D i m e n s i o n H e i g h t ,   @ F i l e S i z e ,   @ T a g ,   @ T i t l e ,   @ S u m m a r y ,   @ D e s c r i p t i o n ,   @ H i d d e n ,   @ A p p r o v e d ,   @ A p p r o v e M e s s a g e ,   @ A p p r o v e d B y ,   @ S c o r e ,   @ S c o r e C o u n t 
 
 
 
 E N D 
 
 
 
 C L O S E   S o u r c e _ C u r s o r 
 
 D E A L L O C A T E   S o u r c e _ C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ R e s o u r c e s F o l d e r C o p y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c S t a t u s S e t R e v o k e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c S t a t u s S e t R e v o k e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c S t a t u s S e t R e v o k e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = d   E l i t e   T  T a b o o   vn
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 1 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c S t a t u s S e t R e v o k e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   i n t 	 	 	 - - ;Nv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgS	g|~{tXTTezMb	gCgPd [ N*N;N  E l i t e   T  T a b o o   vn	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e t S t a t u s   @ U s e r , @ T o p i c I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQ_S_MR  T o p i c   Nvߍ^peϑ9hncُ*NpeϑQ[  T o p i c   v    S t a t u s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ T o p i c S t a t u s   I N T 
 
 
 
 S E T   @ T o p i c S t a t u s = 
 
 ( 
 
 	 S e l e c t   
 
 	 	 C a s e   
 
 	 	 	 W h e n   C o u n t ( [ I D ] )   I S   N U L L   T h e n   1   	 	 	 - - zz;N
 
 	 	 	 W h e n   C o u n t ( [ I D ] ) < 1   T h e n   1 	 	 	 	 - - zz;N
 
 	 	 	 W h e n   C o u n t ( [ I D ] ) > = 1   A n d   C o u n t ( [ I D ] ) < 1 0   T h e n   2 	 	 - - ^zz;N
 
 	 	 	 W h e n   C o u n t ( [ I D ] ) > = 1 0   T h e n   3 	 	 	 	 - - p;N
 
 	 	   E n d   
 
 
 
 	 	 F r o m   d b o . F o l l o w U p   W h e r e   T o p i c I D = @ T o p i c I D 
 
 ) 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = n
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . T o p i c   S E T   T o p i c S t a t u s = @ T o p i c S t a t u s   W H E R E   [ I D ] = @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c S t a t u s S e t R e v o k e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c U s e r A u t h e n t i c a t i o n S a v e S i l e n t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S a v e S i l e n t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S a v e S i l e n t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S P   T o p i c U s e r A u t h e n t i c a t i o n S a v e   v[YHr,g  SQ  o P a s s   ~g
NԏVmo`	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c U s e r A u t h e n t i c a t i o n S a v e S i l e n t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ F o r u m   I N T , 	 	 	 - - c[  F o r u m 
 
 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O(u  U D F _ F o r u m T o p i c W r i t a b l e   QpehgS_MR(u7b[S_MR[W/f&T	gS4CgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ F o r u m T o p i c W r i t a b l e ( @ U s e r , @ F o r u m ) = 0   O R   @ U s e r = N ' ' 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - S E T   @ o P a s s = d b o . U D F _ F o r u m T o p i c W r i t a b l e ( @ U s e r , @ F o r u m ) 
 
 - - R E T U R N 
 
 
 
 / * 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7bl	glQ:N  C o m m u n i t y   (u7bRԏV  0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( d b o . U D F _ U s e r C o m m u n i t y ( @ U s e r ) < > 1 )     A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 ) 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7b/f  C o m m u n i t y FO(W  U s e r F o r u m s   -N  [,g  F o r u m   Mnv  T o p i c W r i t e E n a b l e d   CgP
N/f  1 RԏV  0 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( N O T   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . U s e r F o r u m s   W h e r e   [ U s e r ] = @ U s e r   A n d   F o r u m = @ F o r u m   A n d   T o p i c W r i t e E n a b l e d = 1 ) )   A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 ) 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R E T U R N 
 
 E N D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c U s e r A u t h e n t i c a t i o n S a v e S i l e n t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e S i l e n t         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e S i l e n t ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e S i l e n t ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = S P   F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e   v[YHr,g  SQ~g
NQmo`	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e S i l e n t 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c   I N T , 	 	 	 - - c[  T o p i c 
 
 
 
 @ o P a s s   I N T   O U T 	 	 - - QSpeǏԏV  1 &TR  0 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HQGP  hgǏ
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ o P a s s = 1 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  T o p i c   I D   _  F o r u m   I D 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ F o r u m   I N T 
 
 S E T   @ F o r u m = d b o . U D F _ G e t F o r u m I D F r o m T o p i c I D ( @ T o p i c ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = O(u  U D F _ F o r u m F o l l o w U p W r i t a b l e   QpehgS_MR(u7b[S_MR[W/f&T	gߍ4CgP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   d b o . U D F _ F o r u m F o l l o w U p W r i t a b l e ( @ U s e r , @ F o r u m ) = 0   O R   @ U s e r = N ' ' 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 / * 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7bl	glQ:N  C o m m u n i t y (u7bR>Nv^ Q
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( d b o . U D F _ U s e r C o m m u n i t y ( @ U s e r ) < > 1 )     A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 ) 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R E T U R N 
 
 E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = YgS_MR(u7b/f  C o m m u n i t y FO(W  U s e r F o r u m s   -N  [,g  F o r u m   Mnv  T o p i c W r i t e E n a b l e d   CgP
N/f  1 R>Nv^ Q  f(u7bl	g[  F o r u m   S^CgP	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 I F   ( N O T   E X I S T S   ( S e l e c t   [ I D ]   F r o m   d b o . U s e r F o r u m s   W h e r e   [ U s e r ] = @ U s e r   A n d   F o r u m = @ F o r u m   A n d   F o l l o w U p W r i t e E n a b l e d = 1 ) )   A N D   ( d b o . U D F _ U s e r A d m i n ( @ U s e r ) < > 1 ) 
 
 
 
 B E G I N 
 
 	 S E T   @ o P a s s = 0 
 
 	 R E T U R N 
 
 E N D 
 
 * / 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ F o l l o w U p U s e r A u t h e n t i c a t i o n S a v e S i l e n t ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . T o p i c S t a t u s S e t S t i c k y         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 4   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ T o p i c S t a t u s S e t S t i c k y ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ T o p i c S t a t u s S e t S t i c k y ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \g*N;Nn:Nnv;N
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4   
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . T o p i c S t a t u s S e t S t i c k y 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ T o p i c I D   i n t 	 	 	 - - ;Nv  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhgS	g|~{tXTTezMb	gCgPnv	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . T o p i c U s e r A u t h e n t i c a t i o n S e t S t a t u s   @ U s e r , @ T o p i c I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = n
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 U P D A T E   d b o . T o p i c   S E T   T o p i c S t a t u s = 6   W H E R E   [ I D ] = @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHhO9eN^P[	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   1 4 ,   @ T o p i c I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ T o p i c S t a t u s S e t S t i c k y ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . C o m m u n i t y R e f e r e n c e         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ C o m m u n i t y R e f e r e n c e ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ C o m m u n i t y R e f e r e n c e ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ُ*N  S P   v\O(u(W>y:S_(u-NԏV~[[Wv  T o p N   agU_
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 0   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 0 - 1 1 - 2 4 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . C o m m u n i t y R e f e r e n c e 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 
 
 @ C u l t u r e   n v a r c h a r ( 5 0 ) , 	 	 	 - - S_MRy  :NNԏVyNv  T o p i c S t a t u s   c	
 
 @ F o r u m I D   i n t , 	 	 	 	 - - F o r u m   v  I D     >y:Sd"}/fc[  F o r u m   Q萄vd"}sSSd"},g  F o r u m   QvQ[	
 
 @ T o p N   i n t 	 	 	 	 - -  gevY\agU_
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = Spev8YtN(WX[(WR`Sv0WeO(u	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ C u l t u r e = d b o . U D F _ P u b l i c S t r i n g E s c a p e ( @ C u l t u r e ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 - - = = (u7bCgPhg    ԏV N*NhS	g N*NR  F o r u m R e a d a b l e U_S_MR  F o r u m   [S_MR(u7b/f&T	gCgPOmȉNO>y:S_(uenx[/f&TQԏVv ge  T o p N   ^P[  	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =     
 
 S E L E C T   
 
 
 
 	 d b o . U D F _ F o r u m R e a d a b l e ( @ U s e r , @ F o r u m I D )   A S   F o r u m R e a d a b l e ,   
 
 	 d b o . U D F _ U s e r A d m i n ( @ U s e r )   |   d b o . U D F _ U s e r M o d e r a t o r ( @ U s e r , @ F o r u m I D )   A S   F o r u m R e a d a b l e E v e n H i d d e n , 
 
 	 c o c . H i d d e n   |     f o c . H i d d e n   A S   F o r u m H i d d e n 
 
 
 
 F R O M   d b o . C o m m u n i t y   c o 
 
 L E F T   J O I N   d b o . C o m m u n i t y C o n t e n t   c o c   O N   c o c . C o m m u n i t y I D = c o . [ I D ]   A N D   c o c . C u l t u r e = @ C u l t u r e 
 
 L E F T   J O I N   d b o . F o r u m   f o   O N   f o . C o m m u n i t y I D = c o . [ I D ] 
 
 L E F T   J O I N   d b o . F o r u m C o n t e n t   f o c   O N   f o c . F o r u m I D = f o . [ I D ]   A N D   f o c . C u l t u r e = @ C u l t u r e 
 
 
 
 W H E R E   f o . [ I D ] = @ F o r u m I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = g^  D y n S Q L   S
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   N V A R C H A R ( 4 0 0 0 )         
 
 
 
 S E T   @ D y n S Q L = N ' ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   t o p     '   +   c o n v e r t ( n v a r c h a r ( 2 0 ) , @ T o p N )   +   N '   '     
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ I D ]   a s   [ I D ] ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . [ U s e r ]   a s   T o p i c U s e r ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . T i t l e   a s   T i t l e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , t p . C o n t e n t )   a s   C o n t e n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . H i t   a s   H i t C o u n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . [ I D ]   a s   T o p i c S t a t u s ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t s . I c o n N a m e   a s   T o p i c S t a t u s I c o n N a m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   d b o . U D F _ T o p i c S t a t u s D e s c r i p t i o n ( '   +     c o n v e r t ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   ' , N ' ' '     +   @ C u l t u r e   +     ' ' ' , t s . [ I D ] )   a s   T o p i c S t a t u s D e s c r i p t i o n ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   t p . P o s t T i m e   a s   P o s t T i m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C O U N T ( f u . [ I D ] )   a s   F o l l o w U p s   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F r o m   d b o . T o p i c   t p   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L e f t   J o i n   d b o . F o l l o w U p   f u   O N   f u . T o p i c I D = t p . [ I D ]   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I n n e r   J o i n   d b o . T o p i c S t a t u s   t s   O N   t s . [ I D ] = t p . T o p i c S t a t u s   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   W h e r e   t p . F o r u m I D =   '   +   C O N V E R T ( n v a r c h a r ( 2 0 ) , @ F o r u m I D )   +   N '   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   g r o u p   b y   t p . [ I D ] ,   t p . [ U s e r ] ,   t p . T i t l e , c o n v e r t ( n v a r c h a r ( 4 0 0 0 ) , t p . C o n t e n t ) ,   t p . H i t ,   t s . [ I D ] ,   t s . I c o n N a m e ,   t p . P o s t T i m e   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   P o s t T i m e   D E S C   ' 
 
 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgR`Sv^
NSNǏ|~
NP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s D y n S Q L   I N T 
 
 E X E C   d b o . P u b l i c D y n S Q L L e n g t h C h e c k   @ D y n S Q L , @ o P a s s D y n S Q L   O U T 
 
 I F   @ o P a s s D y n S Q L = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLR`  S Q L   S   _Y~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 R E T U R N 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ C o m m u n i t y R e f e r e n c e ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . X T o o l L o g o n R e c o r d         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ X T o o l L o g o n R e c o r d ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ X T o o l L o g o n R e c o r d ] 
 
 G O 
 
 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = |~]wQ  -   ]wQ(uegub(u7b{vU_zpU_bJT
 
 - - = = >f:y
NT(u7b{vU_zp!kpeNSk!k{vU_eU_
 
 - - = = ]wQS(uN|~S(uN _SrGS~ g~(u7b
NSNO(u]wQۏLNUOd\O
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 1   C O M S H A R P   C M S   FUONC M S 	  h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 1 - 0 2 - 2 3     
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . X T o o l L o g o n R e c o r d 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7b  C U R S O R 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 d e c l a r e   @ S i t e L o g _ U s e r   n v a r c h a r ( 5 0 ) 
 
 d e c l a r e   @ S i t e L o g _ U s e r _ L o g o n T i m e s   i n t 
 
 
 
 d e c l a r e   S i t e L o g _ U s e r _ C u r s o r   c u r s o r   f o r   s e l e c t   s l . [ U s e r ] , c o u n t ( s l . [ I D ] )   a s   L o g o n T i m e s   f r o m   d b o . S i t e L o g   s l   w h e r e   l e n ( s l . [ U s e r ] ) > 0   a n d   s l . A c t i v i t y = 0   g r o u p   b y   s l . [ U s e r ]   o r d e r   b y   L o g o n T i m e s   d e s c 
 
 o p e n   S i t e L o g _ U s e r _ C u r s o r 
 
 
 
 	 f e t c h   n e x t   f r o m   S i t e L o g _ U s e r _ C u r s o r   i n t o   @ S i t e L o g _ U s e r , @ S i t e L o g _ U s e r _ L o g o n T i m e s 
 
 
 
 	 w h i l e   @ @ f e t c h _ s t a t u s = 0 
 
 	 b e g i n 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = SbpSS_MR(u7bSvQ{vU_;`!kpe
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 	 p r i n t   @ S i t e L o g _ U s e r   +   N '   ( L o g o n s :   '   +   c o n v e r t ( n v a r c h a r ( 2 0 ) , @ S i t e L o g _ U s e r _ L o g o n T i m e s )   +   N ' ) '   +   c h a r ( 1 3 ) 
 
 	 	 p r i n t   N ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - '   +   c h a r ( 1 3 ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = (u7b{vU_U_  C U R S O R 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 	 
 
 	 	 d e c l a r e   @ S i t e L o g _ A c t i v i t y T i m e   d a t e t i m e 
 
 	 	 d e c l a r e   S i t e L o g _ A c t i v i t y T i m e _ C u r s o r   c u r s o r   f o r   s e l e c t   i s l . A c t i v i t y T i m e   f r o m   d b o . S i t e L o g   i s l   w h e r e   i s l . [ U s e r ] = @ S i t e L o g _ U s e r   a n d   i s l . A c t i v i t y = 0   o r d e r   b y   i s l . A c t i v i t y T i m e   d e s c 
 
 	 	 o p e n   S i t e L o g _ A c t i v i t y T i m e _ C u r s o r 
 
 	 	 
 
 	 	 	 f e t c h   n e x t   f r o m   S i t e L o g _ A c t i v i t y T i m e _ C u r s o r   i n t o   @ S i t e L o g _ A c t i v i t y T i m e 
 
 	 	 	 w h i l e   @ @ f e t c h _ s t a t u s = 0 
 
 	 	 	 b e g i n 
 
 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = SbpS{vU_U_
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 	 	 	 p r i n t   c o n v e r t ( n v a r c h a r ( 2 0 ) , @ S i t e L o g _ A c t i v i t y T i m e )   +   c h a r ( 1 3 ) 
 
 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 	 	 - - = = ~~(u7b{vU_U_  C U R S O R 
 
 	 	 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 	 	 	 f e t c h   n e x t   f r o m   S i t e L o g _ A c t i v i t y T i m e _ C u r s o r   i n t o   @ S i t e L o g _ A c t i v i t y T i m e 
 
 
 
 	 	 	 e n d 
 
 
 
 	 	 c l o s e   S i t e L o g _ A c t i v i t y T i m e _ C u r s o r 
 
 	 	 d e a l l o c a t e   S i t e L o g _ A c t i v i t y T i m e _ C u r s o r 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = S_MR(u7bSvQ{vU_;`!kpe~_g
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 	 p r i n t   c h a r ( 1 3 ) 
 
 	 	 p r i n t   c h a r ( 1 3 ) 
 
 	 	 p r i n t   c h a r ( 1 3 ) 
 
 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 	 	 - - = = ~~(u7b  C U R S O R 
 
 	 	 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 	 
 
 	 	 f e t c h   n e x t   f r o m   S i t e L o g _ U s e r _ C u r s o r   i n t o   @ S i t e L o g _ U s e r , @ S i t e L o g _ U s e r _ L o g o n T i m e s 
 
 	 e n d 
 
 
 
 c l o s e   S i t e L o g _ U s e r _ C u r s o r 
 
 d e a l l o c a t e   S i t e L o g _ U s e r _ C u r s o r 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ X T o o l L o g o n R e c o r d ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o m m e n t s G e t A d m i n         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 2   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o m m e n t s G e t A d m i n ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o m m e n t s G e t A d m i n ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = N|~TS{tXTv
TINԏV@b	g  K n o w l e d g e C o m m e n t s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 2 - 1 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o m m e n t s G e t A d m i n 
 
 
 
 @ P a g e S i z e   I N T , 	 	 	 	 	 	 - - ux:g6Rkuv:\[
 
 @ C u r r e n t P a g e   I N T , 	 	 	 	 	 	 - - ux:g6RS_MRu
 
 @ O r d e r B y   n v a r c h a r ( 1 0 0 ) , 	 	 	 	 	 - - ۏLc^vR
T
 
 @ O r d e r B y O r d e r   n v a r c h a r ( 1 0 ) 	 	 	 	 	 - - c^e_  A S C ,   D E S C 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R`  S Q L   S
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ D y n S Q L   n v a r c h a r ( 4 0 0 0 ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R^ N*N  t a b l e   Sϑ[~~gNO(WTbۏLRuYt
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 S E T   @ D y n S Q L = N '   S E T   N O C O U N T   O N       ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   D e c l a r e   @ P a g i n g   t a b l e   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   (   ' 
 
 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g i n g I D   i n t   i d e n t i t y ( 1 , 1 ) ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   [ I D ]   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C o m m e n t s T i m e   d a t e t i m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C o m m e n t s U s e r   n v a r c h a r ( 5 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C o m m e n t s C o n t e n t   n v a r c h a r ( 1 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C o m m e n t s C o n t e n t M o r e   n v a r c h a r ( 1 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   K n o w l e d g e T i t l e   n v a r c h a r ( 2 0 0 0 )   C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   P a g e D i r e c t o r y N a m e   n v a r c h a r ( 1 0 0 )     C O L L A T E   d a t a b a s e _ d e f a u l t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   K n o w l e d g e I D   i n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   C u l t u r e   n v a r c h a r ( 1 0 0 )     C O L L A T E   d a t a b a s e _ d e f a u l t   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   )   ' 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 	b@b	g  K n o w l e d g e   v  C o m m e n t s 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   I N S E R T   I N T O   @ P a g i n g   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   S E L E C T   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w c o . [ I D ]   A S   [ I D ] ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w c o . C o m m e n t s T i m e   A S   C o m m e n t s T i m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w c o . C o m m e n t s U s e r   A S   C o m m e n t s U s e r ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L E F T ( n o w c o . C o m m e n t s C o n t e n t , 1 0 0 )   A S   C o m m e n t s C o n t e n t ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w c o . C o m m e n t s C o n t e n t   A S   C o m m e n t s C o n t e n t M o r e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w c . [ T i t l e ]   A S   K n o w l e d g e T i t l e ,   ' 
 
 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   p d . [ N a m e ]   A S   P a g e D i r e c t o r y N a m e ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w . [ I D ]   A S   K n o w l e d g e I D ,   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   n o w c . C u l t u r e   A S   C u l t u r e   ' 
 
 	 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   F R O M   d b o . K n o w l e d g e C o m m e n t s   n o w c o   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . [ I D ] = n o w c o . K n o w l e d g e C o n t e n t I D   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L E F T   J O I N   d b o . K n o w l e d g e   n o w   O N   n o w . [ I D ] = n o w c . K n o w l e d g e I D   ' 
 
 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   L E F T   J O I N   d b o . P a g e D i r e c t o r y   p d   O N   p d . [ I D ] = n o w . P a g e D i r e c t o r y I D   ' 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = R
N  O r d e r   B y   NS
 
 - - = = Yg  O r d e r B y = ' '   RO(u:w  o r d e r   b y   C o m m e n t s T i m e   D E S C 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E T   @ O r d e r B y = L T R I M ( R T R I M ( @ O r d e r B y ) ) 
 
 S E T   @ O r d e r B y O r d e r = L T R I M ( R T R I M ( @ O r d e r B y O r d e r ) ) 
 
 
 
 I F   L E N ( @ O r d e r B y ) = 0   O R     L E N ( @ O r d e r B y O r d e r ) = 0 
 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   n o w c o . [ C o m m e n t s T i m e ]   D E S C   ' 
 
 	 E N D 
 
 E L S E 
 
 	 B E G I N 
 
 	 S E T   @ D y n S Q L = @ D y n S Q L   +   N '   o r d e r   b y   n o w c o . [ '   +   @ O r d e r B y   +   N ' ]   '   +   @ O r d e r B y O r d e r 
 
 	 E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = =  gTN  @ P a g i n g   hSϑ-NSpenc
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   
 
 D e c l a r e   @ F i r s t R e c o r d   i n t 
 
 D e c l a r e   @ L a s t R e c o r d   i n t 
 
 
 
 s e t   @ F i r s t R e c o r d = ( @ C u r r e n t P a g e   -   1 )   *   @ P a g e S i z e 	 - - S_MRu,{ N*NU_MR
 
 s e t   @ L a s t R e c o r d = ( @ C u r r e n t P a g e   *   @ P a g e S i z e   +   1 ) 	 - - S_MRu gT N*NU_T
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = ;`U_pedNkuvU_pe(uC e i l i n g ( ) Yt_0Rv:Nupe  lac o u n t ( * )     T  @ P a g e S i z e   :N  I N T [Nvd\_0R  I N T @bNHQ\[Nlbcb  D e c i m a l ( 1 8 , 2 ) 	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e t   @ D y n S Q L = @ D y n S Q L   +   N '   S e l e c t   * , P a g e C o u n t = C E I L I N G   ( C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , ( s e l e c t   c o u n t ( * )   f r o m   @ P a g i n g ) )   /   C o n v e r t ( d e c i m a l ( 1 8 , 2 ) , '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ P a g e S i z e )   +   N ' ) )   F r o m   @ P a g i n g   W h e r e   P a g i n g I D > '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ F i r s t R e c o r d )   +   N '   a n d   P a g i n g I D < '   +   C o n v e r t ( n v a r c h a r ( 2 0 ) , @ L a s t R e c o r d ) 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = hgR`Sv^
NSNǏ|~
NP
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s D y n S Q L   I N T 
 
 E X E C   d b o . P u b l i c D y n S Q L L e n g t h C h e c k   @ D y n S Q L , @ o P a s s D y n S Q L   O U T 
 
 I F   @ o P a s s D y n S Q L = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbLR`  S Q L   S   _Y~
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C ( @ D y n S Q L ) 
 
 R E T U R N 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o m m e n t s G e t A d m i n ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O F F   
 
 G O 
 
 
 
 / * * * * * *   O b j e c t :     S t o r e d   P r o c e d u r e   d b o . K n o w l e d g e C o m m e n t s D e l e t e A d m i n         S c r i p t   D a t e :   2 0 1 3 - 1 1 - 1 3   7 : 1 1 : 5 3   * * * * * * / 
 
 i f   e x i s t s   ( s e l e c t   *   f r o m   d b o . s y s o b j e c t s   w h e r e   i d   =   o b j e c t _ i d ( N ' [ d b o ] . [ K n o w l e d g e C o m m e n t s D e l e t e A d m i n ] ' )   a n d   O B J E C T P R O P E R T Y ( i d ,   N ' I s P r o c e d u r e ' )   =   1 ) 
 
 d r o p   p r o c e d u r e   [ d b o ] . [ K n o w l e d g e C o m m e n t s D e l e t e A d m i n ] 
 
 G O 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = NTS{tXTv
TIN Rd  K n o w l e d g e C o m m e n t s     
 
 - - = = T  K n o w l e d g e C o m m e n t s D e l e t e   v:S+RK n o w l e d g e C o m m e n t s D e l e t e    RdT؏ԏVv  P a g e S i z e   KN{|vQ[NO(WQ[s:W[MO0R  K n o w l e d g e C o m m e n t s   uxMOnُ̑
N_ُ̑ RdT͑e[MOO ge  K n o w l e d g e C o m m e n t s   Rh,{ Nu
 
 - - = =  CgPhgS $R[S_MR{vFbb^\N  A d m i n   sSS	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = HrCg@b	g  2 0 0 1 - 2 0 1 2   C O M S H A R P   C M S   FUONC M S 	h t t p : / / w w w . c o m s h a r p . c o m 
 
 - - = =  geO9e  2 0 1 2 - 1 2 - 1 2 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 C R E A T E   P R O C E D U R E   d b o . K n o w l e d g e C o m m e n t s D e l e t e A d m i n 
 
 
 
 @ U s e r   n v a r c h a r ( 5 0 ) , 	 	 	 	 	 	 - - N  A S P X   z OǏegvS_MR(u7b
T
 
 @ K n o w l e d g e C o m m e n t s I D   i n t 	 	 	 	 	 - - \ Rdv  C o m m e n t s   v  I D 
 
 
 
 A S 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = 9hnc  @ K n o w l e d g e C o m m e n t s I D   _  K n o w l e d g e I D   NOO(u  S P   A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   $ReS_MR(u7b/f&T	gCgP Rd
 
 - - = = vQ-N  @ K n o w l e d g e C o n t e n t I D   /fTb  S i t e L o g S a v e   O(uv
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ K n o w l e d g e I D   I N T 
 
 D E C L A R E   @ K n o w l e d g e C o n t e n t I D   I N T 
 
 
 
 S E L E C T   @ K n o w l e d g e I D = n o w . [ I D ]   ,   @ K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] 
 
 
 
 F R O M   d b o . K n o w l e d g e   n o w   
 
 L E F T   J O I N   d b o . K n o w l e d g e C o n t e n t   n o w c   O N   n o w c . K n o w l e d g e I D = n o w . [ I D ] 
 
 L E F T   J O I N   d b o . K n o w l e d g e C o m m e n t s   n o w c o m   O N   n o w c o m . K n o w l e d g e C o n t e n t I D = n o w c . [ I D ] 
 
 
 
 W H E R E   n o w c o m . [ I D ] = @ K n o w l e d g e C o m m e n t s I D 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = (u7bCgPhg
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E C L A R E   @ o P a s s   I N T 
 
 E X E C   d b o . A d m i n E d i t o r U s e r A u t h e n t i c a t i o n   @ U s e r , N ' K n o w l e d g e ' , @ K n o w l e d g e I D , @ o P a s s   O U T 
 
 I F   @ o P a s s = 0   B E G I N   R E T U R N   E N D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = gbL Rd
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 D E L E T E   F R O M   d b o . K n o w l e d g e C o m m e n t s   W H E R E   [ I D ] = @ K n o w l e d g e C o m m e n t s I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - = = \S_MR;mRU_(WHh(W  @ K n o w l e d g e C o n t e n t I D   N RdNċ	
 
 - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 E X E C   d b o . S i t e L o g S a v e   @ U s e r ,   2 0 ,   @ K n o w l e d g e C o n t e n t I D 
 
 
 
 - - Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 
 
 G O 
 
 
 
 S E T   Q U O T E D _ I D E N T I F I E R   O F F   
 
 G O 
 
 S E T   A N S I _ N U L L S   O N   
 
 G O 
 
 
 
 G R A N T     E X E C U T E     O N   [ d b o ] . [ K n o w l e d g e C o m m e n t s D e l e t e A d m i n ]     T O   [ p u b l i c ] 
 
 G O 
 
 
 
 