Commenting in SQL Scripts

As you probably know, it’s a good idea to comment any script or other development work that you do. Adding comments to a SQL script is very easy, simply prepend any comments with two hyphens and whatever you type on that row will be a comment.

If you want to enter a block of comment the add /* at the start of the comment block and */ at the end. Doing this means you can type freely without the need to add at the start of each line.

Finally, if you want to comment against an individual line of code, just enter at the start of your comment on the same line.

Commenting your code is exceptionally easy and when you return to review what you have done months or even years later helps you understand the flow of the solution and why you made certain decisions.

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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.