开发者

How are these primary keys being generated?

Can anyone give me some insight into how these primary keys are being generate I believe it's a combination of iterating integers, date and static char.

Heres a brief list:

D00009BFAA193275,
D00009C91855F146,
D00009CB07BE6324,
D00009D025B98577,
D00009DE345BA663,
D00019BC04F4D986,
D00019BFAFD46307,
D00019CE505D0440,
D00019E0BDD76923,
D00029BC0BECF381,
D00029BC0CB7A348,
D00029BC7DBEF433,
D00029CC49C31844,
D00029CE2254B377,
D00039BC03587530,
D00039BC062A8615,
D00039BC0C46E141,
D00039BF9D730237,
D00039BFA2F88765,
D00039BFAA40E841,
D00039D08CF92343,
D00039DD0968C108,
D00039E078E6B550,
D00049C7EE3CA721,
D00049D555313194,
D00049E15E300465,
D00059BC023FF739,
D00059BC054D8243,
D00059BC0ACA6533,
D00059BFA05CB726,
D00059BFA7B28215,
D00059C871860216,
D00059CAE73E4895,
D00059E0C2FF8179,
D00059E219CE7129,
D00069BC788D6181,
D00069BFA84E5322,
D00069C223670823,
D00069D1DF229381,
D00069D4E7C08648,
D00069DF10A4E674,
D00079BC0122D372,
D00079BC068F4995,
D00079BC7F66B951,

I'm trying to reverse engineer some appletes to do inserts and I want to maintain consistency.

I profiled the following T-SQL

    enter code here

01
declare @p1 int
02
set @p1=-1
03
declare @p5 int
04
set @p5=20484
05
declare @p6 int
06
set @p6=8196
07
exec sp_cursorprepare @p1 output,NULL,N'SELECT * FROM lntmuser.dbchk WHERE 0 = 1',1,@p5 output,@p6 output
08
select @p1, @p5, @p6
09
GO
10

11
declare @p1 int
12
set @p1=1073741881
13
declare @p5 int
14
set @p5=20484
15
declare @p6 int
16
set @p6=8196
17
exec sp_cursorprepare @p1 output,NULL,N'SELECT "sysid","chksum","m_date","m_time","k_id","k_type","atty","atty1","indx","flags","rec_date","rec_time","timeline","archive"
18
FROM lntmuser.dbchk WHERE 0 = 1',1,@p5 output,@p6 output
19
select @p1, @p5, @p6
20
GO
21

22
declare @p1 int
23
set @p1=-1
24
declare @p20 varchar(100)
25
set @p20 = 'A950A9CB53F2A512'
26
exec sp_prepexec @p1 output,N'@P1 int,@P2 int,@P3 int,@P4 int,@P5 varchar(50),@P6 varchar(120),@P7 varchar(4),@P8 varchar(100),@P9 varchar(30),@P10 varchar(100),@P11 varchar(30),@P12 varchar(255),@P13 varchar(1),@P1开发者_开发技巧4 varchar(24),@P15 varchar(1),@P16 varchar(1),@P17 varchar(1),@P18 varchar(1),@P19 varchar(1),@P20 varchar(1),@P21 varchar(1),@P22 varchar(1),@P23 varchar(30),@P24 varchar(100),@P25 varchar(100),@P26 varchar(100),@P27 varchar(100),@P28 varchar(100),@P29 varchar(100),@P30 varchar(100),@P31 varchar(100),@P32 varchar(1),@P33 varchar(128),@P34 varchar(50),@P35 varchar(16),@P36 varchar(10),@P37 int,@P38 int,@P39 int,@P40 int,@P41 int,@P42 varchar(20),@P43 varchar(1),@P44 varchar(1),@P45 int,@P46 int,@P47 varchar(16),@P48 varchar(16),@P49 varchar(16),@P50 varchar(16),@P51 varchar(1),@P52 varchar(1),@P53 varchar(1),@P54 varchar(16),@P55 varchar(16),@P56 varchar(16),@P57 int,@P58 int,@P59 varchar(10),@P60 varchar(1),@P61 tinyint,@P62 tinyint,@P63 tinyint,@P64 tinyint,@P65 smallint,@P66 smallint,@P67 smallint,@P68 smallint,@P69 smallint,@P70 varchar(512),@P71 text',N'
27
INSERT INTO lntmuser.document ("date","time","endtime","duration","ccode","desc","staff","client","con_no","mat_ref","mat_no","filename","autoname","reminders","follow","done","notify","hide","trigger","private","billable","review","status","user1","user2","user3","user4","user5","user6","user7","user8","type","template","clip_fmt","sysid","created_by","c_date","c_time","m_date","m_time","archive","billdate","alert","alarm","alarm_min","firstdate","eve_id","tod_id","con_id","mat_id","source","conflict","dur_type","chainid","previd","nextid","out_date","out_time","out_by","out_status","ch_weekend","ch_holiday","ch_adjust","ch_alert","ch_mail","ch_units","ch_count","ch_level","ch_shift","astaff","memo")
28
VALUES (@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9,@P10,@P11,@P12,@P13,@P14,@P15,@P16,@P17,@P18,@P19,@P20,@P21,@P22,@P23,@P24,@P25,@P26,@P27,@P28,@P29,@P30,@P31,@P32,@P33,@P34,@P35,@P36,@P37,@P38,@P39,@P40,@P41,@P42,@P43,@P44,@P45,@P46,@P47,@P48,@P49,@P50,@P51,@P52,@P53,@P54,@P55,@P56,@P57,@P58,@P59,@P60,@P61,@P62,@P63,@P64,@P65,@P66,@P67,@P68,@P69,@P70,@P71)',0,0,0,0,'','','','','','','','','','','N','N','N','N','N','N','N','N','','','','','','','','','','','','',
29
'DA4829E85A36A323','EC',-1,0,0,0,0,'','','',0,0,'','','','','','','H','','','',0,0,'','',0,0,0,0,0,0,0,0,0,'',''
30
select @p1
31
GO
32

33
declare @p1 int
34
set @p1=-1
35
declare @p2 int
36
set @p2=0
37
declare @p5 int
38
set @p5=20484
39
declare @p6 int
40
set @p6=8196
41
declare @p7 int
42
set @p7=0
43
exec sp_cursorprepexec @p1 output,@p2 output,N'@P1 varchar(16)',N'SELECT "date","time","endtime","duration","ccode","desc","staff","client","con_no","mat_ref","mat_no","filename","autoname","reminders","follow","done","notify","hide","trigger","private","billable","review","status","user1","user2","user3","user4","user5","user6","user7","user8","type","template","clip_fmt","sysid","created_by","c_date","c_time","m_date","m_time","archive","billdate","alert","alarm","alarm_min","firstdate","eve_id","tod_id","con_id","mat_id","source","conflict","dur_type","chainid","previd","nextid","out_date","out_time","out_by","out_status","ch_weekend","ch_holiday","ch_adjust","ch_alert","ch_mail","ch_units","ch_count","ch_level","ch_shift","astaff","memo"
44
FROM lntmuser.document WHERE "sysid" = @P1 ',@p5 output,@p6 output,@p7 output,'DA4829E85A36A323'
45
select @p1, @p2, @p5, @p6, @p7
46
GO


It looks like a 16 digit UniqueIdentifier set by sql server (similiar to identity with integers, or autonumbering). Also, looks like Hex, so I'd be curious if they translate into anything comprehensible.


Profiling the TSQL code and trying to guess how its being generated probably isn't the way to go.

Instead you should grab a java disassembler and decompile the code look for what's inserting the records.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