Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Online T-SQL Scripts and Copyright

By Brad McGehee,

There are thousands of Transact-SQL scripts available on the Internet. They provide a great way to learn how other people approach and solve the same kind of problems you have and, in many cases, will save you from having to "reinvent the wheel". When I need a new script, the first thing I always do is to check out the sizeable script libraries on SQLServerCentral.Com, Codeplex.Com, and other SQL Server-related websites. If I can't find what I need, then I usually resort to a Google search. If that turns up nothing, only then do I resort to writing it from scratch.

While these T-SQL script archives are a wonderful resource, they also have a few drawbacks. The issue of variable code quality has been well-discussed and you should always carefully evaluate and test any online scripts before using them. A lesser known, but equally important issue, is the one of copyright. Sometimes the situation is clear-cut. I have seen a few scripts that carry a copyright notice explicitly stating that you can't use the script without first obtaining permission from the author. In a few, ideal, cases the script author will have included some form of notice stating that the code has been published with a free public license, such as the one described at In this case, you will know that using the code won't get you into any potential legal trouble.

However, in the vast majority of cases, the scripts are published without any form of copyright notice. Most people assume, incorrectly, that these scripts are freely available for reuse. In the United States, by law, any creative work is automatically copyrighted by its author, even if the author does not specifically include a copyright notice within the work. In other words, you need to get express permission from the author to use their script.

In theory, if you reuse a script that does not have any copyright notice, you leave yourself, and the organization you work for, open to potential legal action from the script author, or from whoever owns the copyright for the script. Furthermore, making a small modification to a script does not necessarily protect you from copyright issues. If you base the code you write on someone else's code, you still may be violating copyright law.

The issue of copyright can get particularly sticky if the script author does not actually "own" the script. For example, it is not uncommon, especially at larger organizations, for employee contracts to stipulate that any creative work that an employee produces, while on the job, belongs to the organization. Any DBA subject to such an agreement should not share scripts on the Internet without specific permission from their organization. The problem is that, in the absence of a clear copyright statement, there is no way of telling who owns the script or even if the script author had permission to post it.

Because there are so many grey areas in copyright law, I would like to encourage all T-SQL script writers to:

  1. Verify that you own the code you write and, if not, that you have permission to share it.
  2. Include a free public license with any code you publish.

This way, people using your script can rest assured they are complying with copyright laws. I'd like to hear what you think. What is the best source of online scripts? How do you deal with the dilemma of scripts without any form of copyright notice? Do you think T-SQL script writers should include a free public license with the code they share?

Brad McGehee (Guest Editor)

Total article views: 412 | Views in the last 30 days: 1
Related Articles

Scripting Objects Including Permissions

Scripting Objects Including Permissions


Copyright at

Just to set the record straight, if you submit something you keep the copyright.



This is actually amazing. A talk on what YouTube does with copyright and how they view it, from TED....


Online T-SQL Scripts and Copyright

Comments posted to this topic are about the item [B]Online T-SQL Scripts and Copyright[/B] This is a...


Stored procedure to script out user permissions

Stored procedure to script out user permissions

database weekly