<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sentient beings &#187; Sql</title>
	<atom:link href="http://www.sentientbeings.com/category/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sentientbeings.com</link>
	<description>Adventures in BI</description>
	<lastBuildDate>Mon, 23 Jan 2012 09:12:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>T-Sql: How to find the maximum value for a field, or the second largest value, or the third largest value, or &#8230;</title>
		<link>http://www.sentientbeings.com/2012/01/t-sql-how-to-find-the-maximum-value-for-a-field-or-the-second-largest-value-or-the-third-largest-value-or/</link>
		<comments>http://www.sentientbeings.com/2012/01/t-sql-how-to-find-the-maximum-value-for-a-field-or-the-second-largest-value-or-the-third-largest-value-or/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 10:01:01 +0000</pubDate>
		<dc:creator>Kristof</dc:creator>
				<category><![CDATA[Selfish]]></category>
		<category><![CDATA[Sql]]></category>

		<guid isPermaLink="false">http://www.sentientbeings.com/?p=150</guid>
		<description><![CDATA[Many queries you write will be about finding the most recent data for a certain type of event, or the highest value for a certain object. While this is a straightforward query type, it gets complicated and ugly when you have to link two or more tables to find your maximum or minimum value. And [...]]]></description>
			<content:encoded><![CDATA[<p>Many queries you write will be about finding the most recent data for a certain type of event, or the highest value for a certain object. While this is a straightforward query type, it gets complicated and ugly when you have to link two or more tables to find your maximum or minimum value.  And it gets even more complicated when you don’t have to find the maximum value but the value that is just below the maximum value.</p>
<p>In the rest of the article, I will be talking about the maximum value for a field, but it’s also true of course for the minimum value.<br />
The query type you will encounter most often contains a subquery where the current value is compared to the maximum value for that particular field. A simple example is presented below.</p>
<pre class="tsql">&nbsp;
<span style="color: #0000FF;">SELECT</span>
  <span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#40;</span>tb2.<span style="color: #202020;">Field</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> MaxValueForField
<span style="color: #0000FF;">FROM</span>
  table1 tb1
    <span style="color: #0000FF;">INNER</span> join
  table2 tb2
    <span style="color: #0000FF;">ON</span>  tb2.<span style="color: #202020;">foreign_key</span> = tb1.<span style="color: #202020;">primary_key</span>
<span style="color: #0000FF;">WHERE</span>
  tb2.<span style="color: #202020;">Field</span> = <span style="color: #808080;">&#40;</span>
          <span style="color: #0000FF;">SELECT</span>
            <span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#40;</span>_tb2.<span style="color: #202020;">field</span><span style="color: #808080;">&#41;</span>
          <span style="color: #0000FF;">FROM</span>
            table1 _tb1
              <span style="color: #0000FF;">INNER</span> join
            table2 _tb2
              <span style="color: #0000FF;">ON</span>  _tb2.<span style="color: #202020;">foreign_key</span> = _tb1.<span style="color: #202020;">primary_key</span>
          <span style="color: #0000FF;">WHERE</span>
            _tb1.<span style="color: #202020;">primary_key</span> = tb1.<span style="color: #202020;">primary_key</span>
        <span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">GROUP</span> <span style="color: #0000FF;">BY</span>
  tb1.<span style="color: #202020;">primary_key</span>
&nbsp;</pre>
<p>The subquery can be avoided with a Common Table Expression that not only speeds up the entire query but also offers a solution for another problem that I will be discussing below.</p>
<pre class="tsql">&nbsp;
;
<span style="color: #0000FF;">WITH</span> tb2Sorted
&nbsp;
<span style="color: #0000FF;">AS</span>
&nbsp;
<span style="color: #808080;">&#40;</span>
  <span style="color: #0000FF;">SELECT</span>
    Row_Number<span style="color: #808080;">&#40;</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">OVER</span> <span style="color: #808080;">&#40;</span>partition <span style="color: #0000FF;">BY</span> tb1.<span style="color: #202020;">primary_key</span> <span style="color: #0000FF;">ORDER</span> <span style="color: #0000FF;">BY</span> tb2.<span style="color: #202020;">Field</span> <span style="color: #0000FF;">DESC</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> RowId,
    Field
  <span style="color: #0000FF;">FROM</span>
    table1 tb1
      <span style="color: #0000FF;">INNER</span> join
    table2 tb2
      <span style="color: #0000FF;">ON</span>  tb2.<span style="color: #202020;">foreign_key</span> = tb1.<span style="color: #202020;">primary_key</span>
<span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">SELECT</span>
  Field <span style="color: #0000FF;">AS</span> MaximaleIngangsDatum
<span style="color: #0000FF;">FROM</span>
  tb2Sorted
<span style="color: #0000FF;">WHERE</span>
  RowId = <span style="color: #000;">1</span>
&nbsp;</pre>
<p>This query performs better than the first one but also offers another advantage. </p>
<p>You can easily find the second or third largest value by simple changing the RowId. Bear in mind that this will not remove duplicates. If the values for Field are 1,1,2,5,5 then RowId 1 will yield 5 and RowId 2 will also yield 5. You can find the top 5 largest values for a certain field by simply changing the where clause to read RowId < 6.</p>
<pre class="tsql">&nbsp;
;
<span style="color: #0000FF;">WITH</span> tb2Sorted
&nbsp;
<span style="color: #0000FF;">AS</span>
&nbsp;
<span style="color: #808080;">&#40;</span>
  <span style="color: #0000FF;">SELECT</span>
    Row_Number<span style="color: #808080;">&#40;</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">OVER</span> <span style="color: #808080;">&#40;</span>partition <span style="color: #0000FF;">BY</span> tb1.<span style="color: #202020;">primary_key</span> <span style="color: #0000FF;">ORDER</span> <span style="color: #0000FF;">BY</span> tb2.<span style="color: #202020;">Field</span> <span style="color: #0000FF;">DESC</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> RowId,
    Field,
    RowId
  <span style="color: #0000FF;">FROM</span>
    table1 tb1
      <span style="color: #0000FF;">INNER</span> join
    table2 tb2
      <span style="color: #0000FF;">ON</span>  tb2.<span style="color: #202020;">foreign_key</span> = tb1.<span style="color: #202020;">primary_key</span>
<span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">SELECT</span>
  Field <span style="color: #0000FF;">AS</span> MaximaleIngangsDatum
<span style="color: #0000FF;">FROM</span>
  tb2Sorted
<span style="color: #0000FF;">WHERE</span>
  RowId &lt; <span style="color: #000;">6</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sentientbeings.com/2012/01/t-sql-how-to-find-the-maximum-value-for-a-field-or-the-second-largest-value-or-the-third-largest-value-or/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>T-SQL: Find any string in any column in any table in a database.</title>
		<link>http://www.sentientbeings.com/2012/01/t-sql-find-any-string-in-any-column-in-any-table-in-a-database/</link>
		<comments>http://www.sentientbeings.com/2012/01/t-sql-find-any-string-in-any-column-in-any-table-in-a-database/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 08:16:43 +0000</pubDate>
		<dc:creator>Kristof</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Sql]]></category>

		<guid isPermaLink="false">http://www.sentientbeings.com/?p=142</guid>
		<description><![CDATA[Have you ever found yourself in need of finding a certain string in an entire database? As a freelance BI consultant, this happens to me rather frequently when analysing where and how data is stored and how to retrieve it. So I came up with this code. It lets you find a string in any [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever found yourself in need of finding a certain string in an entire database? As a freelance BI consultant, this happens to me rather frequently when analysing where and how data is stored and how to retrieve it.</p>
<p>So I came up with this code. It lets you find a string in any column in any table on your database. It's a pretty length search if you have a lot of data and a lot of columns and tables, but it sure beats searching by hand.</p>
<p>Be warned! This may run a pretty long time on large databases.</p>
<pre class="tsql">&nbsp;
<span style="color: #0000FF;">DECLARE</span> @searchString <span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">DECLARE</span> @sqlString <span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">DECLARE</span> @processedString <span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#41;</span>
&nbsp;
<span style="color: #008080;">-- Insert your searchstring below</span>
<span style="color: #008080;">-- Use \ as escape character</span>
<span style="color: #008080;">-- examples:</span>
<span style="color: #008080;">--	to search for 'I'm waiting', use 'I\'m waiting'</span>
<span style="color: #008080;">--	to search for '25%' use '25\%'</span>
&nbsp;
<span style="color: #0000FF;">SELECT</span>
	@searchString = <span style="color: #FF0000;">'naar achter'</span>
&nbsp;
<span style="color: #0000FF;">DECLARE</span> @resultTable	<span style="color: #0000FF;">TABLE</span>
<span style="color: #808080;">&#40;</span>
	table_name	<span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #000;">255</span><span style="color: #808080;">&#41;</span>,
	<span style="color: #FF00FF;">COL_NAME</span>	<span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #000;">255</span><span style="color: #808080;">&#41;</span>,
	value_found	<span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#41;</span>,
	<span style="color: #FF00FF;">OBJECT_ID</span>	<span style="color: #0000FF;">INT</span>,
	col_id	<span style="color: #0000FF;">INT</span>
<span style="color: #808080;">&#41;</span>
&nbsp;
<span style="color: #0000FF;">SELECT</span>
	@sqlString = <span style="color: #FF0000;">'-- start'</span>,
	@processedString = <span style="color: #FF0000;">''</span>
&nbsp;
<span style="color: #0000FF;">WHILE</span>
	@sqlString &gt; <span style="color: #FF0000;">''</span>
<span style="color: #0000FF;">BEGIN</span>
&nbsp;
	<span style="color: #0000FF;">SELECT</span>
		@sqlString = <span style="color: #FF0000;">''</span>,
		@processedString = <span style="color: #FF0000;">''</span>
&nbsp;
	<span style="color: #0000FF;">SELECT</span>
		@processedString = @processedString +
		<span style="color: #0000FF;">CASE</span>
			<span style="color: #0000FF;">WHEN</span> DATALENGTH<span style="color: #808080;">&#40;</span>@sqlString<span style="color: #808080;">&#41;</span> &lt; <span style="color: #000;">7500</span> <span style="color: #008080;">-- assume a sql statement will never go beyond 500 characters</span>
			<span style="color: #0000FF;">THEN</span>
		<span style="color: #FF0000;">'
			select
				'</span><span style="color: #FF0000;">''</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>SCHEMA_NAME<span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">schema_id</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">'.'</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">OBJECT_NAME</span><span style="color: #808080;">&#40;</span>tbl.<span style="color: #FF00FF;">OBJECT_ID</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">''</span><span style="color: #FF0000;">' as table_name,
				'</span><span style="color: #FF0000;">''</span> + col.<span style="color: #202020;">name</span> + <span style="color: #FF0000;">''</span><span style="color: #FF0000;">',
				NULL as value_found,
				'</span> + <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">NVARCHAR</span>,tbl.<span style="color: #FF00FF;">OBJECT_ID</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">' as object_id,
				'</span> + <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">NVARCHAR</span>,col.<span style="color: #202020;">column_id</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">' as col_id
		'</span>
			<span style="color: #0000FF;">ELSE</span>
				<span style="color: #FF0000;">''</span>
		<span style="color: #0000FF;">END</span>,
		@sqlString = @sqlString +
		<span style="color: #0000FF;">CASE</span>
			<span style="color: #0000FF;">WHEN</span> DATALENGTH<span style="color: #808080;">&#40;</span>@sqlString<span style="color: #808080;">&#41;</span> &lt; <span style="color: #000;">7500</span> <span style="color: #008080;">-- assume a sql statement will never go beyond 500 characters</span>
			<span style="color: #0000FF;">THEN</span>
		<span style="color: #FF0000;">'
			select
				top 1
				'</span><span style="color: #FF0000;">''</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>SCHEMA_NAME<span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">schema_id</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">'.'</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">OBJECT_NAME</span><span style="color: #808080;">&#40;</span>tbl.<span style="color: #FF00FF;">OBJECT_ID</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">''</span><span style="color: #FF0000;">' as table_name,
				'</span><span style="color: #FF0000;">''</span> + col.<span style="color: #202020;">name</span> + <span style="color: #FF0000;">''</span><span style="color: #FF0000;">',
				'</span> + col.<span style="color: #202020;">name</span> + <span style="color: #FF0000;">' as value_found,
				'</span> + <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">NVARCHAR</span>,tbl.<span style="color: #FF00FF;">OBJECT_ID</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">' as object_id,
				'</span> + <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">NVARCHAR</span>,col.<span style="color: #202020;">column_id</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">' as col_id
			from
				'</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>SCHEMA_NAME<span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">schema_id</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">'.'</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">OBJECT_NAME</span><span style="color: #808080;">&#40;</span>tbl.<span style="color: #FF00FF;">OBJECT_ID</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">'
			where
				'</span> + col.<span style="color: #202020;">name</span> + <span style="color: #FF0000;">' like '</span><span style="color: #FF0000;">'%'</span> + @searchString + <span style="color: #FF0000;">'%'</span><span style="color: #FF0000;">' escape '</span><span style="color: #FF0000;">'<span style="color: #000099; font-weight: bold;">\'</span>'</span>
		<span style="color: #FF0000;">'
			else
				'</span><span style="color: #FF0000;">'
		end
	from
		sys.columns col
			inner join
		sys.tables tbl
			on	col.object_id = tbl.object_id
			and	col.user_type_id in (231, 167, 175, 239)
			 --	nvarchar, varchar, char, nchar
			 --	no text
			left join
		@resultTable rst
			on	col.column_id = rst.col_id
			and	col.object_id = rst.object_id
	where
		rst.table_name is null
&nbsp;
	print	@sqlString
	print	@processedString	
&nbsp;
	insert into
		@resultTable
	exec
		(@sqlString)
&nbsp;
	insert into
		@resultTable
	exec
		(@processedString)
&nbsp;
	print	'</span><span style="color: #008080;">---8&lt;-----------------------------------------------------------------------------------------------'</span>
&nbsp;
<span style="color: #0000FF;">END</span>
&nbsp;
<span style="color: #0000FF;">SELECT</span>
	table_name,
	<span style="color: #FF00FF;">COL_NAME</span>,
	value_found
<span style="color: #0000FF;">FROM</span>
	@resultTable
<span style="color: #0000FF;">WHERE</span>
	value_found <span style="color: #0000FF;">IS</span> not null
<span style="color: #0000FF;">ORDER</span> <span style="color: #0000FF;">BY</span>
	<span style="color: #000;">1</span>, <span style="color: #000;">2</span>, <span style="color: #000;">3</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sentientbeings.com/2012/01/t-sql-find-any-string-in-any-column-in-any-table-in-a-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drop all foreign keys on a database and optionally drop all tables</title>
		<link>http://www.sentientbeings.com/2012/01/drop-all-foreign-keys-on-a-database-and-optionally-drop-all-tables/</link>
		<comments>http://www.sentientbeings.com/2012/01/drop-all-foreign-keys-on-a-database-and-optionally-drop-all-tables/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 08:48:02 +0000</pubDate>
		<dc:creator>Kristof</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Sql]]></category>

		<guid isPermaLink="false">http://www.sentientbeings.com/?p=135</guid>
		<description><![CDATA[If you've ever found the need to drop or remove all foreign keys on a database then here's a little script that runs without cursors. &#160; DECLARE @SQL NVARCHAR&#40;MAX&#41; &#160; SELECT @SQL = '-- Start ' &#160; WHILE @SQL &#62; '' BEGIN SELECT @SQL = '' &#160; SELECT @SQL = @SQL + CASE WHEN DATALENGTH&#40;@SQL&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>If you've ever found the need to drop or remove all foreign keys on a database then here's a little script that runs without cursors. </p>
<pre class="tsql">&nbsp;
<span style="color: #0000FF;">DECLARE</span> @<span style="color: #0000FF;">SQL</span> <span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#41;</span>	
&nbsp;
<span style="color: #0000FF;">SELECT</span>
	@<span style="color: #0000FF;">SQL</span> = <span style="color: #FF0000;">'-- Start '</span>
&nbsp;
<span style="color: #0000FF;">WHILE</span> @<span style="color: #0000FF;">SQL</span> &gt; <span style="color: #FF0000;">''</span>
<span style="color: #0000FF;">BEGIN</span>
	<span style="color: #0000FF;">SELECT</span>
		@<span style="color: #0000FF;">SQL</span> = <span style="color: #FF0000;">''</span>
&nbsp;
	<span style="color: #0000FF;">SELECT</span>
		@<span style="color: #0000FF;">SQL</span> = @<span style="color: #0000FF;">SQL</span> +
			<span style="color: #0000FF;">CASE</span>
				<span style="color: #0000FF;">WHEN</span> DATALENGTH<span style="color: #808080;">&#40;</span>@<span style="color: #0000FF;">SQL</span><span style="color: #808080;">&#41;</span> &lt; <span style="color: #000;">7500</span> <span style="color: #0000FF;">THEN</span>
					N<span style="color: #FF0000;">'alter table '</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>schema_name<span style="color: #808080;">&#40;</span>schema_id<span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span>
					+ N<span style="color: #FF0000;">'.'</span>
					+ <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">OBJECT_NAME</span><span style="color: #808080;">&#40;</span>parent_object_id<span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span>
					+ N<span style="color: #FF0000;">' drop constraint '</span>
					+ name
					+ <span style="color: #0000FF;">CHAR</span><span style="color: #808080;">&#40;</span><span style="color: #000;">13</span><span style="color: #808080;">&#41;</span> + <span style="color: #0000FF;">CHAR</span><span style="color: #808080;">&#40;</span><span style="color: #000;">10</span><span style="color: #808080;">&#41;</span> <span style="color: #008080;">--+ 'GO' + CHAR(13) + CHAR(10)</span>
				<span style="color: #0000FF;">ELSE</span>
					<span style="color: #FF0000;">''</span>
			<span style="color: #0000FF;">END</span>
	<span style="color: #0000FF;">FROM</span>
		sys.<span style="color: #202020;">foreign_keys</span>
&nbsp;
	<span style="color: #0000FF;">PRINT</span> @<span style="color: #0000FF;">SQL</span>
	<span style="color: #0000FF;">EXEC</span> <span style="color: #AF0000;">SP_EXECUTESQL</span> @<span style="color: #0000FF;">SQL</span>
	<span style="color: #0000FF;">PRINT</span> <span style="color: #FF0000;">'---8&lt;------------------------------------------------------------------------------------------'</span>
<span style="color: #0000FF;">END</span>
&nbsp;
GO
&nbsp;
<span style="color: #008080;">---8&lt;-------------------------------------------------------------</span>
<span style="color: #008080;">-- Uncomment the line below to drop all tables too</span>
&nbsp;
<span style="color: #008080;">--exec sp_msforeachtable 'drop table ?'</span>
&nbsp;
<span style="color: #0000FF;">PRINT</span> <span style="color: #FF0000;">'All done'</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sentientbeings.com/2012/01/drop-all-foreign-keys-on-a-database-and-optionally-drop-all-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>T-SQL List all columns in all tables</title>
		<link>http://www.sentientbeings.com/2012/01/t-sql-list-all-columns-in-all-tables/</link>
		<comments>http://www.sentientbeings.com/2012/01/t-sql-list-all-columns-in-all-tables/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 08:40:01 +0000</pubDate>
		<dc:creator>Kristof</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Sql]]></category>

		<guid isPermaLink="false">http://www.sentientbeings.com/?p=132</guid>
		<description><![CDATA[If you've ever wanted to get a listing of all the columns in all of the tables in a certain database, here's how. I use this often for writing technical documentation on systems. This little code will list all of your tables, columns, datatypes, nullable option, identity option and will also indicate primary and foreign [...]]]></description>
			<content:encoded><![CDATA[<p>If you've ever wanted to get a listing of all the columns in all of the tables in a certain database, here's how. I use this often for writing technical documentation on systems.</p>
<p>This little code will list all of your tables, columns, datatypes, nullable option, identity option and will also indicate primary and foreign keys and default constraints.</p>
<pre class="tsql">&nbsp;
<span style="color: #0000FF;">SELECT</span>
<span style="color: #008080;">--	distinct</span>
<span style="color: #008080;">--	quotename(schema_name(tbl.schema_id)) + N'.' + quotename(tbl.name) as TableName,</span>
<span style="color: #008080;">--	col.column_id,</span>
	col.<span style="color: #202020;">name</span> <span style="color: #0000FF;">AS</span> ColumnName,
	type_name<span style="color: #808080;">&#40;</span>col.<span style="color: #202020;">user_type_id</span><span style="color: #808080;">&#41;</span>+
	<span style="color: #0000FF;">CASE</span>
		<span style="color: #0000FF;">WHEN</span> <span style="color: #FF00FF;">COLUMNPROPERTY</span><span style="color: #808080;">&#40;</span>tbl.<span style="color: #FF00FF;">OBJECT_ID</span>, col.<span style="color: #202020;">name</span>, <span style="color: #FF0000;">'scale'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">IS</span> null <span style="color: #0000FF;">THEN</span>
			<span style="color: #FF0000;">' ('</span> + <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">VARCHAR</span>,<span style="color: #FF00FF;">COLUMNPROPERTY</span><span style="color: #808080;">&#40;</span>tbl.<span style="color: #FF00FF;">OBJECT_ID</span>, col.<span style="color: #202020;">name</span>, <span style="color: #FF0000;">'precision'</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">')'</span> <span style="color: #008080;">--is null --convert(varchar, col.max_length)</span>
		<span style="color: #0000FF;">WHEN</span> col.<span style="color: #202020;">user_type_id</span> in <span style="color: #808080;">&#40;</span><span style="color: #000;">60</span>, <span style="color: #000;">106</span>, <span style="color: #000;">108</span>, <span style="color: #000;">122</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">THEN</span>
			<span style="color: #FF0000;">' ('</span> + <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">VARCHAR</span>,col.<span style="color: #0000FF;">PRECISION</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">','</span> + <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">VARCHAR</span>, col.<span style="color: #202020;">scale</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">')'</span>
		<span style="color: #0000FF;">ELSE</span> <span style="color: #FF0000;">''</span>
	<span style="color: #0000FF;">END</span>	<span style="color: #0000FF;">AS</span> DataType,
	<span style="color: #0000FF;">CASE</span> col.<span style="color: #202020;">is_nullable</span>
		<span style="color: #0000FF;">WHEN</span> <span style="color: #000;">0</span> <span style="color: #0000FF;">THEN</span> <span style="color: #FF0000;">'NOT '</span>
		<span style="color: #0000FF;">ELSE</span> <span style="color: #FF0000;">''</span>
	<span style="color: #0000FF;">END</span>
		+	 <span style="color: #FF0000;">'NULL'</span> <span style="color: #0000FF;">AS</span> Nullable,
	<span style="color: #0000FF;">CASE</span> col.<span style="color: #202020;">is_identity</span>
		<span style="color: #0000FF;">WHEN</span> <span style="color: #000;">0</span> <span style="color: #0000FF;">THEN</span> <span style="color: #FF0000;">''</span>
		<span style="color: #0000FF;">ELSE</span> <span style="color: #FF0000;">'IDENTITY ('</span> + <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">VARCHAR</span>, idc.<span style="color: #202020;">seed_value</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">','</span> + <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">VARCHAR</span>, idc.<span style="color: #202020;">increment_value</span><span style="color: #808080;">&#41;</span> + <span style="color: #FF0000;">')'</span>
	<span style="color: #0000FF;">END</span>	<span style="color: #0000FF;">AS</span> <span style="color: #808080;">&#91;</span><span style="color: #0000FF;">IDENTITY</span><span style="color: #808080;">&#93;</span>,
	<span style="color: #0000FF;">CASE</span>
		<span style="color: #0000FF;">WHEN</span> ixc.<span style="color: #202020;">column_id</span> <span style="color: #0000FF;">IS</span> not null <span style="color: #0000FF;">THEN</span>
			<span style="color: #FF0000;">'PK'</span>
		<span style="color: #0000FF;">WHEN</span> fkc.<span style="color: #202020;">constraint_object_id</span> <span style="color: #0000FF;">IS</span> not null <span style="color: #0000FF;">THEN</span>
			<span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>schema_name<span style="color: #808080;">&#40;</span>tb2.<span style="color: #202020;">schema_id</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + N<span style="color: #FF0000;">'.'</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>tb2.<span style="color: #202020;">name</span><span style="color: #808080;">&#41;</span> + N<span style="color: #FF0000;">'.'</span> + fcl.<span style="color: #202020;">name</span>
		<span style="color: #0000FF;">ELSE</span> <span style="color: #FF0000;">''</span>
	<span style="color: #0000FF;">END</span> <span style="color: #0000FF;">AS</span> Key_Constraint,
	<span style="color: #0000FF;">CASE</span>
		<span style="color: #0000FF;">WHEN</span> dfc.<span style="color: #FF00FF;">OBJECT_ID</span> <span style="color: #0000FF;">IS</span> not null <span style="color: #0000FF;">THEN</span>
			dfc.<span style="color: #202020;">definition</span>
		<span style="color: #0000FF;">ELSE</span> <span style="color: #FF0000;">''</span>
	<span style="color: #0000FF;">END</span> <span style="color: #0000FF;">AS</span> <span style="color: #808080;">&#91;</span><span style="color: #0000FF;">DEFAULT</span> <span style="color: #0000FF;">CONSTRAINT</span><span style="color: #808080;">&#93;</span>
<span style="color: #0000FF;">FROM</span>
	sys.<span style="color: #202020;">tables</span> tbl
		<span style="color: #0000FF;">INNER</span> join
	<span style="color: #808080;">&#40;</span>
		<span style="color: #0000FF;">SELECT</span>
			<span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>schema_name<span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">schema_id</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + N<span style="color: #FF0000;">'.'</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">name</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> TableName,
			col.<span style="color: #202020;">name</span>,
			col.<span style="color: #202020;">column_id</span>,
			col.<span style="color: #FF00FF;">OBJECT_ID</span>,
			col.<span style="color: #202020;">is_identity</span>,
			col.<span style="color: #202020;">is_nullable</span>,
			col.<span style="color: #0000FF;">PRECISION</span>,
			col.<span style="color: #202020;">scale</span>,
			col.<span style="color: #202020;">user_type_id</span>,
			<span style="color: #000;">1</span> <span style="color: #0000FF;">AS</span> SortKey
		<span style="color: #0000FF;">FROM</span>
			sys.<span style="color: #202020;">columns</span> col
				<span style="color: #0000FF;">INNER</span> join
			sys.<span style="color: #202020;">tables</span> tbl
				<span style="color: #0000FF;">ON</span>	tbl.<span style="color: #FF00FF;">OBJECT_ID</span> = col.<span style="color: #FF00FF;">OBJECT_ID</span>
&nbsp;
		<span style="color: #0000FF;">UNION</span> 
&nbsp;
		<span style="color: #0000FF;">SELECT</span>
			<span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>schema_name<span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">schema_id</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + N<span style="color: #FF0000;">'.'</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">name</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> TableName,
			<span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>schema_name<span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">schema_id</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + N<span style="color: #FF0000;">'.'</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">name</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> TableName,
			<span style="color: #000;">0</span>,
			tbl.<span style="color: #FF00FF;">OBJECT_ID</span>,
			<span style="color: #000;">0</span>,
			<span style="color: #000;">0</span>,
			<span style="color: #000;">0</span>,
			<span style="color: #000;">0</span>,
			<span style="color: #000;">0</span>,
			<span style="color: #000;">0</span>
		<span style="color: #0000FF;">FROM</span>
			sys.<span style="color: #202020;">tables</span> tbl
&nbsp;
	<span style="color: #808080;">&#41;</span>	col
		<span style="color: #0000FF;">ON</span>	tbl.<span style="color: #FF00FF;">OBJECT_ID</span> = col.<span style="color: #FF00FF;">OBJECT_ID</span>
		<span style="color: #0000FF;">LEFT</span> join
	sys.<span style="color: #202020;">key_constraints</span> pkc
		<span style="color: #0000FF;">ON</span>	pkc.<span style="color: #202020;">parent_object_id</span> = tbl.<span style="color: #FF00FF;">OBJECT_ID</span>
		and	pkc.<span style="color: #202020;">type</span> = <span style="color: #FF0000;">'PK'</span>
		<span style="color: #0000FF;">LEFT</span> join
	sys.<span style="color: #202020;">index_columns</span> ixc
		<span style="color: #0000FF;">ON</span>	ixc.<span style="color: #FF00FF;">OBJECT_ID</span> = tbl.<span style="color: #FF00FF;">OBJECT_ID</span>
		and	ixc.<span style="color: #202020;">index_id</span> = pkc.<span style="color: #202020;">unique_index_id</span>
		and	ixc.<span style="color: #202020;">column_id</span> = col.<span style="color: #202020;">column_id</span>
		<span style="color: #0000FF;">LEFT</span> join
	sys.<span style="color: #202020;">foreign_key_columns</span> fkc
		<span style="color: #0000FF;">ON</span>	fkc.<span style="color: #202020;">parent_object_id</span> = tbl.<span style="color: #FF00FF;">OBJECT_ID</span>
		and	fkc.<span style="color: #202020;">parent_column_id</span> = col.<span style="color: #202020;">column_id</span>
		<span style="color: #0000FF;">LEFT</span> join
	sys.<span style="color: #202020;">columns</span> fcl
		<span style="color: #0000FF;">ON</span>	fkc.<span style="color: #202020;">referenced_column_id</span> = fcl.<span style="color: #202020;">column_id</span>
		and	fkc.<span style="color: #202020;">referenced_object_id</span> = fcl.<span style="color: #FF00FF;">OBJECT_ID</span>
		<span style="color: #0000FF;">LEFT</span> join
	sys.<span style="color: #202020;">tables</span> tb2
		<span style="color: #0000FF;">ON</span>	fcl.<span style="color: #FF00FF;">OBJECT_ID</span> = tb2.<span style="color: #FF00FF;">OBJECT_ID</span>
		<span style="color: #0000FF;">LEFT</span> join
	sys.<span style="color: #202020;">default_constraints</span> dfc
		<span style="color: #0000FF;">ON</span>	dfc.<span style="color: #202020;">parent_object_id</span> = tbl.<span style="color: #FF00FF;">OBJECT_ID</span>
		and	dfc.<span style="color: #202020;">parent_column_id</span> = col.<span style="color: #202020;">column_id</span>
		<span style="color: #0000FF;">LEFT</span> join
	sys.<span style="color: #202020;">identity_columns</span> idc
		<span style="color: #0000FF;">ON</span>	idc.<span style="color: #FF00FF;">OBJECT_ID</span> = tbl.<span style="color: #FF00FF;">OBJECT_ID</span>
		and	idc.<span style="color: #202020;">column_id</span> = col.<span style="color: #202020;">column_id</span>
<span style="color: #0000FF;">WHERE</span>
	tbl.<span style="color: #202020;">type</span> = <span style="color: #FF0000;">'U'</span>
<span style="color: #0000FF;">ORDER</span> <span style="color: #0000FF;">BY</span>
	<span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>schema_name<span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">schema_id</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span> + N<span style="color: #FF0000;">'.'</span> + <span style="color: #FF00FF;">QUOTENAME</span><span style="color: #808080;">&#40;</span>tbl.<span style="color: #202020;">name</span><span style="color: #808080;">&#41;</span>,
	SortKey,
	ColumnName
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sentientbeings.com/2012/01/t-sql-list-all-columns-in-all-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to solve &#8220;Internal error: Invalid enumeration value. Please call customer support! is not a valid value for this element.&#8221;</title>
		<link>http://www.sentientbeings.com/2011/11/how-to-solve-internal-error-invalid-enumeration-value-please-call-customer-support-is-not-a-valid-value-for-this-element/</link>
		<comments>http://www.sentientbeings.com/2011/11/how-to-solve-internal-error-invalid-enumeration-value-please-call-customer-support-is-not-a-valid-value-for-this-element/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 12:55:21 +0000</pubDate>
		<dc:creator>Kristof</dc:creator>
				<category><![CDATA[Sql]]></category>

		<guid isPermaLink="false">http://www.sentientbeings.com/?p=129</guid>
		<description><![CDATA[When deploying a cube to SSAS (Sql Server Analysis Services) 10.50 aka 2008r2 using Visual Studio 2008, I got the following errors. Internal error: Invalid enumeration value. Please call customer support! is not a valid value for this element. An error occurred while parsing the 'StorageMode' element at line 1, column 6751 ('http://schemas.microsoft.com/analysisservices/2003/engine' namespace) under [...]]]></description>
			<content:encoded><![CDATA[<p>When deploying a cube to SSAS (Sql Server Analysis Services) 10.50 aka 2008r2 using Visual Studio 2008, I got the following errors.</p>
<ol>
<li>Internal error: Invalid enumeration value. Please call customer support! is not a valid value for this element.</li>
<li>An error occurred while parsing the 'StorageMode' element at line 1, column 6751 ('http://schemas.microsoft.com/analysisservices/2003/engine' namespace) under Load/ObjectDefinition/Dimension/StorageMode.
</li>
<li>Errors in the metadata manager. An error occurred when instantiating a metadata object from the file, '\\?\N:\SSAS\OLAP\Data\RMT_CUBE\RP DIM TIME.12.dim.xml'</li>
</ol>
<p>Additionally, building the project and then deploying using the wizard results in a similar string of error messages</p>
<p>The column in the second error and the file referenced in the third error may vary. The filename in the third error however is worth noticing because it's the dimension that is stopping you from deploying. In this case, my dimension was named "RMT DIM TIME".</p>
<p>On the internet, you will find many solutions advising you to drop the database and redeploy. I have found a way that is less time consuming and a lot less worrying than simply dropping your entire database.</p>
<p>I was able to solve the problem by simply re-processing the offending dimension in SSMS (Sql Server Management Studio). After re-processing the offending dimension, life was peachy again.</p>
<p>Hope this helps you. Apparently, installing the latest SSAS service pack would also solve the problem but that's not always a straightforward solution in a managed environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sentientbeings.com/2011/11/how-to-solve-internal-error-invalid-enumeration-value-please-call-customer-support-is-not-a-valid-value-for-this-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validating non-US dates in T-SQL</title>
		<link>http://www.sentientbeings.com/2009/11/validating-non-us-dates-in-t-sql/</link>
		<comments>http://www.sentientbeings.com/2009/11/validating-non-us-dates-in-t-sql/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 18:04:32 +0000</pubDate>
		<dc:creator>Kristof</dc:creator>
				<category><![CDATA[Sql]]></category>

		<guid isPermaLink="false">http://www.sentientbeings.com/?p=114</guid>
		<description><![CDATA[For persons not living in the US, date conversion is an every-day issue. While we mostly work around it by using representations of '20091116' for 16 November 2009, the non-geeks have no idea and enter their dates in their local format. For most of the Western-European countries, this would be a sequence of day, month, [...]]]></description>
			<content:encoded><![CDATA[<p>For persons not living in the US, date conversion is an every-day issue. While we mostly work around it by using representations of '20091116' for 16 November 2009, the non-geeks have no idea and enter their dates in their local format. For most of the Western-European countries, this would be a sequence of day, month, year.</p>
<p>It often happens when reading bulk information that dates get treated as text to minimise the amount of conversion errors on the import. I have seen a lot of intricate algorythms to verify the validity of such a string as a date. I have seen people cutting it up by explicitly searching for the separator, storing each part in a different variable, rearranging those variables and then convert the amalgamated strings into a new string which, hopefully, yields a date. I've seen code where the dates get split up, stuck in a table and then rearranged with selects. I believe there is an easier way which simply reads as follows.</p>
<pre class="tsql">&nbsp;
<span style="color: #0000FF;">SET</span> dateformat dmy
&nbsp;
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'It'</span><span style="color: #FF0000;">'s a date, cap'</span><span style="color: #FF0000;">'n!'</span>
<span style="color: #0000FF;">FROM</span> tblImport
<span style="color: #0000FF;">WHERE</span> <span style="color: #FF00FF;">ISDATE</span><span style="color: #808080;">&#40;</span>someDateField<span style="color: #808080;">&#41;</span> = <span style="color: #000;">1</span>
&nbsp;</pre>
<p>By using "set dateformat dmy", we tell SQL Server to analyse any possible date by assuming that first part of any date is the day of month, the second is the month and the last part is the year. There are drawbacks, however. You must use either a hyphen or a slash as a separator. You cannot use concatenated date strings or other separators such as periods or blanks.</p>
<p>Still, for us in continental Western-Europe, this solves a lot of problems when reading from bulk imports.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sentientbeings.com/2009/11/validating-non-us-dates-in-t-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SELECT instead of conditionals with variables</title>
		<link>http://www.sentientbeings.com/2009/11/using-select-instead-of-conditionals-with-variables/</link>
		<comments>http://www.sentientbeings.com/2009/11/using-select-instead-of-conditionals-with-variables/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 17:35:45 +0000</pubDate>
		<dc:creator>Kristof</dc:creator>
				<category><![CDATA[Sql]]></category>

		<guid isPermaLink="false">http://www.sentientbeings.com/?p=105</guid>
		<description><![CDATA[You may have found yourself coding something like this in a Stored Procedure. &#160; IF @pCode = 'AA' or @pCode = 'AB' or @pCode = 'BA' or @pCode = 'XY' SET @actionType = 'single' ELSE SET @actionType = 'combined' &#160; You can recode this to SQL to make it more readable. The second option will [...]]]></description>
			<content:encoded><![CDATA[<p>You may have found yourself coding something like this in a Stored Procedure.</p>
<pre class="tsql">&nbsp;
<span style="color: #0000FF;">IF</span> @pCode = <span style="color: #FF0000;">'AA'</span> or @pCode = <span style="color: #FF0000;">'AB'</span> or @pCode = <span style="color: #FF0000;">'BA'</span> or @pCode = <span style="color: #FF0000;">'XY'</span>
	<span style="color: #0000FF;">SET</span> @actionType = <span style="color: #FF0000;">'single'</span>
<span style="color: #0000FF;">ELSE</span>
	<span style="color: #0000FF;">SET</span> @actionType = <span style="color: #FF0000;">'combined'</span>
&nbsp;</pre>
<p>You can recode this to SQL to make it more readable.</p>
<p>The second option will be slower - about four times slower - but on my stone-age development system, it still performed 20000 iterations in under 200ms. That's 100000 comparisons per second. </p>
<pre class="tsql">&nbsp;
<span style="color: #0000FF;">SELECT</span>
	@actionType = <span style="color: #FF0000;">'combined'</span>
&nbsp;
<span style="color: #0000FF;">SELECT</span>
	@actionType = <span style="color: #FF0000;">'single'</span>
<span style="color: #0000FF;">WHERE</span>
	@pCode in
		<span style="color: #808080;">&#40;</span>
			<span style="color: #FF0000;">'AA'</span>,
			<span style="color: #FF0000;">'AB'</span>,
			<span style="color: #FF0000;">'BA'</span>,
			<span style="color: #FF0000;">'XY'</span>
		<span style="color: #808080;">&#41;</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sentientbeings.com/2009/11/using-select-instead-of-conditionals-with-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

