﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Ira Whiteside  / Data Profilng Column Functional Dependency T-SQL / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 11:23:49 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Data Profilng Column Functional Dependency T-SQL</title><link>http://www.sqlservercentral.com/Forums/Topic655437-1345-1.aspx</link><description>I don't know why you make it in so complikated way.Below you can find my version of your procedure.[code]CREATE PROCEDURE [dbo].[ColumnDependency2]    @TableName VARCHAR(128)  ,    @Determinant VARCHAR(128) ,@Dependent VARCHAR(128)                    AS Declare @SQL VarChar(MAX);SELECT @SQL = 'WITH all_ AS (        SELECT '+@Determinant+'              ,'+@Dependent+'              ,count(*) cnt        FROM '+@TableName+'        GROUP BY '+@Determinant+'              ,'+@Dependent+'  ), fraction_ AS (        SELECT '+@Determinant+'              ,max(cnt) support_count              ,sum(cnt) frac_cnt          FROM all_         GROUP BY '+@Determinant+' )SELECT v.'+@Determinant+'      ,'+@Dependent+'      ,cnt [Dependeny Counts]      ,case when cnt &amp;lt; support_count then ''Violation Percentage''            ELSE ''Support Percentage''       end [Dependency type]      ,CAST(CAST(cnt AS DECIMAL ) / frac_cnt  * 100 AS DECIMAL (5, 2)) AS PercentViolationFROM all_ v    ,fraction_WHERE fraction_.'+@Determinant+' = v.'+@Determinant+'ORDER BY 1, 3 DESC ';Print @SQLExec (@SQL)[/code]and execution:[code]Exec ColumnDependency2    @TableName = 'Addresses',    @Dependent = 'StateProvinceName',    @Determinant = 'CountryRegionCode '[/code];)</description><pubDate>Sat, 14 Feb 2009 05:08:08 GMT</pubDate><dc:creator>tomasz.cwajda</dc:creator></item><item><title>RE: Data Profilng Column Functional Dependency T-SQL</title><link>http://www.sqlservercentral.com/Forums/Topic655437-1345-1.aspx</link><description>I really don't know what is showig this pie chart !This is some creasy idea to use pie chart to this data, is't it?</description><pubDate>Sat, 14 Feb 2009 04:51:46 GMT</pubDate><dc:creator>tomasz.cwajda</dc:creator></item><item><title>Data Profilng Column Functional Dependency T-SQL</title><link>http://www.sqlservercentral.com/Forums/Topic655437-1345-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/Data+Profiling/65615/"&gt;Data Profilng Column Functional Dependency T-SQL&lt;/A&gt;[/B]</description><pubDate>Thu, 12 Feb 2009 00:21:39 GMT</pubDate><dc:creator>Ira Warren Whiteside</dc:creator></item></channel></rss>