sys.columns

We have a convention for the order of the columns within each of our tables. The primary key columns are always first, then the edit date and then the edit by column. I was writing a script that queried sys.columns to ensure this convention was met in each table.
The query returned an exception, but looking at the table, everything appeared to be correct. It turns out that a column had been removed, so there was a gap in the column_id values. Column_id is will give the correct order for the columns, but there can be gaps there.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: