Chris Nizzardini, Salt Lake City Utah, Web Developer Specializing in LAMP+Ajax Since 2006

My Blog

Here is my awesome blog. You can find information on programming, linux, documentation, tips for code and database optimization, my thoughts and rants, and whatever else I feel like sharing. Feel free to contribute to the blog by posting comments and asking questions.
SQL

Querying MS SQL database looking for a specific column

At work we interact with a MS SQL server that our shipping software runs on. We are a MySQL shop so don’t use MS SQL too much and the database in this proprietary shipping system is pretty large (about 100 tables). I needed to find a table that another table had a relation too and only knew the column name. So I ran this

SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name = ‘Alias_ID’ )

in MS SQL 2000 Query Analyzer and returned a list of 6 tables.

A lot better to troll through 6 tables than 100 tables.

Related posts:

  1. Mod-Log-SQL – Storing Apache Access Logs in a MySql Database

Leave a Reply