Viewing 15 posts - 1,426 through 1,440 (of 3,738 total)
Thanks Lynn but I tried casting the column but I can't get the syntax right.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 11:42 am
I will be able to use your script for other situations.
Thanks for pointing out the issues with the code.
I liked your use of CROSS APPLY, etc.
I'm sorry that I was...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 11:40 am
Lynn Pettis (5/18/2012)
Be sure to check out the change I made to the code I posted above. The join to sys.objects isn't even needed.
Nice code.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 11:13 am
What I need in the output is the Table Name, Column name, the Distinct Values & a record count.
TableName Column Name STATUS_OPEN RecordCount
WPA_DIARY_ENTRY ...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 11:12 am
Lynn Pettis (5/18/2012)
Welsh Corgi (5/18/2012)
Lynn,Don't worry about it.
I'm not using it.
Okay. I was noticing some things about the original query. The first query with the LEFT JOINS; the...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 10:02 am
Lynn,
Don't worry about it.
I'm not using it.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 9:25 am
Lynn Pettis (5/18/2012)
Welsh Corgi (5/18/2012)
How could I convert the code below to CTE?
SELECT s.Name AS SchemaName ,
...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 9:10 am
Gazareth (5/18/2012)
SELECT 'SELECT ' + TableName + ' AS TableName, ' + ColumnName + ' AS ColumnName, CASE WHEN COUNT(DISTINCT ' + ...
Yes, you'll need to do something...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 9:09 am
Thanks, it generated the SELECT Statements but I need to return the Table Name and Column Name in the output.
I'm not sure to handle text columns?
If the column is text...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 8:34 am
Gazareth.
Thanks for the help!
Unfortunately I get an error for the cte is being referenced.
Msg 208, Level 16, State 1, Line 1
Invalid object name 'cte_firstset'.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 8:15 am
Gazareth (5/18/2012)
I don't think you can, directly from that query.You'd have to generate some dynamic sql based on your results from the query you have.
If I could just get it...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 7:31 am
It is for a Data Warehouse Project.
If the column in the source system is not populated then we don't have to analyze it.
One reason we want to know the cardinality...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 7:30 am
Thank you for all of your help.
I need a variation of the script to determine what columns are populated and the cardinality of each row.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 7:13 am
Community Technology Preview
CTP is a Release Candidate quality release that is used by Microsoft to get feedback that facilitates change the design and improve the test suite.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 18, 2012 at 6:49 am
BTW, all of the tables have a million or more records.
If I provided sample data then I would need to basically find the offending records. 🙂
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 15, 2012 at 4:41 pm
Viewing 15 posts - 1,426 through 1,440 (of 3,738 total)