October 6, 2010 at 7:19 am
So I've got this database with a type of key I've never seen before. I don't even know what to call it, so I can't really search for it (though I have tried). It's a bigint and each key is unique across the database, but it's not a GUID and it's not a natural key. And it's not like typical auto-generated keys, with each table having 1, 2, 3, etc, because each key is unique. My question is, how do I duplicate this? Is there a function in SQL somewhere that I'm not aware of? I wonder if the software generating the data is doing this?
I posted this in the 2008 forum because that's what I'm working with.
Thanks in advance for any help.
Here's a sample:
Key TableName
1229096194025TableA
1229096194026TableA
1229096194027TableB
1229096194028TableC
1229096194029TableD
1229096194030TableE
1229096194031TableF
1229096194032TableG
1229096194041TableH
1229096194042TableA
October 6, 2010 at 7:31 am
kdbarrett (10/6/2010)
Is there a function in SQL somewhere that I'm not aware of? I wonder if the software generating the data is doing this?
Nope, and I believe it will be too 🙂
You'll probably find a master table that keeps track of the greatest value.
October 6, 2010 at 8:02 am
I would think that there is some function or method in your software that generates this.
Is this one column? With both the number and the table in it? Or two columns? I've seen this implemented as two columns before.
October 6, 2010 at 8:09 am
Thanks for your replies and yes, I'm thinking it is the software doing this.
The example came from a query I wrote to look at all the PKs in the database with the tablename next to the value. Just a bunch of simple selects/unions on the PKs with the tablename, all ordered by the PK. I suspected this odd key behavior but I wanted to actually see it.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply