<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.homemarketeer.com/wiki/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.homemarketeer.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Useful_Functions</id>
		<title>Useful Functions - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.homemarketeer.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Useful_Functions"/>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;action=history"/>
		<updated>2026-10-17T06:57:12Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.16.0</generator>

	<entry>
		<id>http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=1195&amp;oldid=prev</id>
		<title>WikiSysop at 20:52, 27 May 2015</title>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=1195&amp;oldid=prev"/>
				<updated>2015-05-27T20:52:03Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 20:52, 27 May 2015&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Microsoft SQL Server]] script useful for [[PeopleSoft]]:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;/**************************************************************************************&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;/**************************************************************************************&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	<entry>
		<id>http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=913&amp;oldid=prev</id>
		<title>WikiSysop at 21:55, 25 June 2014</title>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=913&amp;oldid=prev"/>
				<updated>2014-06-25T21:55:49Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:55, 25 June 2014&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 39:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 39:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select 'PS_JOB_JR',* from PS_JOB_JR where EMPLID=@in_emplid&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select 'PS_JOB_JR',* from PS_JOB_JR where EMPLID=@in_emplid&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;order by 1,2,3,4&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;order by 1,2,3,4&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;,5&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select 'PS_JOB',* from PS_JOB where EMPLID=@in_emplid&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select 'PS_JOB',* from PS_JOB where EMPLID=@in_emplid&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;order by 1,2,3,4&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;order by 1,2,3,4&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;,5&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select 'PS_COMPENSATION',* from PS_COMPENSATION where EMPLID=@in_emplid&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select 'PS_COMPENSATION',* from PS_COMPENSATION where EMPLID=@in_emplid&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;order by 1,2,3,4&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;order by 1,2,3,4&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;,5,6&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	<entry>
		<id>http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=911&amp;oldid=prev</id>
		<title>WikiSysop at 17:19, 24 June 2014</title>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=911&amp;oldid=prev"/>
				<updated>2014-06-24T17:19:34Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:19, 24 June 2014&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 87:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 87:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;from PS_PERS_DATA_EFFDT &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;from PS_PERS_DATA_EFFDT &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;order by 1,2,3&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_NAMES (v8)' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,NAME_TYPE,NAME &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_NAMES (v8)' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,NAME_TYPE,NAME &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 516:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 517:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;##comptab 'PS_DEPT_TBL','&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;SEVER1&lt;/del&gt;&amp;quot;','&amp;quot;SERVER1&amp;quot;.DEV.dbo.PS_DEPT_TBL','DEPTID'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-- &lt;/ins&gt;##comptab 'PS_DEPT_TBL','&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;SERVER1&lt;/ins&gt;&amp;quot;','&amp;quot;SERVER1&amp;quot;.DEV.dbo.PS_DEPT_TBL','DEPTID'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-- &lt;/ins&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select * from sys.servers&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select * from sys.servers&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 712:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 713:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  AND P.PORTAL_OBJNAME = P_ONE.PORTAL_PRNTOBJNAME&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  AND P.PORTAL_OBJNAME = P_ONE.PORTAL_PRNTOBJNAME&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; WHERE P_ONE.PORTAL_PRNTOBJNAME != ' ' COLLATE DATABASE_DEFAULT )&amp;nbsp;  &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; WHERE P_ONE.PORTAL_PRNTOBJNAME != ' ' COLLATE DATABASE_DEFAULT )&amp;nbsp;  &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;SELECT &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;PORTAL_NAME&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;SELECT &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;PORTAL_LABEL&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PORTAL_URI_SEG2&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PORTAL_URI_SEG2&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;nbsp; &amp;nbsp;  , PORTAL_LABEL&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PATH1&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PATH1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PORTAL_OBJNAME&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PORTAL_OBJNAME&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PORTAL_REFTYPE&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PORTAL_REFTYPE&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;nbsp; &amp;nbsp;  , PORTAL_NAME&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; FROM PORTAL_REGISTRY&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; FROM PORTAL_REGISTRY&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; WHERE PORTAL_REFTYPE != 'F' COLLATE DATABASE_DEFAULT&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; WHERE PORTAL_REFTYPE != 'F' COLLATE DATABASE_DEFAULT&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	<entry>
		<id>http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=907&amp;oldid=prev</id>
		<title>WikiSysop at 21:35, 23 June 2014</title>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=907&amp;oldid=prev"/>
				<updated>2014-06-23T21:35:49Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:35, 23 June 2014&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 713:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 713:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; WHERE P_ONE.PORTAL_PRNTOBJNAME != ' ' COLLATE DATABASE_DEFAULT )&amp;nbsp;  &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; WHERE P_ONE.PORTAL_PRNTOBJNAME != ' ' COLLATE DATABASE_DEFAULT )&amp;nbsp;  &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;SELECT PORTAL_NAME&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;SELECT PORTAL_NAME&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;nbsp; &amp;nbsp;  , PORTAL_URI_SEG2&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PORTAL_LABEL&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PORTAL_LABEL&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PATH1&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  , PATH1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	<entry>
		<id>http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=905&amp;oldid=prev</id>
		<title>WikiSysop at 21:33, 23 June 2014</title>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=905&amp;oldid=prev"/>
				<updated>2014-06-23T21:33:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:33, 23 June 2014&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 637:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 637:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;order by 1,2,3,4,5,6&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;order by 1,2,3,4,5,6&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;print 'PS_GPGB_KIT_DTL'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-- &lt;/ins&gt;print 'PS_GPGB_KIT_DTL'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select 'PS_GPGB_KIT_DTL',* from PS_GPGB_KIT_DTL where EMPLID=@in_emplid&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-- &lt;/ins&gt;select 'PS_GPGB_KIT_DTL',* from PS_GPGB_KIT_DTL where EMPLID=@in_emplid&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;order by 1,2,3&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-- &lt;/ins&gt;order by 1,2,3&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;print 'PS_GPGB_ABS_CMTS'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;print 'PS_GPGB_ABS_CMTS'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	<entry>
		<id>http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=891&amp;oldid=prev</id>
		<title>WikiSysop at 07:03, 10 June 2014</title>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=891&amp;oldid=prev"/>
				<updated>2014-06-10T07:03:31Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 07:03, 10 June 2014&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 76:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 76:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(OPRID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(OPRID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;order by 1,2,3,4&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_PERSONAL_DATA' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,NAME &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_PERSONAL_DATA' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,NAME &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 81:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 82:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(NAME) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(NAME) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;order by 1,2,3&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_PERS_DATA_EFFDT' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,EFFDT&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_PERS_DATA_EFFDT' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,EFFDT&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 90:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 92:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(NAME) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(NAME) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;order by 1,2,3,4&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_PERS_NID' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,COUNTRY,NATIONAL_ID_TYPE,NATIONAL_ID &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_PERS_NID' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,COUNTRY,NATIONAL_ID_TYPE,NATIONAL_ID &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 95:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 98:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(EMPLID) like upper(@in_value)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(NATIONAL_ID) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(NATIONAL_ID) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;order by 1,2,3,4&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_HR_TBH_DATA' COLLATE DATABASE_DEFAULT + @pad,30) as Record,TBH_SEQ,RECNAME,FIELDNAME,TBH_CHAR &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PS_HR_TBH_DATA' COLLATE DATABASE_DEFAULT + @pad,30) as Record,TBH_SEQ,RECNAME,FIELDNAME,TBH_CHAR &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;from PS_HR_TBH_DATA &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;from PS_HR_TBH_DATA &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(TBH_CHAR) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where upper(TBH_CHAR) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;order by 1,2,3,4&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PSOPRDEFN' COLLATE DATABASE_DEFAULT + @pad,30) as Record,OPRID,EMPLID,OPRDEFNDESC &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;select left('PSOPRDEFN' COLLATE DATABASE_DEFAULT + @pad,30) as Record,OPRID,EMPLID,OPRDEFNDESC &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 106:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 111:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(OPRDEFNDESC) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(OPRDEFNDESC) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(EMPLID) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;or upper(EMPLID) like upper(@pct + @in_value + @pct)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;order by 1,2,3,4&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 159:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 165:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;where&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;upper(HR_SSTEXT_TEXT) like upper('%' COLLATE DATABASE_DEFAULT +@in_text+'%' COLLATE DATABASE_DEFAULT)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;upper(HR_SSTEXT_TEXT) like upper('%' COLLATE DATABASE_DEFAULT +@in_text+'%' COLLATE DATABASE_DEFAULT)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;order by 1,2,3,4&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	<entry>
		<id>http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=885&amp;oldid=prev</id>
		<title>WikiSysop at 06:59, 4 June 2014</title>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=885&amp;oldid=prev"/>
				<updated>2014-06-04T06:59:41Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 06:59, 4 June 2014&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 240:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 240:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##mgr '0024'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##mgr '0024'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##mgr')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##mgr&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##mgr&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 314:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 314:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##psquery 'Query'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##psquery 'Query'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##psquery')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##psquery&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##psquery&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 421:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 421:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##comparetables 'table1','table2','column1,column2...'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##comparetables 'table1','table2','column1,column2...'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##comparetables')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##comparetables&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##comparetables&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 467:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 467:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##comptab 'table1','table2','column1,column2...'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##comptab 'table1','table2','column1,column2...'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##comptab')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##comptab&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##comptab&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 523:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 523:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returns 1 if field there, otherwise 0&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returns 1 if field there, otherwise 0&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##hasField')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##hasField&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##hasField&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 611:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 611:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##abs '00007'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##abs '00007'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##abs')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##abs&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##abs&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 668:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 669:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##findmenu Establishment&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##findmenu Establishment&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##findmenu')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##findmenu&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##findmenu&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	<entry>
		<id>http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=883&amp;oldid=prev</id>
		<title>WikiSysop at 18:17, 3 June 2014</title>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=883&amp;oldid=prev"/>
				<updated>2014-06-03T18:17:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 18:17, 3 June 2014&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##emp '0024'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##emp '0024'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##emp')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##emp&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##emp&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 56:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 57:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##findemp 'Ander'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##findemp 'Ander'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##findemp')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##findemp&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##findemp&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 114:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 116:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##jstar '0024'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##jstar '0024'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##jstar')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##jstar&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##jstar&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 134:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 137:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##msg 'text'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##msg 'text'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##msg')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##msg&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##msg&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 170:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 174:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##posstar '6000008'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ##posstar '6000008'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##posstar')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##posstar&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##posstar&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 191:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 196:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where 321 is the TBH Sequence number (blank is latest)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where 321 is the TBH Sequence number (blank is latest)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;***************************************************************************************/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if exists (select * from tempdb..sysobjects where xtype='P' and name='##tbh')&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##tbh&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;drop procedure ##tbh&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;go&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	<entry>
		<id>http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=827&amp;oldid=prev</id>
		<title>WikiSysop: Created page with &quot;&lt;pre&gt; /************************************************************************************** aaaaUsefulFunctions.sql - a useful set of global temporary procedures  for use with ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.homemarketeer.com/wiki/index.php?title=Useful_Functions&amp;diff=827&amp;oldid=prev"/>
				<updated>2014-02-25T21:47:36Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; /************************************************************************************** aaaaUsefulFunctions.sql - a useful set of global temporary procedures  for use with ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
aaaaUsefulFunctions.sql - a useful set of global temporary procedures &lt;br /&gt;
for use with Psoft SQLServer&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for Employee Info Summary&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##emp '0024'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
drop procedure ##emp&lt;br /&gt;
go&lt;br /&gt;
CREATE PROCEDURE ##emp &lt;br /&gt;
   @in_emplid varchar(11)&lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
select 'PSOPRDEFN',* from PSOPRDEFN where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
select 'PS_PERSON',* from PS_PERSON where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
select 'PS_PERS_DATA_EFFDT',* from PS_PERS_DATA_EFFDT where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
select 'PS_PERS_NID',* from PS_PERS_NID where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
select 'PS_EMPLOYMENT',* from PS_EMPLOYMENT where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
select 'PS_NAMES',* from PS_NAMES where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
select 'PS_PERSONAL_PHONE',* from PS_PERSONAL_PHONE where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
select 'PS_JOB_JR',* from PS_JOB_JR where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
select 'PS_JOB',* from PS_JOB where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
select 'PS_COMPENSATION',* from PS_COMPENSATION where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##emp '0024'&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for Finding Employee&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##findemp 'Ander'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
drop procedure ##findemp&lt;br /&gt;
go&lt;br /&gt;
CREATE PROCEDURE ##findemp &lt;br /&gt;
   @in_value varchar(1000)&lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
declare @pad char(30)&lt;br /&gt;
set @pad = REPLICATE(' ', 30)&lt;br /&gt;
&lt;br /&gt;
declare @pct char(1)&lt;br /&gt;
set @pct = '%'&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
select left('PSOPRDEFN' COLLATE DATABASE_DEFAULT + @pad,30) as Record,* &lt;br /&gt;
from PSOPRDEFN &lt;br /&gt;
where &lt;br /&gt;
upper(EMPLID) like upper(@in_value)&lt;br /&gt;
or upper(OPRID) like upper(@in_value)&lt;br /&gt;
&lt;br /&gt;
select left('PS_PERSONAL_DATA' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,NAME &lt;br /&gt;
from PS_PERSONAL_DATA &lt;br /&gt;
where upper(EMPLID) like upper(@in_value)&lt;br /&gt;
or upper(NAME) like upper(@pct + @in_value + @pct)&lt;br /&gt;
&lt;br /&gt;
select left('PS_PERS_DATA_EFFDT' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,EFFDT&lt;br /&gt;
from PS_PERS_DATA_EFFDT &lt;br /&gt;
where upper(EMPLID) like upper(@in_value)&lt;br /&gt;
&lt;br /&gt;
select left('PS_NAMES (v8)' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,NAME_TYPE,NAME &lt;br /&gt;
from PS_NAMES &lt;br /&gt;
where upper(EMPLID) like upper(@in_value)&lt;br /&gt;
or upper(NAME) like upper(@pct + @in_value + @pct)&lt;br /&gt;
&lt;br /&gt;
select left('PS_PERS_NID' COLLATE DATABASE_DEFAULT + @pad,30) as Record,EMPLID,COUNTRY,NATIONAL_ID_TYPE,NATIONAL_ID &lt;br /&gt;
from PS_PERS_NID &lt;br /&gt;
where upper(EMPLID) like upper(@in_value)&lt;br /&gt;
or upper(NATIONAL_ID) like upper(@pct + @in_value + @pct)&lt;br /&gt;
&lt;br /&gt;
select left('PS_HR_TBH_DATA' COLLATE DATABASE_DEFAULT + @pad,30) as Record,TBH_SEQ,RECNAME,FIELDNAME,TBH_CHAR &lt;br /&gt;
from PS_HR_TBH_DATA &lt;br /&gt;
where upper(TBH_CHAR) like upper(@pct + @in_value + @pct)&lt;br /&gt;
&lt;br /&gt;
select left('PSOPRDEFN' COLLATE DATABASE_DEFAULT + @pad,30) as Record,OPRID,EMPLID,OPRDEFNDESC &lt;br /&gt;
from PSOPRDEFN &lt;br /&gt;
where upper(OPRID) like upper(@in_value)&lt;br /&gt;
or upper(OPRID) like upper(@pct + @in_value + @pct)&lt;br /&gt;
or upper(OPRDEFNDESC) like upper(@pct + @in_value + @pct)&lt;br /&gt;
or upper(EMPLID) like upper(@pct + @in_value + @pct)&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##findemp NX&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for Employee Job Info Summary&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##jstar '0024'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
drop procedure ##jstar&lt;br /&gt;
go&lt;br /&gt;
CREATE PROCEDURE ##jstar &lt;br /&gt;
   @in_emplid varchar(11)&lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
select * from PS_JOB where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##jstar '0024'&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for Message Catalog Text Summary&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##msg 'text'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
drop procedure ##msg&lt;br /&gt;
go&lt;br /&gt;
CREATE PROCEDURE ##msg &lt;br /&gt;
   @in_text varchar(2000)&lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
print 'PSMSGCATDEFN'&lt;br /&gt;
&lt;br /&gt;
select * from PSMSGCATDEFN &lt;br /&gt;
where &lt;br /&gt;
upper(MESSAGE_TEXT) like upper('%' COLLATE DATABASE_DEFAULT +@in_text+'%' COLLATE DATABASE_DEFAULT)&lt;br /&gt;
or upper(DESCRLONG) like upper('%' COLLATE DATABASE_DEFAULT+@in_text+'%'  COLLATE DATABASE_DEFAULT)&lt;br /&gt;
or replace(@in_text,' ' COLLATE DATABASE_DEFAULT,'') = ltrim(str(MESSAGE_SET_NBR))+','+ ltrim(str(MESSAGE_NBR))&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
print 'PS_HR_SSTEXT_TEXT'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
select * from PS_HR_SSTEXT_TEXT&lt;br /&gt;
where&lt;br /&gt;
upper(HR_SSTEXT_TEXT) like upper('%' COLLATE DATABASE_DEFAULT +@in_text+'%' COLLATE DATABASE_DEFAULT)&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##msg Explanatory&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##msg '14510,221'&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for Employee Position Info Summary&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##posstar '6000008'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
drop procedure ##posstar&lt;br /&gt;
go&lt;br /&gt;
CREATE PROCEDURE ##posstar &lt;br /&gt;
   @in_pos varchar(11)&lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
select * from PS_POSITION_DATA where POSITION_NBR=@in_pos&lt;br /&gt;
order by 1,2,3,4&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##posstar 6000008&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for Template based Hire (TBH)/ Smart Hire check&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##tbh 321&lt;br /&gt;
              where 321 is the TBH Sequence number (blank is latest)&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
drop procedure ##tbh&lt;br /&gt;
go&lt;br /&gt;
CREATE PROCEDURE ##tbh &lt;br /&gt;
   @in_seq integer = null&lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
if @in_seq is not null&lt;br /&gt;
begin&lt;br /&gt;
&lt;br /&gt;
  select * from PS_HR_REQUEST R where R.TBH_SEQ=@in_seq&lt;br /&gt;
&lt;br /&gt;
  select * from PS_HR_TBH_HDR H where H.TBH_SEQ=@in_seq&lt;br /&gt;
  &lt;br /&gt;
  select * from PS_HR_TBH_DATA D where D.TBH_SEQ=@in_seq order by 1,2,3,4,5,6&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
else&lt;br /&gt;
begin&lt;br /&gt;
&lt;br /&gt;
  select * from PS_HR_REQUEST R &lt;br /&gt;
  where R.TBH_SEQ=(select MAX(H1.TBH_SEQ) from PS_HR_TBH_HDR H1)&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
  select * from PS_HR_TBH_HDR H &lt;br /&gt;
  where H.TBH_SEQ=(select MAX(H1.TBH_SEQ) from PS_HR_TBH_HDR H1)&lt;br /&gt;
  &lt;br /&gt;
  select * from PS_HR_TBH_DATA D &lt;br /&gt;
  where D.TBH_SEQ=(select MAX(H1.TBH_SEQ) from PS_HR_TBH_HDR H1)&lt;br /&gt;
  order by 1,2,3,4,5,6&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##tbh 127&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for Get Manager (Position Management)&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##mgr '0024'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
&lt;br /&gt;
drop procedure ##mgr&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
CREATE PROCEDURE ##mgr &lt;br /&gt;
   @in_emplid varchar(11)&lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
-- Finding the reports to automatically&lt;br /&gt;
&lt;br /&gt;
declare @reports_to varchar(1000)&lt;br /&gt;
declare @emplid varchar(1000)&lt;br /&gt;
declare @managerEmplid varchar(1000)&lt;br /&gt;
&lt;br /&gt;
set @emplid=@in_emplid&lt;br /&gt;
&lt;br /&gt;
select @reports_to = REPORTS_TO &lt;br /&gt;
from PS_JOB J &lt;br /&gt;
where &lt;br /&gt;
EMPLID=@emplid&lt;br /&gt;
and J.EFFDT=(&lt;br /&gt;
	SELECT MAX(J1.EFFDT)&lt;br /&gt;
	FROM PS_JOB J1&lt;br /&gt;
	WHERE&lt;br /&gt;
	J1.EMPLID=J.EMPLID&lt;br /&gt;
	AND J1.EMPL_RCD=J.EMPL_RCD&lt;br /&gt;
	AND J1.EFFDT&amp;lt;=getdate()&lt;br /&gt;
)&lt;br /&gt;
AND J.EFFSEQ=(&lt;br /&gt;
	SELECT MAX(J2.EFFSEQ)&lt;br /&gt;
	FROM PS_JOB J2&lt;br /&gt;
	WHERE&lt;br /&gt;
	J2.EMPLID=J.EMPLID&lt;br /&gt;
	AND J2.EMPL_RCD=J.EMPL_RCD&lt;br /&gt;
	AND J2.EFFDT=J.EFFDT&lt;br /&gt;
)&lt;br /&gt;
-- AND J.EMPL_STATUS IN ('A','P','L','S','W')&lt;br /&gt;
&lt;br /&gt;
print @emplid + ' reports to position ' COLLATE DATABASE_DEFAULT + @reports_to&lt;br /&gt;
&lt;br /&gt;
select @managerEmplid = EMPLID&lt;br /&gt;
from PS_JOB J&lt;br /&gt;
where &lt;br /&gt;
POSITION_NBR=@reports_to&lt;br /&gt;
and J.EFFDT=(&lt;br /&gt;
	SELECT MAX(J1.EFFDT)&lt;br /&gt;
	FROM PS_JOB J1&lt;br /&gt;
	WHERE&lt;br /&gt;
	J1.EMPLID=J.EMPLID&lt;br /&gt;
	AND J1.EMPL_RCD=J.EMPL_RCD&lt;br /&gt;
	AND J1.EFFDT&amp;lt;=getdate()&lt;br /&gt;
)&lt;br /&gt;
AND J.EFFSEQ=(&lt;br /&gt;
	SELECT MAX(J2.EFFSEQ)&lt;br /&gt;
	FROM PS_JOB J2&lt;br /&gt;
	WHERE&lt;br /&gt;
	J2.EMPLID=J.EMPLID&lt;br /&gt;
	AND J2.EMPL_RCD=J.EMPL_RCD&lt;br /&gt;
	AND J2.EFFDT=J.EFFDT&lt;br /&gt;
)&lt;br /&gt;
AND J.EMPL_STATUS IN ('A','P','L','S','W')&lt;br /&gt;
&lt;br /&gt;
print @reports_to + ' is currently held by ' COLLATE DATABASE_DEFAULT + @managerEmplid&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##mgr '0024'&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for showing psquery (Query Name)&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##psquery 'Query'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
&lt;br /&gt;
drop procedure ##psquery&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
CREATE PROCEDURE ##psquery &lt;br /&gt;
   @query varchar(30) &lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
print @query + ' Query defined as...' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYDEFN where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3,4;&lt;br /&gt;
&lt;br /&gt;
print @query + ' Query selects fields...' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYFIELD where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3,4;&lt;br /&gt;
&lt;br /&gt;
print @query + ' From these records...' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYRECORD where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3,4;&lt;br /&gt;
&lt;br /&gt;
print @query + ' With these criteria...' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYCRITERIA where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3,4;&lt;br /&gt;
&lt;br /&gt;
print @query + ' With these expressions...' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYEXPR where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3,4;&lt;br /&gt;
&lt;br /&gt;
print @query + ' With these bind variables...' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYBIND where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3,4;&lt;br /&gt;
&lt;br /&gt;
print @query + ' With these links...' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYLINK where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2;&lt;br /&gt;
&lt;br /&gt;
print @query + ' With this select...' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYSELECT where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3,4;&lt;br /&gt;
&lt;br /&gt;
print @query + ' Has it been deleted?' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYDEL where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3;&lt;br /&gt;
&lt;br /&gt;
-- print @query + ' PSDIAGQRYCLASS' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
-- select * from PSDIAGQRYCLASS where upper(QRYNAME) like upper(@query)&lt;br /&gt;
-- order by 1,2,3;&lt;br /&gt;
&lt;br /&gt;
-- print @query + ' PSQRYACCLSTRECS' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
-- select * from PSQRYACCLSTRECS where upper(QRYNAME) like upper(@query)&lt;br /&gt;
-- order by 1,2,3;&lt;br /&gt;
&lt;br /&gt;
print @query + ' PSQRYEXECLOG' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYEXECLOG where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print @query + ' PSQRYFAVORITES' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYFAVORITES where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- print @query + ' PSQRYFLAGS' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
-- select * from PSQRYFLAGS where upper(QRYNAME) like upper(@query)&lt;br /&gt;
-- order by 1,2,3;&lt;br /&gt;
&lt;br /&gt;
-- print @query + ' PSQRYPREFS' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
-- select * from PSQRYPREFS where upper(QRYNAME) like upper(@query)&lt;br /&gt;
-- order by 1,2,3;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print @query + ' PSQRYSTATS' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYSTATS where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3;&lt;br /&gt;
&lt;br /&gt;
print @query + ' PSQRYTRANS' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
select * from PSQRYTRANS where upper(QRYNAME) like upper(@query)&lt;br /&gt;
order by 1,2,3;&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##psquery 'EMPLOYEES'&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for comparing tables&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##comparetables 'table1','table2','column1,column2...'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
&lt;br /&gt;
drop procedure ##comparetables&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CREATE PROCEDURE ##comparetables&lt;br /&gt;
(@table1 varchar(100), &lt;br /&gt;
 @table2 Varchar(100), @T1ColumnList varchar(1000),&lt;br /&gt;
 @T2ColumnList varchar(1000) = ''&lt;br /&gt;
)&lt;br /&gt;
AS&lt;br /&gt;
-- Table1, Table2 are the tables or views to compare.&lt;br /&gt;
-- T1ColumnList is the list of columns to compare, from table1.&lt;br /&gt;
-- Just list them comma-separated, like in a GROUP BY clause.&lt;br /&gt;
-- If T2ColumnList is not specified, it is assumed to be the same&lt;br /&gt;
-- as T1ColumnList.  Otherwise, list the columns of Table2 in&lt;br /&gt;
-- the same order as the columns in table1 that you wish to compare.&lt;br /&gt;
--&lt;br /&gt;
-- The result is all rows from either table that do NOT match&lt;br /&gt;
-- the other table in all columns specified, along with which table that&lt;br /&gt;
-- row is from.&lt;br /&gt;
&lt;br /&gt;
declare @SQL varchar(8000);&lt;br /&gt;
&lt;br /&gt;
IF @T2ColumnList = '' COLLATE DATABASE_DEFAULT SET @T2ColumnList = @T1ColumnList&lt;br /&gt;
&lt;br /&gt;
set @SQL = 'SELECT ''' COLLATE DATABASE_DEFAULT + @table1 + ''' AS TableName, ' COLLATE DATABASE_DEFAULT + @T1ColumnList +&lt;br /&gt;
 ' FROM ' COLLATE DATABASE_DEFAULT + @table1 + ' UNION ALL SELECT ''' COLLATE DATABASE_DEFAULT + @table2 + ''' As TableName, ' COLLATE DATABASE_DEFAULT +&lt;br /&gt;
 @T2ColumnList + ' FROM ' COLLATE DATABASE_DEFAULT + @table2&lt;br /&gt;
&lt;br /&gt;
set @SQL = 'SELECT Max(TableName) as TableName, ' COLLATE DATABASE_DEFAULT + @T1ColumnList +&lt;br /&gt;
 ' FROM (' COLLATE DATABASE_DEFAULT + @SQL + ') A GROUP BY ' COLLATE DATABASE_DEFAULT + @T1ColumnList + &lt;br /&gt;
 ' HAVING COUNT(*) = 1' COLLATE DATABASE_DEFAULT&lt;br /&gt;
 &lt;br /&gt;
exec ( @SQL);&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##comparetables 'PS_JOB','PS_EMPLOYMENT','EMPLID'&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for comparing remote tables via open query&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##comptab 'table1','table2','column1,column2...'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
&lt;br /&gt;
drop procedure ##comptab&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CREATE PROCEDURE ##comptab&lt;br /&gt;
(@table1 varchar(100), &lt;br /&gt;
 @server Varchar(100),&lt;br /&gt;
 @table2 Varchar(100), &lt;br /&gt;
 @T1ColumnList varchar(1000),&lt;br /&gt;
 @T2ColumnList varchar(1000) = ''&lt;br /&gt;
)&lt;br /&gt;
AS&lt;br /&gt;
-- Table1, Table2 are the tables or views to compare.&lt;br /&gt;
-- T1ColumnList is the list of columns to compare, from table1.&lt;br /&gt;
-- Just list them comma-separated, like in a GROUP BY clause.&lt;br /&gt;
-- If T2ColumnList is not specified, it is assumed to be the same&lt;br /&gt;
-- as T1ColumnList.  Otherwise, list the columns of Table2 in&lt;br /&gt;
-- the same order as the columns in table1 that you wish to compare.&lt;br /&gt;
--&lt;br /&gt;
-- The result is all rows from either table that do NOT match&lt;br /&gt;
-- the other table in all columns specified, along with which table that&lt;br /&gt;
-- row is from.&lt;br /&gt;
&lt;br /&gt;
declare @SQL varchar(8000);&lt;br /&gt;
&lt;br /&gt;
IF @T2ColumnList = '' COLLATE DATABASE_DEFAULT SET @T2ColumnList = @T1ColumnList&lt;br /&gt;
&lt;br /&gt;
set @SQL = 'SELECT ''' COLLATE DATABASE_DEFAULT + @table1 + ''' AS TableName, ' COLLATE DATABASE_DEFAULT + @T1ColumnList +&lt;br /&gt;
 ' FROM ' COLLATE DATABASE_DEFAULT + @table1 + ' UNION ALL SELECT * FROM openquery(' COLLATE DATABASE_DEFAULT + @server + ',''SELECT ''''' COLLATE DATABASE_DEFAULT + @table2 + ''''' As TableName, ' COLLATE DATABASE_DEFAULT +&lt;br /&gt;
 @T2ColumnList + ' FROM ' COLLATE DATABASE_DEFAULT + @table2 + ''')'&lt;br /&gt;
&lt;br /&gt;
set @SQL = 'SELECT Max(TableName) as TableName, ' COLLATE DATABASE_DEFAULT + @T1ColumnList +&lt;br /&gt;
 ' FROM (' COLLATE DATABASE_DEFAULT + @SQL + ') A GROUP BY ' COLLATE DATABASE_DEFAULT + @T1ColumnList + &lt;br /&gt;
 ' HAVING COUNT(*) = 1' COLLATE DATABASE_DEFAULT&lt;br /&gt;
&lt;br /&gt;
print @SQL&lt;br /&gt;
exec ( @SQL);&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
##comptab 'PS_DEPT_TBL','&amp;quot;SEVER1&amp;quot;','&amp;quot;SERVER1&amp;quot;.DEV.dbo.PS_DEPT_TBL','DEPTID'&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
select * from sys.servers&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for checking if table has a particular field&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##hasField 'recname', 'Fieldname'&lt;br /&gt;
              returns 1 if field there, otherwise 0&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
&lt;br /&gt;
drop procedure ##hasField&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CREATE PROCEDURE ##hasField&lt;br /&gt;
(@table varchar(100)&lt;br /&gt;
,@fieldName varchar(100)&lt;br /&gt;
)&lt;br /&gt;
AS&lt;br /&gt;
&lt;br /&gt;
declare @iFieldCount int&lt;br /&gt;
&lt;br /&gt;
select @iFieldCount = count(*) &lt;br /&gt;
from PSRECFIELD&lt;br /&gt;
where&lt;br /&gt;
@table in (RECNAME,'PS_'+RECNAME)&lt;br /&gt;
and FIELDNAME=@fieldName&lt;br /&gt;
&lt;br /&gt;
return @iFieldCount&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
declare @iField int&lt;br /&gt;
exec @iField = ##hasField 'PS_JOB','EFFDT'&lt;br /&gt;
print @iField&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for getting keys of a PS RECORD  as a comma sep list&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##getkey 'recname'&lt;br /&gt;
&lt;br /&gt;
Function cannot be temporary, procedure can only return a number&lt;br /&gt;
&lt;br /&gt;
drop procedure ##getkey&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
CREATE PROCEDURE ##getkey&lt;br /&gt;
(@table1 varchar(100)&lt;br /&gt;
)&lt;br /&gt;
returns varchar(1000) &lt;br /&gt;
AS&lt;br /&gt;
&lt;br /&gt;
DECLARE @cKeyField varchar(100), @cKeyFieldList varchar(1000)&lt;br /&gt;
&lt;br /&gt;
DECLARE cKey CURSOR FAST_FORWARD&lt;br /&gt;
FOR&lt;br /&gt;
select FIELDNAME &lt;br /&gt;
from PSKEYDEFN&lt;br /&gt;
where&lt;br /&gt;
INDEXID='_'&lt;br /&gt;
and RECNAME='ADDRESS_TYP_TBL'&lt;br /&gt;
order by KEYPOSN&lt;br /&gt;
&lt;br /&gt;
@cKeyFieldList=''&lt;br /&gt;
&lt;br /&gt;
OPEN cKey&lt;br /&gt;
FETCH NEXT FROM cKey&lt;br /&gt;
INTO @cKeyFieldList&lt;br /&gt;
&lt;br /&gt;
WHILE @@FETCH_STATUS = 0&lt;br /&gt;
&lt;br /&gt;
BEGIN&lt;br /&gt;
&lt;br /&gt;
	@cKeyFieldList = @cKeyFieldList + ',' + @cKeyField&lt;br /&gt;
&lt;br /&gt;
	PRINT @cKeyFieldList&lt;br /&gt;
&lt;br /&gt;
	FETCH NEXT FROM cKey&lt;br /&gt;
	INTO @cKeyFieldList&lt;br /&gt;
	&lt;br /&gt;
	END&lt;br /&gt;
&lt;br /&gt;
	CLOSE cKey&lt;br /&gt;
	DEALLOCATE cKey&lt;br /&gt;
return @cKeyFieldList&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for Absence Info Summary&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##abs '00007'&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
drop procedure ##abs&lt;br /&gt;
go&lt;br /&gt;
CREATE PROCEDURE ##abs &lt;br /&gt;
   @in_emplid varchar(11)&lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
print 'PS_GP_ABS_EVENT'&lt;br /&gt;
select 'PS_GP_ABS_EVENT',* from PS_GP_ABS_EVENT where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4,5,6&lt;br /&gt;
&lt;br /&gt;
print 'PS_GPGB_ABS_EVT_JR'&lt;br /&gt;
select 'PS_GPGB_ABS_EVT_JR',* from PS_GPGB_ABS_EVT_JR where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4,5,6&lt;br /&gt;
&lt;br /&gt;
print 'PS_GPGB_ABS_CERT'&lt;br /&gt;
select 'PS_GPGB_ABS_CERT',* from PS_GPGB_ABS_CERT where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4,5,6&lt;br /&gt;
&lt;br /&gt;
print 'PS_GPGB_KIT_DTL'&lt;br /&gt;
select 'PS_GPGB_KIT_DTL',* from PS_GPGB_KIT_DTL where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3&lt;br /&gt;
&lt;br /&gt;
print 'PS_GPGB_ABS_CMTS'&lt;br /&gt;
select 'PS_GPGB_ABS_CMTS',* from PS_GPGB_ABS_CMTS where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3,4,5,6&lt;br /&gt;
&lt;br /&gt;
print 'PS_GPXPYE_MSG_VW'&lt;br /&gt;
select 'PS_GPXPYE_MSG_VW',* from PS_GPXPYE_MSG_VW where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3&lt;br /&gt;
&lt;br /&gt;
print 'PS_GP_ABS_SS_DAT'&lt;br /&gt;
select 'PS_GP_ABS_SS_DAT',* from PS_GP_ABS_SS_DAT where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3&lt;br /&gt;
&lt;br /&gt;
print 'PS_GP_ABS_EVT_FCST'&lt;br /&gt;
select 'PS_GP_ABS_EVT_FCST',* from PS_GP_ABS_EVT_FCST where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3&lt;br /&gt;
&lt;br /&gt;
print 'PS_GP_ABS_SS_STA'&lt;br /&gt;
select 'PS_GP_ABS_SS_STA',* from PS_GP_ABS_SS_STA where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3&lt;br /&gt;
&lt;br /&gt;
print 'PS_GP_ABSSS_V_XREF'&lt;br /&gt;
select 'PS_GP_ABSSS_V_XREF',* from PS_GP_ABSSS_V_XREF where EMPLID=@in_emplid&lt;br /&gt;
order by 1,2,3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
##abs 00007&lt;br /&gt;
go&lt;br /&gt;
&lt;br /&gt;
/**************************************************************************************&lt;br /&gt;
   Global Temporary Procedure for Finding a Menu&lt;br /&gt;
      Usage:&lt;br /&gt;
              ##findmenu Establishment&lt;br /&gt;
***************************************************************************************/&lt;br /&gt;
drop procedure ##findmenu&lt;br /&gt;
go&lt;br /&gt;
CREATE PROCEDURE ##findmenu &lt;br /&gt;
   @in_menu varchar(300)&lt;br /&gt;
AS &lt;br /&gt;
&lt;br /&gt;
declare @pct char(1)&lt;br /&gt;
set @pct = '%';&lt;br /&gt;
&lt;br /&gt;
WITH PORTAL_REGISTRY (PORTAL_NAME, PORTAL_REFTYPE, PORTAL_OBJNAME, PORTAL_LABEL, PORTAL_URI_SEG1, PORTAL_URI_SEG2, PORTAL_URI_SEG3, PATH1) AS (&lt;br /&gt;
SELECT P.PORTAL_NAME&lt;br /&gt;
     , P.PORTAL_REFTYPE&lt;br /&gt;
     , P.PORTAL_OBJNAME&lt;br /&gt;
     , P.PORTAL_LABEL&lt;br /&gt;
     , PORTAL_URI_SEG1&lt;br /&gt;
     , PORTAL_URI_SEG2&lt;br /&gt;
     , PORTAL_URI_SEG3&lt;br /&gt;
     , CAST(P.PORTAL_LABEL COLLATE DATABASE_DEFAULT as VARCHAR(5000)) AS PATH1&lt;br /&gt;
  FROM PSPRSMDEFN P&lt;br /&gt;
 WHERE P.PORTAL_PRNTOBJNAME = ' ' COLLATE DATABASE_DEFAULT&lt;br /&gt;
UNION ALL&lt;br /&gt;
SELECT P_ONE.PORTAL_NAME&lt;br /&gt;
     , P_ONE.PORTAL_REFTYPE&lt;br /&gt;
     , P_ONE.PORTAL_OBJNAME&lt;br /&gt;
     , P_ONE.PORTAL_LABEL&lt;br /&gt;
     , P_ONE.PORTAL_URI_SEG1&lt;br /&gt;
     , P_ONE.PORTAL_URI_SEG2&lt;br /&gt;
     , P_ONE.PORTAL_URI_SEG3&lt;br /&gt;
     , CAST(PATH1 + ' &amp;gt; ' COLLATE DATABASE_DEFAULT + P_ONE.PORTAL_LABEL  as VARCHAR(5000)) AS PATH1&lt;br /&gt;
  FROM PORTAL_REGISTRY P&lt;br /&gt;
 INNER JOIN PSPRSMDEFN P_ONE&lt;br /&gt;
    ON P.PORTAL_NAME = P_ONE.PORTAL_NAME&lt;br /&gt;
   AND P.PORTAL_REFTYPE = 'F' COLLATE DATABASE_DEFAULT&lt;br /&gt;
   AND P.PORTAL_OBJNAME = P_ONE.PORTAL_PRNTOBJNAME&lt;br /&gt;
 WHERE P_ONE.PORTAL_PRNTOBJNAME != ' ' COLLATE DATABASE_DEFAULT )   &lt;br /&gt;
SELECT PORTAL_NAME&lt;br /&gt;
     , PORTAL_LABEL&lt;br /&gt;
     , PATH1&lt;br /&gt;
     , PORTAL_OBJNAME&lt;br /&gt;
     , PORTAL_REFTYPE&lt;br /&gt;
  FROM PORTAL_REGISTRY&lt;br /&gt;
 WHERE PORTAL_REFTYPE != 'F' COLLATE DATABASE_DEFAULT&lt;br /&gt;
 --  AND PORTAL_NAME = 'EMPLOYEE'&lt;br /&gt;
   AND (&lt;br /&gt;
      PORTAL_URI_SEG1 like @pct + @in_menu + @pct COLLATE DATABASE_DEFAULT&lt;br /&gt;
   OR PORTAL_URI_SEG2 like @pct + @in_menu + @pct COLLATE DATABASE_DEFAULT&lt;br /&gt;
   OR PORTAL_URI_SEG3 like @pct + @in_menu + @pct COLLATE DATABASE_DEFAULT&lt;br /&gt;
   OR PORTAL_LABEL like @pct + @in_menu + @pct COLLATE DATABASE_DEFAULT&lt;br /&gt;
   OR PORTAL_OBJNAME like @pct + @in_menu + @pct COLLATE DATABASE_DEFAULT&lt;br /&gt;
   )&lt;br /&gt;
   ;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	</feed>