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

Find Column Usage Expand / Collapse
Author
Message
Posted Wednesday, October 3, 2007 5:36 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, April 19, 2011 5:10 PM
Points: 275, Visits: 168
Comments posted to this topic are about the item Find Column Usage


Karen Gayda
MCP, MCSD, MCDBA

gaydaware.com
Post #406127
Posted Wednesday, October 10, 2007 6:37 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, May 26, 2014 8:31 PM
Points: 15, Visits: 32
You have just a little problem with this.

If the column name is not present in the SELECT section, but it's there in the WHERE clause,
The stored procedure ignore this case.

With this example:

CREATE FUNCTION dbo.ufGetUserID (@p_Username varchar(20))
RETURNS int as
RETURN (
SELECT usrID
FROM TB_usrUser
WHERE usrName = @p_Username
)

The function ufGetUserID is never returning,
Because you search the column name before the table name !



Post #408955
Posted Wednesday, October 10, 2007 1:16 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, April 19, 2011 5:10 PM
Points: 275, Visits: 168
I think you have mistaken this with another post.


Karen Gayda
MCP, MCSD, MCDBA

gaydaware.com
Post #409219
Posted Friday, October 17, 2008 9:18 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, August 16, 2013 8:17 AM
Points: 14, Visits: 139
Thanks for the wonderful post, this is exactly what i was looking to implement. Good job.
Post #587741
Posted Friday, October 17, 2008 1:30 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, April 19, 2011 5:10 PM
Points: 275, Visits: 168
Thank you.


Karen Gayda
MCP, MCSD, MCDBA

gaydaware.com
Post #587948
Posted Wednesday, October 22, 2008 11:35 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, August 7, 2009 5:46 PM
Points: 295, Visits: 67
Does the script account for the possibility that the column name might cross a syscomments boundary (e.g., Part of the column name is at the end of syscomments.Row1 while the rest of the column name begins syscomments.row2) or do you feel that this condition won't occur?

============================================================
I believe I found the missing link between animal and civilized man. It is us. -Konrad Lorenz, Nobel laureate (1903-1989)
Post #589990
Posted Wednesday, October 22, 2008 1:34 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, April 19, 2011 5:10 PM
Points: 275, Visits: 168
I suppose that is a possibility but I have not encountered it yet.


Karen Gayda
MCP, MCSD, MCDBA

gaydaware.com
Post #590083
Posted Wednesday, December 1, 2010 10:15 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, July 24, 2014 4:57 PM
Points: 1, Visits: 127
This may work better for the trigger references:

SELECT DISTINCT SUBSTRING( SO.NAME, 1, 60 ) AS [Trigger Name]
FROM sysobjects AS SO
JOIN syscomments AS SC
ON SO.ID = SC.ID
WHERE SO.XTYPE = 'TR'
AND SC.Text LIKE '%' + @vcColumnName + '%'
AND ( @vcTableName = '' OR OBJECT_NAME( SO.Parent_Obj ) = @vcTableName )
ORDER BY [Trigger Name]

Post #1028799
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse