207
votes

I work for a school district. Every year we have to export a list of students from our student management system and send it to a company that handles our online exams.

So to do this export, we had to hire someone who knew the inner workings of our student management system. He wrote an sql (Adaptive Sybase SQL Anywhere) query to export the students to a csv file like we needed. This was before I started working for the district, so for a while I assumed this was an actually application, until it came time for me to do the export myself.

And every year he charges us $500 to update this query to export the students for the current year. So when I discovered it was only a query (.bat file and .sql file), my thought was "I can update this myself". All I have to do is change the years in the query (eg. 2009 to 2010).

The query (.sql file) itself has this comment at the top:

// This code was writtend by [the guy]
// and is the property of [his company]...Copyright 2005,2006,2008,2009
// This code MAY NOT BE USED without the expressed written consent of 
// [his company].

(Yes, it really does says "writtend".)

So now my boss is worried that we're violating the copyright. And that the guy is gonna find out that I updated the query myself because we haven't asked him to update it this year and take legal action.

So back to the subject's question: Can he really copyright this query? And if so, is modifying it ourselves a copyright violation? In my mind, a single query isn't program code. It's more a command line command. But I don't know what it's considered legally.

38
  • 31
    Dang, that's a rough question. I'm eager to hear other people's thoughts. However, remember that this site can't really give you legal advice, so you'll probably want to talk to a real attorney for a definitive answer. Dec 3, 2009 at 15:57
  • 64
    Hire a consultant to write you a query which will accept date range as parameters and export your data. In the contract specify that school owns the code -- pay by hour of work. Dec 3, 2009 at 16:01
  • 15
    What happened in 2007? Dec 3, 2009 at 16:13
  • 46
    OMG, please post the query as a different question. I'm sure we can rewrite it from scratch and parametriced it.
    – Jonathan
    Dec 3, 2009 at 17:01
  • 88
    This made me think of the Borenstein quote: "It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter."
    – JRL
    Dec 3, 2009 at 17:32

72 Answers 72

2
votes

I'm a DBA and work with lots of third party applications with canned SQL code, and I've never seen something like this affixed to a SQL statement. If you have direct access into the database and can query data from it, just rewrite the code and don't give the guy another second's time as $500 for a single process like this seems like a rip from the get go.

But without seeing the code there's no telling how involved it is. I've written some SQL statements that go into hundreds of lines to get data, and they can take DAYS or even WEEKS to write and debug. If this guy invested that kind of time into the process and you're paying $500 per run, it may be worth it ... but if it's just a strait forward Select statement that's no more then a dozen or so lines long, that is not worth $500 and can be written by you or someone else with a basic understanding of SQL. Even if it looks similar to his, honestly sometimes there's only so many ways to write something. "The dog is blue"... how many ways can you say it? Not many :)

Yeah, I'm no lawyer either, but when it comes to things like this my ethics are what guide me.

2
votes

** EVERYTHING** can be copyrighted. If you feel that you can do the job yourself, go ahead and end the arrangement with the programmer. I would suggest that you attempt to write the query yourself (as it is both fun and educational) and not copy/paste the existing one (as this usually ends badly).

1
vote

From copyright.gov:

Copyrightable works include the following categories:

  1. literary works
  2. musical works, including any accompanying words
  3. dramatic works, including any accompanying music
  4. pantomimes and choreographic works
  5. pictorial, graphic, and sculptural works
  6. motion pictures and other audiovisual works
  7. sound recordings
  8. architectural works

These categories should be viewed broadly. For example, computer programs and most "compilations" may be registered as "literary works"; maps and architectural plans may be registered as "pictorial, graphic, and sculptural works."

And more specific to your question:

Several categories of material are generally not eligible for federal copyright protection. These include among others:

  • Works that have not been fixed in a tangible form of expression (for example, choreographic works that have not been notated or recorded, or improvisational speeches or performances that have not been written or recorded)
  • Titles, names, short phrases, and slogans; familiar symbols or designs; mere variations of typographic ornamentation, lettering, or coloring; mere listings of ingredients or contents
  • Ideas, procedures, methods, systems, processes, concepts, principles, discoveries, or devices, as distinguished from a description, explanation, or illustration
  • Works consisting entirely of information that is common property and containing no original authorship (for example: standard calendars, height and weight charts, tape measures and rulers, and lists or tables taken from public documents or other common sources)

IANAL, but I don't see anything in that list that would make a SQL query ineligible for copyright protection, while a program written in a turing-complete language would be considered copyrightable. I'm inclined to say, open-and-shut, SQL can be copyrighted.

With that in mind, you definitely want to take the advice of one of the other answers and either replace the code with something that doesn't have such an onerous license or get your contractor to parameterize the query. If he refuses, fire him without hesitation.

1
vote

So here's my view on the legal side of things ....

You need to look into the contractual situation at the first time delivery of that piece of software and determine who is the owner of the intellectual property (and sorry if I misinterpret the term "employed":

1) this guy was employed by your company according to a temporary or unlimited employment contract. Employment contracts usually contains a clause stating that all intellectual property this guy creates during employment remains the property of your company - GOOD CASE

2) you bought a one-off bespoke service from his company. The intellectual property is yours - GOOD CASE

3) you bought the usage right on a piece of software, it remains his intellectual property and you are not entitled to change the code - BAD CASE

To determine which of 2..3 applies, look up the invoice he sent plus any terms and conditions either you or he imposed.

Another question is, whether the contractual situation still is ongoing, i.e. is this guy liable to maintain the code over time or to make sure it's working or does he have to fulfill any SLA on that code. In this case the fee he claims is rectified (and I don't want to comment on price-worthiness here).

1
vote

If the developer who wrote it was confident in his product, he might release it without such restrictions and subject his work to the scrutiny of his peers. A second rate developer might over value his work and write copyright notices like that.

He states you may obtain written permission. Why don't you write him and tell him you're modifying his code rather than ask? Justify your actions and see if he challenges you.

1
vote

A copyright is just that; it concerns the right to copy something. (Note that backups are allowed.) So editing his code, and running the edited version would not violate copyright.

However, he could possibly try claim that he has not given written permission to use the code; and hence only he is allowed to use it. On the other hand, such a restriction may be deemed unreasonably restrictive - what happens if you drive over him in the parking lot? - (Did I just say that?^^)

However, as has been mentioned before, that comment cannot be considered in isolation from the documentation of the original contract.

Another thought is that the majority of developers who put such comments in their are only trying to prevent money grabbing corporations from making a fortune off of their work. I wouldn't be surprised if the only reason he charges so much money each year is that he really doesn't want to do the job, but you guys have just been too slow to figure out how easy it is.

1
  • 1
    If I own a piece of software, under copyright law I have the right to use it (which includes any necessary copies, as well as a backup). I don't have the right to create a derivative work. Editing the code would likely constitute a derivative work. If you want to know for sure, consult a lawyer specializing in software copyrights, not StackOverflow. Dec 7, 2009 at 22:04
1
vote

I'm not sure why most of you are so hung up on the code that he wrote and not hung up on the conditions under which he wrote the code. The original contract, assuming there was one, should spell out who owns the code at the end of the contract. The school has continued to hire and pay him to rewrite his "original" code and therefore there must be terms of his hire.

On a side note, it's just silly for the school to have hired someone to write code with the stipulation that they never own the code that he's been writing for them.

1
vote

Check your contract with the guy's company. It may already say that you own whatever code they've written anyway.

1
vote

This is not a case of copyright.

But what he was hired to do in the first place.

If he was hired to produce SQL code and the contract states you are the owners code - then the code is yours.

If on the other hand he was paid to supply a service, then it can be argued that the SQL code is his.

1
vote

I'm not an attorney, but if you're unsure about it you can add line in his work contract saying that all his code written during work hours, on work computers, etc. belongs to the company hiring him.

2
  • You mean the contract for "future" work, right? You can't back-modify an existing contract, so this would have no effect. Dec 4, 2009 at 22:43
  • Yes, that's what I meant. Obviously it would help if current contract had something like that already.
    – Phil
    Dec 7, 2009 at 20:10
1
vote

