This is a discussion on Re: TSQL Questions within the SQL Server forums, part of the Microsoft SQL Server category; --> You can use this proc to find columns of a certain name: Create procedure dbo.sp_findfields (@sfieldname varchar(20)) As Select ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| You can use this proc to find columns of a certain name: Create procedure dbo.sp_findfields (@sfieldname varchar(20)) As Select substring(so.name,1,50) ‘table name’, Substring (sc.name, 1, 50) ‘field name’ From sysobjects so Inner join syscolumns sc on so.id = sc.id Where so.type = ‘u’ And sc.name like ‘%’ + @sfieldname Order by so.name, sc.name --To call exec 'sp_findfields id' to search for columns with id in the name I did not write it nor do I remember where I got it. OSQL is a command line utility to run SQL commands, lookup OSQL utility in BOL. HTH Ray Higdon MCSE, MCDBA, CCNA *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |