Question: I need to query Sql Server and get an ID that identifies the machine on which SQL Server is installed. An ID that works well also in some complex scenarios like failover clusters, or similar architectures.

I need this for license check, i bind my licence key to a ID, currently i am creting "my id" using a combination of database creation date and server name, anyway this is not very good, expecially because it is a Database ID, not a Server ID.

In the past I used to read the harddisk serial number with an extended stored procedure, but isn't it there (at least in sql server 2008) a simple way to get this id?

I don't want to use a CLR stored procedure.

Answer: 
> 
> et an ID that identifies the machine on which SQL Server is installed. An ID that works well 
>  also in some complex scenarios like failover clusters, or similar architectures.
> 
> 
> 

So waht do you want? Identify the MACHINE or identify the CLUSTER and handle enterprise senarios?

In general this is not poossible wthout extended stored procedures or CLR. Point. You rule out all approache, then there are none left. And the fact that you did read the hard disc number already implies that you are NOT prepared to handle larger installs. What do you read if there is no hard disc (as disc), but a LUN on a SAN? What do you do in case the hard disc is a hardware raid controller? the approach you took from the start was pretty much not working but you failed to see it because you dont deal with enterprise customers ;) Which also means you dont handle complex scenarios (clusters etc.) ;)

As gbn says, don't bother enterprise customers with childish copy protections, put a license agreement in place. In general enterprise software has few technical limitations to allow enterprises to provide good service without running through hoops to get anoether licensing key jsut for a lab install.
It's called a "licensing agreement"

I wouldn't want some app shutting down because it thinks it is running a different box.

If we have a DR fail over in a log shipping or mirroring setup, these are 2 seperate SQL server installs. And what kind of server runs a single hard disk anyway?

Other SO questions: <https://stackoverflow.com/search?q=software+licensing>