DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Find A Table Column On SQL Server

05.15.2006
| 345271 views |
  • submit to reddit
        I often find myself looking for a specific database column that I have no idea where to find. Pouring over hundreds of tables is painful. One way to quickly narrow the search is to use this query...

SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name = 'THE_COLUMN_NAME' )

...or, if you're unsure exactly what the column is named, but you suspect you know <em>part</em> of the name, then try...

SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name like '%PART_OF_NAME%' )
    

Comments

Abdel Zoo replied on Wed, 2014/10/22 - 6:52pm

 great  informative post that you have shared ,tanck you for this articl  العاب صبايا فلاش

Paker Milar replied on Thu, 2013/09/12 - 6:51am

I am really impressed by this blog! Very clear explanation of issues is given and it is open to everyone. I have read your post, really you have provided such a great information about it.  Economic News 

Prets Singh replied on Sat, 2013/11/23 - 4:48am in response to: Paker Milar

Modelagentur A good website should display and function in any type of web browser, so it is vital that you test your website in every browser currently on the market. What may work great in Firefox, may not work well in Internet Explorer or Chrome. Visually test your website in every browser you can prior to launch.www.hghprice.org 

Momo Singh replied on Wed, 2013/06/05 - 11:49pm

A good informative post that you have shared and thankful your work for sharing the information. Got some entertaining information and would like to give it a try. Appreciate your work and keep sharing your information.  delivery flowers

Pinky Rajput replied on Mon, 2013/07/29 - 6:40am in response to: Momo Singh

ac services   Drinking games are games which involve the consumption of alcoholic beverages. Evidence of the existence of drinking games dates back to antiquity. Drinking games have been banned at some institutions, particularly colleges and universities.

Snippets Manager replied on Sun, 2009/07/05 - 12:16pm

SELECT COLUMN_NAME,data_type,character_maximum_length from information_schema.columns WHERE TABLE_NAME = 'referral' The other way to find the columns in a table, their type, length etc... Thanks & Regards Bharath Reddy VasiReddy

kjh;kljh hkjhkjg replied on Fri, 2009/06/12 - 3:50am

As this post is info less I couldn't make the best out of it. I need regards from you. Regards, extreme tiredness

dgdg dfdfd replied on Wed, 2009/06/10 - 2:07am

I can help you in this.You can find a new site at: Toronto personal injury lawyer

dfdf dfdfd replied on Fri, 2009/06/05 - 8:48am

I want this info before one month.I have tried for it.But I couldn't find it helpful then if I found.Any how thanks for sharing. regards, by Hatt - free music

dfdf dfdfd replied on Fri, 2009/06/05 - 8:48am

This is really a free column for us.One way to quickly narrow the search is to use this query...I have bookmarked this post.Thanks for sharing.wine clubs

fgfgfgf gfgf replied on Thu, 2009/06/04 - 3:30am

Well, like NoKarma said, all of the code interacting with the database should be in a model, not a controller. The redirects are also quite confusing for someone that doesn't know what's going on in the code, they can probably be done in a much better fashion.thanks, Display Stands Vancouver