Simple SQL best practices

It’s real easy to go crazy with best practices and then have them become so big no one follows them.
Here are a just a couple of quick best practices I follow.

1.Whenever you need to recreate a database object use DROP/ CREATE rather than ALTER.
The reason is that ALTER doesn’t modify the object’s create date time stamp.
This makes it harder to trouble shoot when you can’t figure out what has changed recently.
(See this post for how to tell what’s been modified recently.)

2. Adhere to a naming conventions of procedures (uspNAME), views (uvNAME), data/server links (dlNAME/slNAME – crossing servers or databases).
Since code can be in different places in management studio it helps to figure out what bucket you need to look at for your offending code.

[tweetmeme only_single=”false”]

Got something to add?

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s