Home All Groups Group Topic Archive Search About
Author
24 Aug 2006 3:55 PM
Jaco
Hi

We are developing a licensing application for our application that will
license against our database. I am looking for a identifier that will be
unique to every database on a SQL server.


Thanks,

Author
24 Aug 2006 4:05 PM
Tracy McKibben
Jaco wrote:
> Hi
>
> We are developing a licensing application for our application that will
> license against our database. I am looking for a identifier that will be
> unique to every database on a SQL server.
>
>
> Thanks,

If I understand you correctly, I believe NEWID() will give you what you
want...


--
Tracy McKibben
MCDBA
http://www.realsqlguy.com
Author
24 Aug 2006 4:21 PM
Jaco
Yes thanks that looks like something I can use.
Does a SQL database hold a unique id ike the one in NEWID() that will change
for instance if you change the database name or copy the database to a new
server?

Show quote
"Tracy McKibben" wrote:

> Jaco wrote:
> > Hi
> >
> > We are developing a licensing application for our application that will
> > license against our database. I am looking for a identifier that will be
> > unique to every database on a SQL server.
> >
> >
> > Thanks,
>
> If I understand you correctly, I believe NEWID() will give you what you
> want...
>
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>
Author
24 Aug 2006 4:25 PM
Aaron Bertrand [SQL Server MVP]
> Does a SQL database hold a unique id ike the one in NEWID() that will
> change
> for instance if you change the database name

The values won't change

> or copy the database to a new server?

You've made a copy of the data.  So, no, the data won't change, it's a copy.

A
Author
24 Aug 2006 5:12 PM
Tom Cooper
You could try something like

Select @@ServerName + '/' +
   Coalesce(Cast(ServerProperty('InstanceName') as varchar(20)),
'*Default*') + '/' +
   Db_Name()

which will change if you change the database name and/or copy it a different
instance or server.

Tom

Show quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:%23vBzfn5xGHA.4660@TK2MSFTNGP02.phx.gbl...
>> Does a SQL database hold a unique id ike the one in NEWID() that will
>> change
>> for instance if you change the database name
>
> The values won't change
>
>> or copy the database to a new server?
>
> You've made a copy of the data.  So, no, the data won't change, it's a
> copy.
>
> A
>

AddThis Social Bookmark Button