Can someone copyright a SQL query?

Sql

Sql Problem Overview


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.

Sql Solutions


Solution 1 - Sql

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.

Solution 2 - Sql

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.

Solution 3 - Sql

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

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.

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.

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.

Solution 4 - Sql

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.

Solution 5 - Sql

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

Solution 6 - Sql

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

Solution 7 - Sql

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.

Solution 8 - Sql

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.

Solution 9 - Sql

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.

Solution 10 - Sql

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.

Solution 11 - Sql

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.

Solution 12 - Sql

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.

Solution 13 - Sql

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

Solution 14 - Sql

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.

Solution 15 - Sql

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.

Solution 16 - Sql

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.

Solution 17 - Sql

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

Solution 18 - Sql

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?

Solution 19 - Sql

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.

Solution 20 - Sql

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.

Solution 21 - Sql

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.

Solution 22 - Sql

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)

Solution 23 - Sql

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

Solution 24 - Sql

[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]

Solution 25 - Sql

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.

Solution 26 - Sql

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.

Solution 27 - Sql

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.

Solution 28 - Sql

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

Solution 29 - Sql

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.

Solution 30 - Sql

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.

Solution 31 - Sql

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.

Solution 32 - Sql

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

Solution 33 - Sql

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.

Solution 34 - Sql

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.

Solution 35 - Sql

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

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

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

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

Solution 36 - Sql

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.

Solution 37 - Sql

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.

Solution 38 - Sql

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.

Solution 39 - Sql

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

Solution 40 - Sql

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.

Solution 41 - Sql

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

Solution 42 - Sql

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.

Solution 43 - Sql

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

Solution 44 - Sql

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

Solution 45 - Sql

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.

Solution 46 - Sql

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.

Solution 47 - Sql

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.

Solution 48 - Sql

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.

Solution 49 - Sql

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?

Solution 50 - Sql

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.

Solution 51 - Sql

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.

Solution 52 - Sql

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.

Solution 53 - Sql

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!

Solution 54 - Sql

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

Solution 55 - Sql

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

Solution 56 - Sql

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.

Solution 57 - Sql

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.

Solution 58 - Sql

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

Solution 59 - Sql

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.

Solution 60 - Sql

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.

Solution 61 - Sql

ADD: AND WHERE 1=1.

New query, problem solved.

Solution 62 - Sql

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?

Solution 63 - Sql

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.

Solution 64 - Sql

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.

Solution 65 - Sql

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.

Solution 66 - Sql

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.

Solution 67 - Sql

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

Solution 68 - Sql

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.

Solution 69 - Sql

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.

Solution 70 - Sql

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

Solution 71 - Sql

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.

Solution 72 - Sql

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSamutzView Question on Stackoverflow
Solution 1 - SqlrjmunroView Answer on Stackoverflow
Solution 2 - SqlNeil NView Answer on Stackoverflow
Solution 3 - SqlJerry CoffinView Answer on Stackoverflow
Solution 4 - SqlBarrettJView Answer on Stackoverflow
Solution 5 - SqlpmfView Answer on Stackoverflow
Solution 6 - SqlRyan EmerleView Answer on Stackoverflow
Solution 7 - SqlJustin NiessnerView Answer on Stackoverflow
Solution 8 - SqlMattView Answer on Stackoverflow
Solution 9 - SqlPurplePilotView Answer on Stackoverflow
Solution 10 - SqlDoug NeinerView Answer on Stackoverflow
Solution 11 - SqlRobert RossneyView Answer on Stackoverflow
Solution 12 - SqlRobert PaulsonView Answer on Stackoverflow
Solution 13 - SqlMatthewMartinView Answer on Stackoverflow
Solution 14 - SqlBen LeshView Answer on Stackoverflow
Solution 15 - SqlLazarusView Answer on Stackoverflow
Solution 16 - SqlJohnFxView Answer on Stackoverflow
Solution 17 - SqlcrowneView Answer on Stackoverflow
Solution 18 - SqlgbnView Answer on Stackoverflow
Solution 19 - SqlRich HView Answer on Stackoverflow
Solution 20 - SqlDavid ThornleyView Answer on Stackoverflow
Solution 21 - SqlPhilView Answer on Stackoverflow
Solution 22 - SqlJames BView Answer on Stackoverflow
Solution 23 - SqlSedat KapanogluView Answer on Stackoverflow
Solution 24 - SqlRubens FariasView Answer on Stackoverflow
Solution 25 - SqlKamil SzotView Answer on Stackoverflow
Solution 26 - Sqluser225135View Answer on Stackoverflow
Solution 27 - SqlTom HView Answer on Stackoverflow
Solution 28 - SqlluckykindView Answer on Stackoverflow
Solution 29 - SqlBob CrossView Answer on Stackoverflow
Solution 30 - SqlDSOView Answer on Stackoverflow
Solution 31 - SqlsamalexView Answer on Stackoverflow
Solution 32 - SqlMichael BrownView Answer on Stackoverflow
Solution 33 - SqlPhilView Answer on Stackoverflow
Solution 34 - SqlBob AmanView Answer on Stackoverflow
Solution 35 - SqlMikeDView Answer on Stackoverflow
Solution 36 - SqlRimianView Answer on Stackoverflow
Solution 37 - SqlDisillusionedView Answer on Stackoverflow
Solution 38 - SqlGregDView Answer on Stackoverflow
Solution 39 - SqlSteve SyfuhsView Answer on Stackoverflow
Solution 40 - SqlAlex KeySmithView Answer on Stackoverflow
Solution 41 - SqlLeon KatsnelsonView Answer on Stackoverflow
Solution 42 - SqlFrankRupertoView Answer on Stackoverflow
Solution 43 - SqlMark SchultheissView Answer on Stackoverflow
Solution 44 - SqlRemus RusanuView Answer on Stackoverflow
Solution 45 - SqlErich KitzmuellerView Answer on Stackoverflow
Solution 46 - SqlbradView Answer on Stackoverflow
Solution 47 - SqlkemView Answer on Stackoverflow
Solution 48 - SqlRobsView Answer on Stackoverflow
Solution 49 - Sqlj.a.estevanView Answer on Stackoverflow
Solution 50 - SqlDavid R TribbleView Answer on Stackoverflow
Solution 51 - SqlRené NyffeneggerView Answer on Stackoverflow
Solution 52 - SqlCharles Eli CheeseView Answer on Stackoverflow
Solution 53 - SqlTodd RichardsonView Answer on Stackoverflow
Solution 54 - SqlPaulView Answer on Stackoverflow
Solution 55 - SqlJoubert NelView Answer on Stackoverflow
Solution 56 - SqlEven MienView Answer on Stackoverflow
Solution 57 - SqlLasse V. KarlsenView Answer on Stackoverflow
Solution 58 - SqlrunrigView Answer on Stackoverflow
Solution 59 - SqlMatthewView Answer on Stackoverflow
Solution 60 - SqlStephen CView Answer on Stackoverflow
Solution 61 - SqlEric KerrView Answer on Stackoverflow
Solution 62 - SqljaywonView Answer on Stackoverflow
Solution 63 - SqlJeffOView Answer on Stackoverflow
Solution 64 - SqlthatbrentguyView Answer on Stackoverflow
Solution 65 - SqlNathan LongView Answer on Stackoverflow
Solution 66 - SqlIgor ZevakaView Answer on Stackoverflow
Solution 67 - SqlRene SchulteView Answer on Stackoverflow
Solution 68 - SqlSarfrazView Answer on Stackoverflow
Solution 69 - SqlThomasView Answer on Stackoverflow
Solution 70 - SqliamgopalView Answer on Stackoverflow
Solution 71 - SqlAndomarView Answer on Stackoverflow
Solution 72 - SqlChris HayesView Answer on Stackoverflow