tags:

views:

6977

answers:

71

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.

+15  A: 

I am not an attorney, but from what I understand:

Unless you had an express "work for hire" agreement in writing, or could prove that a mutual understanding of "work-for-hire" existed, then he would have been within his legal right to limit the use of that code.

"Work for hire" basically means anything created by an individual while under a "work-for-hire" arrangement, is immediately the property of the person hiring them. Without such an agreement, new work created is automatically copyrighted to the individual writing it. I believe any work created by an employee (not sub-contractor) is automatically considered "work for hire".

Of course you cannot copyright ideas, only a specific expression of those ideas.

Doug Neiner
@dcneiner:A contractor is normally considered a temporary employee. This SQL query does not seem to fall within any of the categories where it would need an express agreement to qualify as a work made for hire.
Jerry Coffin
@Jerry, I guess I disagree. You expect subcontractors to have their own workman's comp, bill on a regular basis, etc. I don't see how they would be considered an employee in any way. And work-for-hire law requires an explicit agreement or proof that it was the understanding.
Doug Neiner
If a contractor works on a potential employer's premises and is assigned work by the employer, etc., under some circumstances the contractor will be considered an employee for some purposes in the US. I really doubt this is one of the cases, but of course I'm not a lawyer and this is not illegal advice.
David Thornley
Hmm, wouldn't a SQL query be a implementation of an idea? They could twist the query around a little bit though for their own implementation.
John
+22  A: 

As always, if you're truly worried about it then ask a lawyer. We're developers.

If I saw something like that and the query wasn't anything overly complicated, I'd re-write it myself (possibly using his query strictly to figure out the database schema, but that's it).

At that point, you'd be updating your work...not somebody else's.

As for his query...if there was no contract signed at the time of the work, I think it'd be a little flaky to enforce the Copyright.

Justin Niessner
Ouch, that's reverse engineering... equally dodgy.
Lazarus
But you're not reverse engineering his query...only using it to determine the database structure (of a database that doesn't belong to him to begin with).
Justin Niessner
Hmmm... if you were 'clean room', i.e. you'd never seen his code and you wrote your own query from scratch without any reference to his code, whether direct or through the comments of someone who had seen his code, then you are right. Unfortunately the Asker has already admitted visibility of the code
Lazarus
That's not even needed. You can certainly find the data without looking at the query, with more or less effort, surely in about 500 worth of time
Vinko Vrsalovic
@Vinko - One would assume so...
Justin Niessner
@Vinko, the problem comes from trying to circumvent copyright by seeing some code you want to use but not wanting to be bound by the copyright of the author so you just rewrite it, admittedly your own way, but in essence utilising knowledge gained from looking at the copyrighted code. It's next to impossible to prove that you didn't learn something from the original code, once you've read it. The answer is to get someone else who has never see the code to rewrite it and make sure that they surrender the copyright or that you have a more permissive license as a result.
Lazarus
At any rate: "In no case does copyright protection for an original work of authorship extend to any idea, procedure, process, system, method of operation, concept, principle, or discovery, regardless of the form in which it is described, explained, illustrated, or embodied in such work."
Kenji Kina
Sometimes the database are written in such a way to prevent you from understanding them.. I once encountered a Db that had all numeric table names and all numeric field names. Designed to make it hard to tell what data was related to what. If that's the case, then I'd say your cactus. It would be unlikely that you'd be able to replicate this query on your own. If on the other hand the field names are clearly laid out I'd say make your own query. Experiment. Spend a day if you have to. It would likely be cheaper for your boss if you at least attempted to replicate.
baash05
+126  A: 

He charges $500 to change 2009 to 2010? Oh man what a rip.

This year pay him his $500 and tell him you want the query to take the school year as a parameter. See how he reacts to knowing this will be his last time working for you.

Neil N
This is by far the easiest way to go (I had it typed up but you beat me to it).
Austin Salonen
This is probably the safest approach.
Tom Ritter
I can save you $400 over this answer. Just tell the guy, "Look, this situation is ridiculous. I'll buy this code off you for $100. Or I can reimplement it myself in a couple hours. Your choice."
Jason Orendorff
Ehh.. ethics, who need 'em..
Ryan Emerle
Unfortunately, he'll quote a different (higher) price to parameterise it. Your best bet is to get someone in to rebuild the query (and if you happen to leave his current query lying around while they do so, so what? If it's a hellishly complex query - which I doubt - it can be re-written so it does not look like the original, if it's a simple query, once the new one looks different he can't prove IP). My two cents.
Binary Worrier
+1 ...and then sue him if he doesn't implement it the right way!
Groo
his copyright comment suggests that you cannot even run the sql without his permission... -i agree though, what a con.
Matt Joslin
@Binary Worrier: he should find someone else ready to parameterize it for less than $500, and either threaten to give the work to that guy, or even better, stop working with the unethical hack and move on. It's parameterized, so it will be new code, which should even help prevent the problem of reverse engineering/copyright.
Mathias
the best solution is definitely to hire an ETHICAL programmer to write it the correct way. Perhaps with a clean front end to let a person who's not a programmer input the new year and hit a button...
Paul
+53  A: 

First, the standard disclaimer: I'm not an attorney, so don't take anything I say as legal advice.

Edit: what I'm saying below is about the law in the United States -- in other countries it is likely to vary, though thanks to the Berne Convention, copyright law is fairly uniform across many countries.

Copyright can cover creative, written works, and I'd say a SQL query can/does fall within that range.

At the same time, unless his contract with the school is written quite strangely, he wrote this for them as a work for hire. In that case, his claim of copyright is probably an outright falsehood -- when a work is written for hire, the hirer, not the author, owns the copyright.

Edit: There seems to be some controversy about what constitutes a work made for hire. According to US law (17 USC, §101):

 A “work made for hire” is—

  (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, as a part of a motion picture or other audiovisual work,
  as a translation, as a supplementary work, as a compilation, as an
  instructional text, as a test, as answer material for a test, or as 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.

Since this query seems to fall within the scope of '(1)', it can qualify as a work made for hire, even without an express agreement to that effect. The possible exception would be if his contract was written so it excluded writing the query from falling within the scope of his employment.

Edit2: The only part that's really open to question is whether he qualifies as an employee or not. In the case of a consultant, that can be a difficult question to answer. Basically, if he work's completely independently, and just delivers a final result then he's probably not. If he works about like a normal employee, and they have control over things like his schedule and such, then there's a pretty good chance that he would qualify as just a temporary employee.

Jerry Coffin
@Jerry It is the other way around. If nothing was specified, then it is **not** work-for-hire. Work for hire has to be specifically detailed to be valid.
Doug Neiner
This is the crux of the OP's question; whether the contract makes this a work for hire.
Adam Lassek
I'm sorry, but not all of us are in the USA, not all of us understand that mambo-jambo of law text... can you explain what were you actually saying?
elcuco
@eluco: I can try. It says what an employee writes as part of their job automatically belongs to their employer. If they're not an employee, it might, but only if they specifically agree that it does, and then only if it falls within specific classes such as a compilation (e.g. an article for an encyclopedia), test materials such as a test or answer sheet for a test, etc.
Jerry Coffin
I think this answer explains it best. I work as a consultant and the norm is that all materials belong to the hirer as they also specify what is to be created. Usually the consultant is not even granted to use it for other clients. If the SQL was part of a *product* I'd say the copyright is to stop you from distributing it but does not hinder you from modifying it. Usually an EULA covers its usage and a modification will void a support contract, but that does not seem to be in place. I'd recommend being nice to your customers. Note: I'm in Sweden.
epatel
Isn't this all a moot point when we don't have access to the original contract? What does the original contract state?
GregD
+3  A: 

[its not a legal advice]

You pay that guy for what? To generate you a report, or to write code to generate that report? In my opinion, as I'm not a lawyer:

  • If you pay him for a computer program, that belongs to you. (as dcneiner commented, just if it was in the contract)
  • If you pay him for use his program, that belongs to him.

[/its not a legal advice]

Rubens Farias
@Ruben: Apologies, but in this context, it's "advice" not "advise". Advise is a verb, advice is a noun.
Binary Worrier
"If you pay him for a computer program, that belongs to you." Only if it was in the contract sadly. This is poor advice in general. Don't take something for granted unless it is in a contract.
Doug Neiner
+33  A: 

Per US copyright law, section 102, paragraph b:

In no case does copyright protection for an original work of authorship extend to any idea, procedure, process, system, method of operation, concept, principle, or discovery, regardless of the form in which it is described, explained, illustrated, or embodied in such work.

Here's the original.

DISCLAIMER: me != lawyer

Just a thought: you may find it cheaper to have a lawyer review this, than to pay $500/yr for updates..

Ryan Emerle
That's correct, he can't claim copyright over the process itself but he can claim copyright of the specific 'code' written by him to execute that process. If you try to read that as a disabling statement for this issue then no software would be copyrightable.
Lazarus
@Lazarus, he's claiming protection against the unauthorized *execution* of the the code.. Again, not a lawyer :)
Ryan Emerle
Careful with the jargon Ryan, some non-programmer types may consider != to mean "Extra equal".
Jrud
@Ryan, not a lawyer either and that's a damn good point but if the code was accepted with this clause in it then I'd say that they'd pretty much hogtied themselves.
Lazarus
@Ryan - I think you meant "than" not "then" in the last sentence, it makes the meaning a lot different...
NVRAM
@NVRAM hah! thanks!
Ryan Emerle
Section 102, paragraph B does not apply to SQL. It applies to things like patents. "Processes", "procedures" and "systems" in this case should not be understood in the way that they would normally be meant in the domain of computer programming. Rather, that indication of ineligibility is for stuff that would normally be covered by a patent. In other words, it defines the jurisdiction of copyright vs patent protection. As explained in my answer, SQL **is** copyrightable. And of course, IANAL; this is not legal advice.
Bob Aman
@Bob, that may be so, but the author is claiming protection from the _execution_ of his SQL. I dunno.. just taking stabs in the dark as I'm just a lowly developer.
Ryan Emerle
+7  A: 

I think you'll need to look not at the code but at the contract under which the individual wrote the code. Normally in any kind of programming activity there is a clear indication of the ownership of the source code/object code for the project.

If that wasn't in the original contract then I'd make sure it was in this one.

Lazarus
+49  A: 

Find someone who has never seen the extorter's code to inspect the table structure and derive an equivalent query in a cleanroom fashion.

pmf
Somewhat libellous, the use of the derogative 'extorter', however apparently accurate it may be but sound :)
Lazarus
It's not libel if it's accurate.
Breton
Best answer to be honest. ;)
Zack
@Breton, It is not accurate. Extortion is a specific crime, and not what is happening here.
tster
@Breton: truth is usually but not always a defense against libel.
Jimmy
"Somewhat libellous". Sorry, how does libel come into it considering the query writer is *completely* anonymous? I find the strong comments very interesting. Seems to have hit a raw nerve.
Ash
+4  A: 

My first question would be "What did the contract you had with the developer say when you paid him last year?" Or, I'd go talk to the attorney for the school system. And take the contract from last year if there is one.

Rich H
+50  A: 

Yes, SQL queries CAN be protected by copyright.

The question you really need to be asking is - does he actually own the copyright, or is he just saying he does. This would depend on the terms of the contract under which the query was written.

Edit: I want to modify my answer - you can do what you wish with it (I am not a lawyer!), as long as there is no strange contract involved.

Case 1: He sold you the .sql file as a "program" - the .sql file itself is the program, and you can modify it however you want - same with if you buy any application you can open it with a hex editor and change bits around. There is no EULA prohibiting this.

Case 2: He sold you the .sql file as source code - he sold you the source meaning the source was what you bought from him and again you can modify it as you're just modifying what you bought.

People are getting too caught up in the fact that you can "view the source" of a .sql file - it's either a program or it's a source file depending on the contract, and either way you can modify it. Copyright protects people from unauthorized distribution, not modification for internal use.

BarrettJ
Depends what country you are in
PeteT
+5  A: 

Spend the $500 on a solicitor's letter

My 2 pennies is at most he can ask you leave his name in if you reuse his code (which is quite common, no?

gbn
This is common in open source code. If he is charged 500$/yr I doubt that this people consider their code as open source.
j.a.estevan
Open Source (as defined by the OSI) has to be specified by the choice of license. I didn't see a license. Therefore, anybody who has the code legitimately is legally free to use it, but not to create a derivative work. Changing the year may well constitute creating a derivative work; consult a lawyer specializing in software copyright rather than a bunch of developers.
David Thornley
+7  A: 

The fact that it is a SQL query is a red herring. It is source code and intellectual property just like if it was compiled into an executable. As others have already said, any limitations on your use of the software depends mostly on the terms of your agreement.

I will observe that his comment says:

// This code MAY NOT BE USED without the expressed written consent of

Which says nothing of modifying it, plus if you modify it then you could also argue that you aren't using his code.

JohnFx
A modified version would be considered a derivative work of the original script depending on how much alteration occurs. You would have to rewrite most of it to avoid the original copyright, in which case you may as well just rewrite the whole thing and be done with it.
Adam Lassek
+18  A: 

Find someone else to rewrite the query for you (or do it yourself) and never use his code again.

You don't have to use his code.

Matt Joslin
I agree. Don't pay this guy another penny. Period.
BBlake
Not another penny..
baash05
+195  A: 

If I were you, I would write a full description of what the query needs to do, including all the tables, fieldnames etc., and post that here. Someone here is bound to be able to write a new version of the query that is not copyright your developer, and you can edit it each year to your hearts content.

rjmunro
Best answer! [15 chars]
eyelidlessness
Can SQL code really qualify for a copyright anyway?
David Brunelle
I concur with this answer. I'll volunteer some time to helping write it if need be.
NateDSaint
A good idea. If he properly explains the situation in the question, then it probably won't be closed. And since stackoverflowers do not know the original code, this doesn't qualify as copyright infringement.
luiscubal
@David: Depends hard on the complexity, I'd guess. A complex/big query could be considered as a script/program in my opinion.
Bobby
@David: SQL query is a text. It therefore can be protected by copyright just as any other text. How is it different from a novel or a C++ code snippet?
sharptooth
Of course, thn there's the problem of the code written automatically released under CC-Wiki, unless whever waives that...
RCIX
@David I love how you just ask the original question again but in a different way
Lumpy
@David, see here for your answer: http://stackoverflow.com/questions/1840847/can-someone-copyright-an-sql-query
PaulG
@PaulG, what a lovely recursive answer
Irwin M. Fletcher
That is absolutely the wrong way to approach copyright! By looking at the implementation of the old query to come up with your own, you are STEALING the intellectual property (legally speaking) - so this is no better than just using someone else's code. Instead, for cases like this, rewrite the query by only analyzing what its inputs and outputs are, treating it like a black box.
Alex
@sharptooth and @PaulG: many copyright implementations require something to be substantial enough to copyright. One could argue that a single SQL query doesn't quite pass that test.
wds
@Alex, nobody said to look at the old query's implementation! In fact, everyone's specifically avoided saying that! You been smoking something? All that was requested was the database definition an explanation of what the query needs to do.
Ross Anderson
+9  A: 

Write your own version of the "application" from scratch. How hard can it be?

MatthewMartin
A: 

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. "

Mark Schultheiss
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
+2  A: 

I'm not a lawyer either but...

I would guess that you've already got permission to USE the query as you paid him for the use of it.

// 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].

the verbiage doesn't say anything about "altering" it though... :)

luckykind
That declaration helps control distribution of the product, so if it is a eureka query, he/she can still sell it.
Russell
That is my understanding too. You already paid him, so the code is yours to use and modify as you see fit. Just don't give the code to anyone or sell it to anyone.
Kenny Drobnack
In order to alter a file, you need to copy it.
Stephen C
Altering a copied file would not affect the original. I was suggesting that altering the original should be OK, since they paid for it... which means there's no copying, just altering.
luckykind
A: 

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.

Phil
You mean the contract for "future" work, right? You can't back-modify an existing contract, so this would have no effect.
Lasse V. Karlsen
Yes, that's what I meant. Obviously it would help if current contract had something like that already.
Phil
A: 

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 :)

Remus Rusanu
+14  A: 

I'd love to do work for your school district. Apparently your contractors can stick whatever conditions they like into their comments and your first impulse will be to honor them rather than looking up the contract and determining what the actual conditions are.

Robert Rossney
A: 

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.

ammoQ
+4  A: 

You never said where you were, so any advice we could give you is useless. There are different laws in different jurisdictions.

If you're in the US, call your local Bar Association, ask for a referral to somebody who works with software copyrights, and trust what that person tells you, not anything you read on SO. If you're in another country, find out the equivalent.

Speaking as a US citizen who is not a lawyer of any sort, there's a few things to consider.

You never told us how complicated the query was. It's impossible to copyright the only reasonable implementation of something. If it's straightforward, just rewrite it in a straightforward manner. If it's complicated, the query is probably not strictly functional, and there is doubtless some creativity in it. In that case, you should rewrite it in a different manner, or hire somebody.

You should be able to find somebody who'll rewrite the query cheaper than continuing to pay $500/year, and it shouldn't be hard to find somebody more ethical than the original developer.

David Thornley
+2  A: 

One of your many options here is to create a black box replacement. This sounds like a well-understood problem for which you can write a short requirements document. I would recommend that you include the option to parameterize variable options such as the year in question (!).

More importantly, I would recommend that you make SQL Injection and similar attacks impossible in your replacement code. To my mind, if someone has created a cash cow like this, they are focused entirely on milking you for the money and not so much on producing the quality one-time solution that you really need.

Given your requirements document, your recommendation that you have a quality database management system so that you don't get 'hacked', you should be in a solid position to write a functional replacement.

Bob Cross
+8  A: 

Checkout Aharonian v. Gonzales.

Basically, you cannot copy the source code of an application, but you can create an application that is functionally similar so long as that does not infringe the copyright of the source code itself.

In essence, you can recreate the SQL queries, but you can't copy them directly.

Still, talk to a lawyer about it if you have additional concerns.

blesh
I am pretty sure that, sometimes, there's only one way to write a query, so he can claim you copied him in any case. The case, however, is bs.
Stefano Borini
+2  A: 

It depends on the contract between the school district and the person who did the work. If its a Work for Hire contract (probably the most common), then the contractee (school) owns the work.

DSO
A: 

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.

brad
A: 

I'm waiting to see a comment like:

That sounds just like this sweet deal I've got - I hired some offshore guys to write a bunch of SQL Anywhere scripts that run from batch files to automate the simplest things. We have about 50 of them all over various school systems and small businesses, and have just hobbled each query so that they have to bring me back periodically to fix them.

I make like $30k a year doing that. It's awesome, and none of the suckers.. er... customers.. ever figure it out.

Wait, which school system do you work for?! Dude, that's such a copyright violation! I just writtend to my lawyers! You're going to hear from them soon (they're in Bangalore, so it might take a bit to get to the right time zone).

JayCrossler
I'm currently one of the poor souls trying to improve things for the education system. They have a really bad way of using MIS resources they have a couple of guys at each college/school not collaborating even though they use the same underlying student management system. Work is duplicated badly and getting coherent data to compare schools/colleges is next to impossible. If they used an overall approach they would save money and improve accuracy.
PeteT
+4  A: 

This is a board filled with Software Engineers who know a lot about coding and little about legal issues. It is better you consult a lawyer rather than risk receiving bad advice here.

Phil
A: 

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.

kem
A: 

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.

Lucifer
+19  A: 

Actually I am a bit surprised at some of the attitudes to this question. The programmer was initially brought in as no one else could solve the problem. The solution may or may not have been easy but no one else could do it and he could and did.

He then gets called back in every year to do maintenance. While the changing the year is not exactly rocket science and maybe someone else would have suggested parameters he was not asked to (I assume). Did someone for argument's sake write a specification for the programer which he didn't adhere to? Or did someone say to him 'just fix it. How much? $500? Cool, hurry up. Oh and come back next year and maintain it please"?

Much of the wrath here seems to be around the simplicity of the problem he solved, but surely that is not the point? He solved the actual problem, ensured it all ran each year and got an agreed recompense. My maths is awful, but I suspect there are people who can write applications to do fast Fourier transforms without breaking into a sweat. But because they find it easy should they charge little or no money for "solving the problem".

The point about the copyright. Well, many of the post here started with "I AM NOT A LAWYER". No, and neither I suspect was the original programmer. He (hamfistedly) tried to protect himself and I agree with others that it is either not worth the paper it is written on or that all that is needed is to rewrite ot without looking at or using the code, or some of the other suggestions here. Not hammering some guy for earning living.

OK so mark me down now for dissenting.

PurplePilot
He may have been worth the initial payment. That's not the issue here. That he continues to collect $500 a year for changing one number suggests to me that he's not adhering to any code of ethics I'm familiar with.
David Thornley
But if he changes two numbers, or three numbers, or four numbers or x numbers..... would that be ok? Is it the actual thing he does or is it just the quantity?
PurplePilot
He's a lazy programmer who doesn't have the time or motivation to make the code better. If the school system wants to pay it, then so be it... it's like a maintenance contract.
0A0D
I don't see a problem with him charging $500, $1000 or a million dollars to change a parameter. If the school wants to pay him, then so be it, and good on him for making the cash. I do however see a problem with the copyrighting of a query. I mean wtf.
Dominic Bou-Samra
I agree Dominic, but it is like MS and all the other that patent pressing key on the keyboard, or adding a hyperlink etc. Just trying it on and i hope his bluff is called and broken.
PurplePilot
It seems like if he would have just compiled his code into an executable that he would re-compile with new data every year, no one would have noticed, and no one would have complained. He found a nitch market and sold a product for a good price. All you haters are just being jealous.
thepaulpage
If the developer explained that to the customer at the outset that they were effectively required to pay a yearly maintenance for him to solve their problem, then that would be different. I doubt either party agreed to residuals for the original work and thus this amounts to extortion.
Thomas
A: 

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?

j.a.estevan
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.
David Thornley
A: 

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.

Loadmaster
+3  A: 

You pay him for service not the code. The fact that he left you with source of his code does not allow you to use it. Even if that was single char he created it, he has not sold the copyright and he has not licensed you to use it.

If you want to save money delete his query and write your own from scratch or just let him know you are going to do just that and offer to buy his query for 500$. He'll probably go for it since it's going to be his last opportunity to get some of your money.

Kamil Szot
A: 

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.

René Nyffenegger
A: 

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.

Charles Eli Cheese
A: 

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!

fauxtrot
A: 

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

Paul
+11  A: 

Nobody seems to have picked up the fact that Copyright deals with copying. If the OP is neither copying nor distributing, Copyright really doesn't appear to apply in this instance.

i.e. the School may not publish or sell as their own work (perhaps) without permission. You'd want to consult your lawyer in those cases.

In any event, the OP has consent to run the program which runs some sql in a particular file. I assume the OP hasn't circumvented any anti-tampering controls put in place by the programmer.

The sql, which is part of the program (work for hire notwithstanding), is just text in a file. Now it may be the case that modifying any/all files related to the program without express consent of the programmer may void any warranties, but that's really about it.

And for $500, nobody's going to sue you. Do you know what lawyers cost? But don't be surprised if you void any support by the original programmer. Fair warning there.

When all is said and done, if all the guy does for $500 is take a 2 minute change that's a bit brash. But are you certain that's all he's doing? $500 for a 1/2 days work at a normal consulting charge out rate isn't unrealistic.

Robert Paulson
If the school wants to pay it and make him richer, then so be it. He's just a capitalizing programmer. I used to charge $20 to change anything on a webpage I designed for a customer after the website was published. They paid it because I designed it, knew the site, and it's more expensive to have someone else go in and do it when they don't have the knowledge.
0A0D
Copyright deals with a lot more then copying...
Goran
@Goran, fundamentally copyright is about the limited monopoly granted to an author of a work to control copying and distribution.
Robert Paulson
@Robert: Copyright is about whatever copyright law says it is (theoretically limited by the US Constitution in the USA). The limited monopoly includes the right to create derivative works.
David Thornley
@David, That goes without saying, it's also entirely dependent where you live and work. My point was to understand the spirit of what copyright is for, and that modifying something you own is not a copyright violation. It may be a violation of the contract, or of the warranty, but what they're proposing doesn't appear to be a violation of copyright.
Robert Paulson
I buy a copy of the newspaper, I'm perfectly free to blot out any articles I don't agree with. It's my copy of the paper. Copyright would stop me selling that copy, but that's a different matter. That said, having coughed up the first time they may have tacitly accepted that whatever permissions/license they have don't cover amending the code themselves.
Gary
No. This really isn't that hard. Copyright won't stop you reselling your damaged paper (right of first sale doctrine) even in an edited form. If you however were to 1) sell an edited form pretending it wasn't edited, or 2) 'copy' some/all of the articles and sell it as your paper, then you'll be violating copyright principles. I've already indicated in my answer that modifying the code will likely void any warranties, and that's fair enough. The warranty of my car doesn't cover my modifications to the car, even though it's mine as this was a condition I accepted on the sale of the car.
Robert Paulson
+6  A: 

Define a new view using the original query as a base without specifying the date parameter e.g.

create or replace view MY_VIEW as
 select STUDENT_NAME, STUDENT_NO, CLASS_YEAR
   from STUDENT_TABLE
  where STUDENT_CLASS = 10

Write a new query to select from the view applying the date parameter e.g.

set DATE_PARM = '2009';
select STUDENT_NAME, STUDENT_NO, CLASS_YEAR
  from MY_VIEW
 where CLASS_YEAR = %DATE_PARM
crowne
hahaa. Excellent!
Nailer
+4  A: 

What were the terms of the contract between the school and the contractor?

(I don't hold out much hope...but I know that anything I write for my employer is contractually bound to them owning the copyright)

I hope you find it reassuring the amount of outraged posts you have had on this question about this snake oil pedlar (I know I do)

James B
A: 

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

Joubert Nel
A: 

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.

Even Mien
+2  A: 

Why not just call the guy and ask him what's up? It's probably boiler-plate comments in his code and he probably doesn't give a toss. If he does care at all, it's probably more to do with releasing his code rather than using it. Also, if he's that concerned over $500, then he doesn't have enough money to hire a lawyer anyway. Lastly he would have to prove that you used his code - how's he going to do that?

@PurplePilot PurplePilot makes a good point. If I haven't heard from a client in a year, chances are it'll take me 30 minutes just to pull up my old notes, passwords, etc and refresh my memory as far as what is going on. Then, assuming the single-click button still worked, I would probably at least want to do some spot checking. Then you have to send it off to the person (who knows if it is even the same person this year - you might have to explain to them what to do with the file). Then you have to generate an invoice if you plan on getting paid.

Basically if you consult for a living you don't get paid for 8 hours a day. But when somebody calls you once a year, it takes an hour or two just for administrative stuff.

Jake
A: 

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.

Lasse V. Karlsen
A: 

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...

runrig
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
@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
A: 

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.

Bob Aman
+1  A: 

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).

MikeD
A: 

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.

Matthew
+1  A: 

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.

Rimian
+4  A: 

First, stop this disclaimer nonsense. You're not a lawyer even when you say "I'm a lawyer, seriously" anyway. I know this because I'm son of the king of Nigeria. Anyone who takes legal advice from a forum is doomed.

1) The code is copyrighted. If there are no contracts/agreements stating the otherwise, copyright belongs to the person who produced the code.

2) Charging $500 every year for changing year variable is outrageous but not unethical. That's how capitalism works. However modifying a code till you invalidate its owner's rights is certainly unethical.

What you need to do is to hire someone (or the same guy, whoever's cheapest), to write a query that works every year. That's the RIGHT and ETHICAL way of getting away from $500 every year. Don't forget to set your terms right this time (who owns copyright etc).

ssg
@ssg - "Charging $500 every year for changing year variable is outrageous but not unethical." IMO, it is outrageous **and** unethical. It is just not illegal.
Stephen C
@ssg - Oh yea, and trying to claim IP rights on some SQL query that you wrote for hire is also unethical ... unless you negotiate that with the customer upfront.
Stephen C
@Stephen: No. "Expensive" isn't "unethical". It's just free market economy. The school didn't have to give the job to that guy. It CHOSE to do so. They could always look for alternatives and choose the cheaper offer. "Trying to claim IP rights for work for hire" is simply not true. How do you know that without seeing any contract or an agreement? If school did not sign any contract that transfers the rights (which the question implies), copyright belongs to the owner of the code and there is nothing unethical about that.
ssg
@ssg: Taking advantage (charging higher than market prices) of a consumer (the school) that is simply ignorant *is* unethical.
Mark Brackett
@Mark: What you say is the foundation of capitalism (charging more than the actual perceived value, hence making profit). There is no such ethical notion that mandates the seller to assess the buyer's knowledge on market conditions before making an offer. People always fall into this when they buy from X store instead of Y store -which is cheaper- willingly. So I find this kind of criticism towards that guy's behavior because his name wasn't "Best Buy" simply hypocritical.
ssg
+1  A: 

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.

Craig Young
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.
David Thornley
A: 

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.

Stephen C
+1  A: 

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.

GregD
A: 

ADD: AND WHERE 1=1.

New query, problem solved.

Eric Kerr
A: 

Since we are all NOT lawyers here, I thought it would be interesting to point out that this post made its way to Techdirt which does have quite a large legal following, especially in the copyright field. Curious to see what they have to say about it?

Can You Copyright An SQL Query?

jaywon
Which, at the time I'm writing this, is nothing noticeably better than what SO has.
David Thornley
A: 

I would dig through all of the agreements. You never know, he may have only been paid $500 the first year with the understanding he would be under some type of annual fee. This saved the school system a lot of money up front.

What if the data structure of your applicaton changes? He may have to put days into rewriting the query and only get $500.

Maybe the school system didn't want some open-ended hourly fee year after year and just decided that $500 was a flat fee.

Jeff O
A: 

What a remarkable load of bollocks.

My advice is to change the SQL, run the query, and wait for the guy to take legal action. Opt for a court hearing and live-blog the results to this thread. Sounds like it would be entertaining, on the one side an exploitive contractor and on the other a milquetoast manager too timid to let you just get on with business. I'm interested to see how the contractor twigs to the scheme and then subpoenas your codebase to determine how you managed to do a year-end without him.

Because of course, (C) is all-powerful don't you know. And you're not allowed to say it isn't because I bracketed a C and I say so.

A: 

The interesting question to me is this: "Can you copyright a work which couldn't be anything other than what it is?"

If I say to you, "write me a song about marmosets," it's basically guaranteed by the properties of language and music that you will write a unique song, which has never been written before. It may not be super-original (or good), but if we hear someone playing your song, we'll know beyond reasonable doubt that they got it from you.

On the other hand, if I say "write me a SQL query which gets the following information from a database structured like this," there is basically a "correct" way to write it (although of course there can be some variation). The odds are good that someone else, working completely independently, would write the exact same query.

Therefore: how would you prove that your copyright had been violated?

Of course, I Am Not A Lawyer.

Nathan Long
+2  A: 

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.

samalex
A: 

Post the guy's name so we all know that he is a tool. Needless to say this is not legal advice but if you contracted the guy anything he's done might be "work for hire" and thus is owned by you. I would find it very unlikely that he will even attempt to start legal action.

Igor Zevaka
A: 

$ 500 for a parameter change?! If you are familiar with a SQL you should reimplement it or if you are not familiar with SQL you should hire the guy once more and ask him to make a documentation. After it you can use an ETL tool and build the export yourself. You might want to try SSIS. It's the perfect use case for it.

Rene Schulte
A: 

You should instead consider learning the important aspects of that query and implement your own version which you can copyright too. If you can't do so, you are better off buying one.

Sarfraz
+2  A: 

I'm not a lawyer, yadda, yadda, yadda...

This is from www.copyright.gov:

"Copyright protection is not available for ideas, program logic, algorithms, systems, methods, concepts, or layouts."

If you extract the SQL code from his .bat file, it would most likely fall under the category of "program logic". He might be able to argue that his simple .bat file is a "program", but he'll most likely lose that argument if it comes down to it.

Also (and more importantly), you have to actually file with the government to obtain a copyright on a computer program. I highly doubt that he has done that every year (any change to the program would require a new application and non-refundable fee).

Finally, if this guy is hurting so much for his $500 a year then I doubt that he has the money to spend on a lawyer to litigate this. Do it yourself and if he actually finds out AND raises a stink (I doubt he will) then let him rant and rave. Don't explain yourself, don't get into an argument. Just say that you're not interested in what he has to say and "have a nice day". He'll most likely go away in a huff never to be heard from again.

Again, this is not legal advice, I'm not a lawyer, I've never played one on TV.

Tom H.
A: 

Have a developer turn on SQL Profiler while this guy runs his query (assuming you are using SQL Server). Capture the query and use it as your own.

Just because you throw up a comment on your query (which may not get passed to SQL) that claims a copyright doesn't mean it is. If you own the database and the data in it then you have the authority to review every query that goes to it. Remember, aside from everyone else not being a lawyer, we're assuming that you are also not a lawyer and you can easily play dumb on this one. I would let location be 9/10's of the law, capture the query and if this guy wants to sue, tell him to make your day.

The other key element here is that there is no intent to redistribute this guy's code. You are making a derivative work for your own internal use.

Thomas
+1  A: 

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

Steve Syfuhs
A: 

just explain your table and field structure and problem , if it is just matter of query , many of people here are smart and generous enough to do it for free...

iamgopal
A: 

A lot of answers already, but just to add my experience: copyright does not matter at all when you're talking less than $1,000,000. What is he going to do, file a copyright suit? What do you think that would cost? How is he going to prove you infringed? Which jury is going to vote against a school district?

The real question you should ask yourself is: would we like to be friends with this guy for $500 dollar a year? If you're happy with his query, $500 a year is really not such a bad deal.

Andomar
A: 

I remember reading a book on negotiation. The author paints a scenario where a group rents a hall annually for their meeting. The coordinator sends invitations and the owners of the hall decide to raise the rent exorbitantly. The author suggests that you explain to the owner of the hall that they can A: raise the rent as they ask and lose future business OR B: bring the rent back down to a reasonable rate and keep their business.

The programmer thinks they have some leash on your company and to some degree he/she has reason to. Your company has been paying him/her. Explain that the programmer can fix the problem with a parameterized query 'for free' or eternally lose your company's business. Your company has some leverage, use it.

Chris