Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Data Profilng Column Functional Dependency T-SQL Expand / Collapse
Author
Message
Posted Thursday, February 12, 2009 12:21 AM


SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, August 28, 2014 11:56 PM
Points: 42, Visits: 291
Comments posted to this topic are about the item Data Profilng Column Functional Dependency T-SQL

Ira Warren Whiteside
Post #655437
Posted Saturday, February 14, 2009 4:51 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, April 26, 2012 2:56 AM
Points: 7, Visits: 31
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?
Post #657140
Posted Saturday, February 14, 2009 5:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, April 26, 2012 2:56 AM
Points: 7, Visits: 31
I don't know why you make it in so complikated way.

Below you can find my version of your procedure.
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 < support_count then ''Violation Percentage''
ELSE ''Support Percentage''
end [Dependency type]
,CAST(CAST(cnt AS DECIMAL ) / frac_cnt * 100 AS DECIMAL (5, 2)) AS PercentViolation
FROM all_ v
,fraction_
WHERE fraction_.'+@Determinant+' = v.'+@Determinant+'
ORDER BY 1, 3 DESC ';
Print @SQL
Exec (@SQL)

and execution:
Exec ColumnDependency2
@TableName = 'Addresses',
@Dependent = 'StateProvinceName',
@Determinant = 'CountryRegionCode '

;)
Post #657143
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse