November 10, 2005 at 7:38 am
SQL server uses some internal function to make sure object names are unique; ie if you create a foreign key without a name, it makes an object name like this: FK__GMAACCP__ACCOMPR__3553B50D; obviously, there is a function that returns a random number like 3553B50D to be used to make object names unique.
my question? what is the name of that function? if i know the name, i assume i can use it for my own evil plans for taking over the world and whatnot.
Lowell
November 10, 2005 at 7:52 am
Have no clue. Why do you want to know? If you need a ready-baked randomfunction, why not NEWID() ..?
/Kenneth
November 10, 2005 at 8:13 am
actually, I was sitting around playing with a schema generator program, and because i had too much time on my hands, I wondered if whatever SQL uses was exposed or not; there's plenty of random functions out there that I could use of course: here's a 'duplication' of what i figure SQL server is doing: thisd is using a contribution from this site: http://www.sqlservercentral.com/scripts/contributions/1474.asp
select right(
dbo.ufn_vbintohexstr((RAND () * 100000) ),6)
returns :
9954C1
E0B252
6550AC
Lowell
November 10, 2005 at 8:26 am
Yes, looks like it. The suffix generated looks just like a random number in hex.
Never given a second thought if there was any special function that did that.
/Kenneth
November 10, 2005 at 10:30 pm
SELECT NEWID()
Use substring to get a piece if you want.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply