Unix Technical Forum

Re: TSQL Questions

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 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 05:42 PM
Ray Higdon
 
Posts: n/a
Default Re: TSQL Questions

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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:33 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com