Just as others have stated here "I am not a lawyer" but I do deal quite a bit with intelectual property. Copyright can not be used to protect an idea. It is meant to protect an expresion. In other words, if someone was to write an article or a book or paint a picture you can't reproduce the copyrighted works without an express permission of the copyright holder. If you were to cut and paste the text of the query in to your own, you would most likely be violating the copyright. On the other hand, if you were to write your own query that achieves the same results but in a different way you would nto be infringing on the copyright. I think the question you have to ask yourself "can I write a similar query without copy/paste of the original query?"

1
vote

any content can be copywrited, including SQL procs, which methods may be considered a trade-secret. SQL procs can be a component of an entire application which most all are copywrited, unless the are released to the public as freeware, open source or with a GPL. If you feel uneasy about infringing on the SQL proc you mentioned, all you have to do is slightly modify the SQL proc by using an alternative statement or add a dummy part to it which has no effect on the desired result. In the chemical products industry, for example: a cleaning product made by ECOLAB, whose mixture of active and inactive chemical ingridients is patented, has been imitated by several other competitors who sell basically the same product for much less. The way the got around infringing on ECOLAB's patent is to modify the content of one or more chemical ingridients by 1%. So, using this as an analogy, you can do the same to the copywrited SQL proc.

0
votes

I suggest you post a different question: given this and that table structure of our student management system, what SQL query would the SO community come up with to export the list of students for any given year?

This will make your original question interesting, but irelevant for your task at hand, since you'll have a community provided solution, probably times and times more performant and easier to maintain :)

0
votes

Tricky way around: Assuming you cannot legaly change the query, change the data instead. Create a copy of the database, update the year and export the data with the 2009 query. Anyway, at least in my country, there is a lower threshold for what is covered by copyright. A simple query a'la "select foo,bar,bla,blub from foobar order by foo, bar" surely would not qualify.

0
votes

Take the SQL file, and change it by 20%. Add formatting, add aliases, whatever. If it's changed by 20% even if he tries to go to court no judge will claim its the same. It's not copyright, so don't worry about it.

If he wrote the code while at home, using all his own tools, then he could fight for the claim of rights. If he used ANY school materials when developing the SQL query, then it's the right to the school.

I deal with this crap all the time at work because I free lance and have a full time programming job.

0
votes

Standard Disclaimer: I am not an attorney and the following is not legal advice!

That said, if the programmer was hired by the school district to create the SQL statement expressly for the school district, then the SQL statement may well qualify as a "work made for hire," in which case the copyright would be owned by the school district, not the programmer.

The terms of the contract between the school district and the programmer might specify a different and binding arrangement, however.

Ask an actual intellectual property attorney.

0
votes

Does it say you cannot publish his code online?

Publish it here!

Then someone change it and publish the changed version without the copyright.. and use that.

0
votes

I think there is a thin line in this, our dev world about protecting our "ideas". What happen if I (that have ever look at the mentioned code) write a sentence by my own that results in exactly the same sentence that your provider is protecting (or trying to)? SQL is a very limited languaje and the best solution of a problem trends to be similar from one developer to another. Then can't I use my own code because is the same source than yours?

Just change the code, use it yourself and update your data. If they ask you about, answer that you have updated all the records manualy, one by one. You know, developers are very patient. How are they suposed to prove that this is not true?

1
  • Copyright cannot protect an idea or process. US courts have ruled that, if there's only a limited and fairly small number of ways to express something, it can't be copyrighted. Dec 7, 2009 at 22:00
0
votes

You can copyright source code.

But (generally) the copyright belongs to the person paying for the source code, unless it says differently in the work contract.

The school system is also (generally) entitled to alter the source code. The $500 they pay the consultant is for his time and effort.

0
votes

When the school district hired this guy, didn't it specify that everything he created would belong to the school, no matter what he wrote into any file? I'd say this takes precedence over anything else.

0
votes

He can write anything in the file, but if it's 'wrok for hire' it belongs to you. All such code is on that basis unless he has some other specific contract.

In any event there's no reason not to rewrite it yourself. If you don't use his code how can he complain? Really no court would take this seriously in any event, but you should also technically be fine because of both those points. Not to mention he cannot force you to show what code you have.

0
votes

It goes without saying, but nothing I say should be considered legal advice.

