May 28, 2012 at 1:19 am
Hello
how can i know which columns are used or which are not used ??
Is there any sp ??
Please help..
May 28, 2012 at 4:04 am
Please explain about what "columns" you have in mind, and who is "using" them.
Are you suggesting that some dynamic procedure is executing and you want to know which columns it is using??...Your post needs a little more explanation in order for us to make out what your requirement is.
May 28, 2012 at 4:12 am
Hello,
Using below sp you will find which column used in which tables,
SELECT t.name AS table_name, SCHEMA_NAME(schema_id) AS schema_name, c.name AS column_name
FROM sys.tables AS t INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%Your Column Name%' ORDER BY schema_name, table_name;
May 28, 2012 at 5:23 am
Please explain about what "columns" you have in mind, and who is "using" them.
Are you suggesting that some dynamic procedure is executing and you want to know which columns it is using??...Your post needs a little more explanation in order for us to make out what your requirement is.
No no.... I want to find out those columns which are not used in any where in any database ....
ex : when we create table than we add some columns but some time some columns are not needed though we create it... like that i want to find out those unused columns....
May 28, 2012 at 6:54 am
As far as I know, SQL Server doesn't out-of-the-box record and save column-usage statistics. You'll need to implement your own method here. You can get creative with a DML trigger on a table, but this will only capture INSERT/DELETE/UPDATE statements, not SELECTs if that's also what you're interested in.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply