I know the question is old, and some of the answers are quite old, but this question popped up at the top of my google search today, so I wanted to make sure the correct information was here for the next guy.
I also wanted to post this as a comment but lack the necessary 50 reputation.
There is no way to get your license information from the server that I have found after SQL 2000. And I've looked - hard.
You can find 'what should be licensed'* by running:
select @@version
The expected output is shown in Josean's answer. But note that is VERSION information not License information. It tells you what licenses you SHOULD have, and even that it does imperfectly. For example:
- If it returns Enterprise Edition and says it's using x cores - then you should have purchased x cores of Enterprise Edition licensing. These are not tied to the installation and the installation still works if you never bought a license - you just have an unlicensed version.
- There are two ways to license SQL - by the core, or with a server plus cal license - there is no way I have found to distinguish which a specific server is licensed with. There's meant to be a 'per seat' under properties supposedly, but I've never seen it.
- There is also software assurance which can change licensing requirements if you move up versions or have high Availability or Disaster Recovery in place.
- And then there's virtualisation, which nearly ever server is now. With SQL you can license a host server with enterprise and then whatever happens at the guest level is just smoke and mirrors.
Point is - licenses are maintained by your licensing vendor. Matching your licenses to the actual installations of SQL you have is your responsibility, not something that is in any way enforced by the software. It's technically quite possible to run a whole bunch of SQL instances without ever buying a license. It's also illegal and a nice way to set yourself up with a big bill.