RobotII

Welcome to the real world
  • Best Man’s Speech
  • Firefox Tricks and Tips
  • Links
  • Scripts

Monthly Archives: July 2011

Get all tables with a particular column name [SQL Server]

17/7/2011 Posted by Pete under SQL Server
1 Comment

The following SQL is useful in picking the names of all tables in a database that have a column with a particular name. Note that this uses system objects that may be subject to change in future releases.

SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%column_name%'
ORDER BY schema_name, table_name

This returns the name of the table, schema (e.g. dbo), and the column name. The like clause will return columns with names containing the phrase, in case there are any prefixes or postfixes on the column name.

See Also:

sp_msforeachtable – search on google or other search engine
sp_msforeachdb – search on google or other search engine

Similar Posts:

  • How to drop a table only if it already exists [SQL Server]
  • Search Engine Creations
  • To all those still using Internet Explorer
  • RSS feeds and Google
  • links for 2006-03-21

How to drop a table only if it already exists [SQL Server]

15/7/2011 Posted by Pete under SQL Server
No Comments

This is the best way I have found of dropping a table if (and only if) it already exists.

IF OBJECT_ID('dbo.[TABLE_NAME]','U') IS NOT NULL
DROP TABLE dbo.[TABLE_NAME]
GO

the advantage that this method has over numerous other methods is that it will work in tempdb, with temporary tables. i.e you can use ‘tempdb..#temp’

Similar Posts:

  • Get all tables with a particular column name [SQL Server]
  • RSS feeds and Google
  • Twitter and Productivity – The seven deadly virtues
  • Scripts
  • QuickTodo Android App now Available on Android Market

How to annoy your fellow commuters (Part 2)

14/7/2011 Posted by Pete under General
1 Comment

As it’s about time for part 2, and I’ve learned much in the past few years, having gained the experience of commuting to a different place, I thought I would share another powerful tip with you. This tip is even more powerful than the last time, so be very wary of when you use it.

Stand opposite the person you wish to annoy (you won’t be getting a seat, and there are too many annoying people for you not to be standing across from one, so this is a given).

Look in the direction of the person, but focus on a point behind their head so you are looking straight through them.

Refuse to make eye contact with the person, instead maintaining your gaze until the person stops being annoying, turns away or moves (or if you get tired or bored instead).

You will be astounded by how this affects people. the effects can be quite devastating. At the very least, people will be uncomfortable with it, and will seek to avoid your gaze.

For a double helping from today’s tip jar, combine the above with Pavlovian training, to entice your fellow commuters to be nice. To do this, simply wait until the person stops the annoying behaviour, then simply stop staring through them, make eye contact and smile. It will be more effective if you can repeat the training, either over multiple sessions, or multiple times in the same journey.

Leave your tips below in the comments.

Similar Posts:

  • How to annoy your fellow commuters (Part 1)
  • Getting to comment on other people’s giraffes, like blog posts
  • How to leave a good comment, and lasting impression on someone’s site
  • Increase your time with God
  • How to write an excellent Best Man’s Speech

-->
Subscribe
RSS feed

Subscribe to this site's RSS feed.

Desktop Reader Bloglines Google Live Netvibes Newsgator Yahoo! What's This?
Tags
amazon analytics blog blogging buy change development ebay Firefox gnome God Google Google_Sitemaps GTD HTML information interesting internet-explorer iPod life Life Hacks linux Mac mozilla MP3 Open Source pagerank photos PHP Play productivity sharing Sitemaps site updates Software statistics time tips websites web_browser wedding Wordpress work world writing
Recent Posts
  • Update to Ultimate Google Analytics WordPress Plugin
  • Just do it (again)
  • ASUS Transformer TF101 with docking station
  • What’s going to be different this time?
  • Get all tables with a particular column name [SQL Server]
Recent Posts
  • Update to Ultimate Google Analytics WordPress Plugin
  • Just do it (again)
  • ASUS Transformer TF101 with docking station
  • What’s going to be different this time?
  • Get all tables with a particular column name [SQL Server]
Recent Comments
  • gadgets (be/nl) on Ze drem vil finali kum tru
  • Ema on Best Man’s Speech
  • The question to ask when attempting change « Life With Patterns on What’s going to be different this time?
  • The question to ask when attempting change « 43Coffee on What’s going to be different this time?
  • nnja_man on Get all tables with a particular column name [SQL Server]
Subscribe
RSS feed

Subscribe to this site's RSS feed.

Desktop Reader Bloglines Google Live Netvibes Newsgator Yahoo! What's This?
RobotII powered by WordPress and The Clear Line Theme