I would question the person who contracted out the work in the first place. If it was not properly contracted, then the contract may have been awarded as a favor. This is generally frowned upon in government work, and it is usually a poor way to run any business (for profit or not.)

The school authority should seriously review its contractual obligation with this company/individual, as he may owe some money. If this is in New Mexico, I know a lawyer who specializes in business law.

You could always appeal the this guy's compassionate side: "Think of the children" Seems to me $500 annually would go at least a little distance in an arts program of some sort.

Hope things work out for the best!

0
votes

Nobody is suing over a date change for $500. I'd change the date and never look back...and if I was the programmer I'd be embarrassed to be called back to change the date.

P

0
votes

I AM NOT A LAWYER.

You can still write your own NEW It basically comes down to the original contract and if it expressly states the work was "for hire":

From the US Copyright office guidelines: link text

"Copyright protection subsists from the time the work is created in fixed form. The copyright in the work of authorship immediately becomes the property of the author who created the work. Only the author or those deriving their rights through the author can rightfully claim copyright.

In the case of works made for hire, the employer and not the employee is considered to be the author. Section 101 of the copyright law defines a “work made for hire” as:

1 a work prepared by an employee within the scope of his or her employment; or

2 a work specially ordered or commissioned for use as:

  • a contribution to a collective work
  • a part of a motion picture or other audiovisual work
  • a translation
  • a supplementary work
  • a compilation
  • an instructional text
  • a test
  • answer material for a test
  • an atlas

if the parties expressly agree in a written instrument signed by them that the work shall be considered a work made for hire. "

1
  • Sue this guy to get money back! He has been claiming copyright on something does not belong to him and making benefit out of it.
    – Codism
    Dec 3, 2009 at 18:28
0
votes

If you post the full text of the query, we might be able to help.

0
votes

Offer to have him update the query to handle parameters for $500 and include a "work for hire" clause in the contract. If he doesn't accept, rewrite it.

0
votes

First of all, you need to consult the contract that was drawn up when you hired the guy originally.

This contract either stipulates, or doesn't, who owns the code.

Then, you take that contract, and hire an attorney to look over it, then he'll (or she'll) will tell you whether you have a leg to stand on and what your options are.

Nobody here is a lawyer, so you're not going to get any legal advice here. And even if someone here is a lawyer, that person is not going to respond here with anything you can depend on because if it turns out that you're taking legal advice from a programmers question&answer website from a lawyer answering, that lawyer will most likely have a very short career ahead of him (or her), so only a stupid lawyer would do that.

So what you're going to get here are opinions. If you want solid legal advice, hire an attorney.

0
votes

Another option (which you may or may not implement AT YOUR OWN RISK -- CONSULT A LAWYER!): Leave his code as is. Write a wrapper that reads his SQL and does a s/2009/$this_year/ before running it. There, you haven't changed anything...

2
  • Please read the fine print: ...it was only a query (.bat file and .sql file)... - I assume s/2009/$this_year/ will not work on his machine. Other than that It's a great idea, since if he writes another .bat file that uses the .sql one he's not modifying the contractor's code, but only uses it.
    – Azder
    Dec 5, 2009 at 16:14
  • @Azder - s/2009/$this_year/ (or some similar variation of it) will work on almost any machine if you have the right utilities installed. E.g., I have sed and perl installed on my windows machine. Either can be easily installed for free.
    – runrig
    Dec 5, 2009 at 22:53
0
votes

SQL queries absolutely can fall under copyright. However, copyright law is relevant only if you were to distribute the source code (i.e. make copies). Given that the consultant furnished a copy of the source code and you do not transmit it to others, copyright law does not apply.

The agreement between you and this consultant is another matter entirely. Check whether the contract granted you a license to use the code in perpetuity. Alternatively, ask him to revise the agreement (and the source code comments) before you hire him next year. When in doubt, check with an actual lawyer.

Disclaimer: I'm not a lawyer.

0
votes

Threaten to "name and shame" him unless he gives you written permission to modify the file as you see fit.

Bottom feeders who do unethical things like that give freelance software developers a bad name. He doesn't deserve to get work ... IMO.

Not the answer you're looking for? Browse other questions tagged or ask your own question.