修复identity 类型字段数据的跳跃
2006-09-17 23:13:26 来源:WEB开发网 闂傚倸鍊搁崐鎼佸磹閹间礁纾归柟闂寸绾惧綊鏌熼梻瀵割槮缁炬儳缍婇弻鐔兼⒒鐎靛壊妲紒鐐劤缂嶅﹪寮婚悢鍏尖拻閻庨潧澹婂Σ顔剧磼閻愵剙鍔ょ紓宥咃躬瀵鎮㈤崗灏栨嫽闁诲酣娼ф竟濠偽i鍓х<闁绘劦鍓欓崝銈囩磽瀹ュ拑韬€殿喖顭烽幃銏ゅ礂鐏忔牗瀚介梺璇查叄濞佳勭珶婵犲伣锝夘敊閸撗咃紲闂佺粯鍔﹂崜娆撳礉閵堝洨纾界€广儱鎷戦煬顒傗偓娈垮枛椤兘骞冮姀銈呯閻忓繑鐗楃€氫粙姊虹拠鏌ュ弰婵炰匠鍕彾濠电姴浼i敐澶樻晩闁告挆鍜冪床闂備胶绮崝锕傚礈濞嗘挸绀夐柕鍫濇川绾剧晫鈧箍鍎遍幏鎴︾叕椤掑倵鍋撳▓鍨灈妞ゎ厾鍏橀獮鍐閵堝懐顦ч柣蹇撶箲閻楁鈧矮绮欏铏规嫚閺屻儱寮板┑鐐板尃閸曨厾褰炬繝鐢靛Т娴硷綁鏁愭径妯绘櫓闂佸憡鎸嗛崪鍐簥闂傚倷鑳剁划顖炲礉閿曞倸绀堟繛鍡樻尭缁€澶愭煏閸繃宸濈痪鍓ф櫕閳ь剙绠嶉崕閬嶅箯閹达妇鍙曟い鎺戝€甸崑鎾斥枔閸喗鐏堝銈庡幘閸忔﹢鐛崘顔碱潊闁靛牆鎳愰ˇ褔鏌h箛鎾剁闁绘顨堥埀顒佺煯缁瑥顫忛搹瑙勫珰闁哄被鍎卞鏉库攽閻愭澘灏冮柛鏇ㄥ幘瑜扮偓绻濋悽闈浶㈠ù纭风秮閺佹劖寰勫Ο缁樻珦闂備礁鎲¢幐鍡涘椽閸愵亜绨ラ梻鍌氬€烽懗鍓佸垝椤栫偛绀夐柨鏇炲€哥粈鍫熺箾閸℃ɑ灏紒鈧径鎰厪闁割偅绻冨婵堢棯閸撗勬珪闁逞屽墮缁犲秹宕曢柆宥呯闁硅揪濡囬崣鏇熴亜閹烘垵鈧敻宕戦幘鏂ユ灁闁割煈鍠楅悘鍫濐渻閵堝骸骞橀柛蹇旓耿閻涱噣宕橀纰辨綂闂侀潧鐗嗛幊鎰八囪閺岋綀绠涢幘鍓侇唹闂佺粯顨嗛〃鍫ュ焵椤掍胶鐓紒顔界懃椤繘鎼圭憴鍕彴闂佸搫琚崕鍗烆嚕閺夊簱鏀介柣鎰緲鐏忓啴鏌涢弴銊ュ箻鐟滄壆鍋撶换婵嬫偨闂堟刀銏犆圭涵椋庣М闁轰焦鍔栧鍕熺紒妯荤彟闂傚倷绀侀幉锟犲箰閸℃稑妞介柛鎰典簻缁ㄣ儵姊婚崒姘偓宄懊归崶顒夋晪闁哄稁鍘奸崹鍌炲箹濞n剙濡肩紒鈧崘顔界叆婵犻潧妫欓ˉ婊堟煟閿曞倷鎲炬慨濠傤煼瀹曟帒鈻庨幒鎴濆腐婵$偑鍊戦崹褰掓晝閵堝鐓濈€广儱顦崡鎶芥煏韫囨洖啸妞ゆ柨顦靛娲箹閻愭彃濮堕梺鍛婃尰閻熲晠骞冨鈧獮搴ㄦ嚍閵壯冨箰闂備礁鎲¢崝鎴﹀礉鎼淬垺娅犻柡鍥╁Х绾惧ジ鏌嶈閸撶喎鐣峰鈧崺鐐村緞閸濄儳娉块梻鍌氣看閸嬪嫬煤閵堝悿褰掓倻閸撳灝娲弫鍐焵椤掑嫭绠掓繝鐢靛Т閿曘倝鎮ц箛娑欏仼婵炲樊浜濋悡娑㈡倶閻愰鍤欏┑鈥炽偢閺屽秶鎲撮崟顐や紝閻庤娲栧畷顒勫煝鎼淬倗鐤€闁规儳顕Σ妤冪磽閸屾艾鈧悂宕愰悜鑺モ挃鐎广儱顦粈澶愬箹鏉堝墽鍒伴柛銊︾箖閵囧嫰寮介顫捕婵℃鎳樺娲川婵犲啫顦╅梺鎼炲妽婢瑰棛鍒掓繝姘闁兼亽鍎遍埀顒傛暬閺屻劌鈹戦崱娆忓毈缂備降鍔忓Λ鍕箒闂佺粯枪瀹曠敻鎮鹃悜妯诲弿濠电姴鍟妵婵囦繆椤愩垹鏆欓柍钘夘槸閳诲酣骞囬鐐╁亾閻戣姤鈷戦悹鍥ㄥ絻椤掋垽鏌i褍娅嶇€规洩绻濋獮搴ㄦ嚍閵夈儰绮ф俊鐐€栧ú宥夊磻閹惧灈鍋撶憴鍕闁绘牕銈搁妴浣肝旀担鍝ョ獮闁诲函缍嗛崑鍛存偟椤愨懇鏀介柣妯诲墯閸熷繘鏌涢敐搴$仯鐎垫澘锕畷婊嗩槷闁稿鎸剧划顓炩槈濡粯鎮欑紓浣哄У閻擄繝寮诲☉銏犖ㄦい鏃傚帶椤晠姊洪挊澶婃殶闁哥姵鐗犲濠氭晲婢跺﹥顥濋梺鍦圭€涒晠宕伴幇鐗堚拺闁煎鍊曢弸搴g磽瀹ュ拑韬€殿喛顕ч埥澶愬煑閳规儳浜鹃柨鏇炲€哥粻锝嗙節闂堟稒宸濆ù婊庝簼娣囧﹪鎮欓鍕ㄥ亾閵堝绀堟繛鍡樻尰閸嬪鏌涢埄鍐枔闁逞屽墯濡啫鐣峰鈧、娆撳床婢诡垰娲ょ粻鍦磼椤旂厧甯ㄩ柛瀣崌閹崇娀顢楅埀顒勫吹椤掑倻纾介柛灞捐壘閳ь剟顥撳▎銏ゆ晸閻樿尙鐛ュ┑掳鍊曢幊搴g不娴煎瓨鐓欓梻鍌氼嚟閸斿秹鏌涚€Q勬珚闁哄矉缍侀獮瀣晲閸♀晜顥夌紓浣鸿檸閸樻悂宕戦幘缁樷拻濞达綀娅g敮娑㈡煕閺冣偓濞叉粎鍒掗弮鍫燁棃婵炵娅曢惄顖氱暦濮椻偓椤㈡瑩宕楅崗澶规岸姊绘笟鈧埀顒傚仜閼活垱鏅堕鐐寸厪闁搞儜鍐句純濡ょ姷鍋炵敮锟犵嵁鐎n亖鏀介柟閭︿簽绾惧姊虹拠鍙夊攭妞ゎ偄顦甸獮鎰槹鎼达絿鐒兼繛鎾村焹閸嬫捇鏌涢埡鍐ㄤ槐妤犵偛顑夐弫鍌炴寠婢跺鐫忛梻鍌欑濠€杈╁垝椤栨粍鏆滈柍鍝勫€搁閬嶆煃瑜滈崜娑氭閹惧瓨濯撮柣鐔告緲婵垽鎮峰⿰鍕棆闁稿鍠栧畷姘跺箳閹存梹鐎婚梺瑙勫劤閻ゅ洭骞楅弴鐐╂斀闁绘劖娼欓悘锕傛煟椤撗冩灈闁宠绮欓、鏃堝醇閻斿搫骞嶉梺鑽ゅ枑閻熴儳鈧凹鍓氶幈銊╁炊閵婏絼绨婚梺闈涱檧婵″洨绮婚悙瀛樺弿濠电姴鍟妵婵嬫煛鐏炶姤鍤囬柟顔界懇閹崇姷鎹勬笟顖欑磾婵犵數濮幏鍐磼濮橆剛銈梻浣告惈閻ジ宕伴弽顓炵鐟滅増甯╅弫鍐煥濠靛棙鍣介柨娑欐崌濮婄粯鎷呴悷閭﹀殝缂備浇顕х€氭澘鐣烽幋婵冩闁靛繒濮烽崢鎾⒑閻熼偊鍤熷┑顕呭弮瀹曟垿骞樼紒妯绘珳闁圭厧鐡ㄩ敋濞存粎鍋撻妵鍕箻鐎电硶濮囧┑鐐叉噹閿曨亪寮婚敍鍕勃闁伙絽鐫楅敐鍡欑缁炬澘褰夐柇顖涱殽閻愯尙绠冲ù鐙呯畵閹稿﹥寰勬繝鍛缚闂傚倸鍊搁崐鐑芥倿閿曞倹鍎戠憸鐗堝笒绾惧綊鏌¢崶銉ョ仼缂佺姷濞€閺岀喖鏌囬敃鈧弸鐔搞亜椤愶絾绀嬮柡宀€鍠栭獮鍡氼槾闁圭晫濮撮埞鎴︻敍濞戞瑥鍞夐梺鍝勬湰閻╊垶鐛鈧鍫曞箣閻樼偣鍋¢梻鍌欑閹诧繝骞愮粙璺ㄦ殾妞ゆ帒瀚ч埀顒佹瀹曟﹢顢欓崲澹洦鐓曢柍鈺佸枤濞堟ê霉閻樿櫕鍊愭慨濠冩そ閹筹繝濡堕崨顔界槪闂備礁鎼幊蹇涙儎椤栫偛绠栧Δ锝呭暞閸婂鏌﹀Ο鐚寸礆闁靛ě鍕瀾婵犮垼鍩栭崝鏇犲婵犳碍鐓欓柛鎾楀懎绗¢梺鍝勬噺閻擄繝鐛弽顐㈠灊闁荤喐婢橀埛澶愭⒑鐠囪尙绠扮紒澶屾嚀椤繘鎼归崷顓狅紲濠碘槅鍨甸褔妫勫鍛斀闁绘劖褰冪痪褔鏌ㄩ弴妯虹仾濞e洤锕幃鐣岀矙鐠侯煈妲规俊鐐€栭悧妤€顫濋妸鈺傚仾闁逞屽墴濮婂宕掑顑藉亾閹间焦鍋嬪┑鐘插閻瑩鏌熼柇锕€鏋﹀┑顔藉▕閺屻倕霉鐎n偅鐝栫紒鐐礃濡嫰婀侀梺鎸庣箓閻楀﹪藟婢舵劖鐓熼柟鐐綑婵牓鏌熸笟鍨閾伙絿绱掔€n亞浠㈡い顒€顑呴埞鎴﹀灳閸愯尙楠囬梺鍛婃⒐閻熲晠鎮伴鍢夌喖宕楅悡搴e酱闂備浇鍋愰埛鍫ュ礈閿曗偓鍗卞ù鐓庣摠閳锋帒霉閿濆毥褰掑汲闁秵鐓欑痪鏉垮船娴滄壆鈧娲橀崝鏍崲濠靛柊鎺旂矙閹稿骸鏋犻悗娈垮枦閸╂牠骞嗛弮鍫濈閻庢稒蓱濠㈡垵鈹戦敍鍕杭闁稿﹥鐗曢~蹇旂節濮橆儵銉╂倵閿濆簼鎲鹃柛鐔锋嚇閺屾洘寰勫☉婊咁槹婵炲瓨绮嶇划宥夊Φ閸曨垰绠婚悹楦挎〃缁泛鈹戦埄鍐ㄧ祷妞ゎ厾鍏樺濠氭晲婢跺娅滈梺鎼炲劀閸愩劎顓哄┑掳鍊楁慨鐑藉磻閻愬灚鏆滈柨鐔哄Х瀹撲線鎮楅敐搴℃灈缂侇偄绉归弻宥堫檨闁告挾鍠栭獮鍐ㄎ旀担铏圭槇濠殿喗锕╅崢鎼佸箯濞差亝鐓熼柣鏂挎憸閹冲啴鎮楀鐓庡籍鐎规洘娲栬灃闁告侗鍠氶崢鍗炩攽閳藉棗鐏ラ柕鍡忓亾闂佺ǹ顑嗛幑鍥箖閵忋倕绠甸柟鐑樺灩闂冣偓濠电姷鏁告慨鐑藉极閸涘﹥鍙忛柣鎴f閺嬩線鏌涘☉姗堟敾闁告瑥绻橀弻锝夊箣閿濆棭妫勯梺鍝勵儎缁舵岸寮诲☉妯锋婵鐗婇弫楣冩⒑閸涘﹦鎳冪紒缁樺灴婵$敻宕熼姘鳖啋闂佸憡顨堥崑鐔哥閼测晝纾奸柣鎰靛墮閸斻倖銇勯鐘插幋鐎殿喖顭烽幃銏ゆ偂鎼达綆妲堕柣鐔哥矊缁绘帡寮灏栨闁靛骏绱曢崢鎾绘⒒娴e摜浠㈡い鎴濇嚇閹﹢鏁冮崒娑氬帾闂佹悶鍎滈崘鍙ョ磾婵°倗濮烽崑鐐垫暜閳ュ磭鏆﹂柛妤冨剱濞撳鏌熼鍡楁湰椤ワ紕绱撻崒姘偓鎼佸磹閹间礁纾瑰瀣捣閻棗銆掑锝呬壕闁芥ɑ绻堝娲敆閳ь剛绮旈幘顔煎嚑濞达絿纭堕弨浠嬫煟濡寧鐝柣銊﹀灩閳ь剝顫夐幐椋庢濮樿泛钃熸繛鎴欏灩閻掓椽鏌涢幇鍏哥按濠殿喖娲铏圭矙閸栤€冲闂佺ǹ绻戦敃銏狀嚕鐠囨祴妲堟俊顖炴敱閺傗偓闂備胶纭堕崜婵嬨€冭箛鏂款嚤闁逞屽墯娣囧﹪鎮欓鍕ㄥ亾閺嵮屾綎鐟滅増甯掔粈澶愭煛閸ャ儱鐏╅柣鎾达耿閺岀喐娼忔ィ鍐╊€嶉梺绋匡工椤兘寮诲☉銏犖ㄩ柕蹇婂墲閻濇牠鏌″蹇曠瘈婵﹦绮幏鍛村川婵犲倹娈橀梻浣告贡鏋い顓犲厴楠炲啴鎮滈懞銉︽珕闂佷紮绲芥径鍥绩閾忣偆绡€闁汇垽娼у瓭濠电偠顕滅粻鎾崇暦閻㈢ǹ绀冩い鏃傛櫕閸樻捇姊洪崨濠勭畵閻庢凹鍓熷鎶芥偄閸忚偐鍙嗗┑鐐村灦閻熝囨儗閹烘挻鍙忓┑鐘叉川缁变即鏌曢崶銊ュ妤犵偞甯¢獮瀣堪閸愨晝鈧娊姊婚崒娆戭槮闁硅绻濋幃鐑藉Ψ閿旂粯顔旈梺褰掓?缁€渚€鎮″┑瀣厵闁绘劦鍓氶悘閬嶆煕椤愵偂閭柡灞剧洴椤㈡洟濡堕崨顔句簴闂備礁鎲¤摫闁诡喖鍊垮濠氭晲閸垻鏉搁梺鍝勬川閸嬫﹢骞嬫搴g<缂備降鍨归獮鏍煟閺嶎偄甯堕柣锝囧厴楠炲鏁冮埀顒傜不婵犳碍鍋i柛銉簻閻ㄦ椽鏌i妶鍌氫壕濠电姷鏁搁崑鐘诲箵椤忓棗绶ゅù鐘差儏缁犵喖鏌ㄩ悢鍝勑㈢痪鎹愵潐閵囧嫰寮介顫勃闂佹娊鏀遍崹褰掓儉椤忓牜鏁囬柣鎰綑濞咃絾绻涚€涙ḿ鐭婄紓宥咃躬楠炲啰鎹勭悰鈩冾潔闂佸搫璇為崘銊愭洟姊绘担铏广€婇柡鍌欑窔瀹曟垿骞橀幇浣瑰瘜闂侀潧鐗嗗Λ妤冪箔閹烘鐓曢柣鏇氱娴滀即鏌熼姘殭閻撱倖銇勮箛鎾村櫧闁告ê鎲$换娑欐綇閸撗冨煂濠电姭鍋撻弶鍫涘妽濞呯姵銇勮箛鎾跺闁绘挸鍟撮幃宄扳枎韫囨搩浠奸梺璇茬箲閹告娊寮婚悢纰辨晩闁伙絽鏈崳浼存倵濞堝灝鏋涢柣鏍с偢閻涱喚鈧綆鍠楅崑鎰板级閸偆鍘涢柡浣告喘濮婂宕掑顑藉亾妞嬪海鐭嗗ù锝夋交閼板潡寮堕崼娑樺濞寸姵宀稿缁樻媴娓氼垱鏁繝娈垮枔閸婃宕氶幒鎾村劅闁靛ǹ鍎抽ˇ顐︽⒑閸︻厼鍔嬫い銊ユ噽閻氭儳顓兼径瀣幈濡炪倖鍔戦崐鏇㈠几鎼粹埗褰掓偐閻戞﹩浠╃紓浣介哺閹稿骞忛崨鏉戠闁圭粯甯掓竟宥嗕繆閻愵亜鈧牕煤濡崵绠惧┑鐘叉搐閺嬩線鏌涢幇闈涙灈缁炬儳鍚嬬换娑㈠箣閻愯泛顥濆Δ鐘靛仜閻楁挸顫忕紒妯诲闁告稑锕ラ崕鎾斥攽閻愯尙婀撮柛銊ㄦ閻e嘲鈹戦崱娆愭畷闂佸憡娲﹂崜娆撳焵椤掆偓閻栧ジ寮婚敐鍛傜喖鎳栭埡浣侯偧闂備胶绮幐璇裁洪悢鐓庤摕闁绘柨鍚嬮崵瀣亜閹哄棗浜炬繝纰夌磿閸樠囨箒濠电姴锕ょ€氼剟宕濋妶澶嬬厓閻熸瑥瀚悘鎾煛娴e摜效鐎规洜鍠栭、鏇㈠焺閸愨晝绐旈梻鍌氬€烽懗鑸电仚闂佹寧娲忛崕鐢稿箖瑜旈幃鈺呮嚑椤掍焦顔曟繝鐢靛█濞佳囶敄閸℃稑鐤炬繝闈涱儐閻撳啰鎲稿⿰鍫濈闁绘梻鍘ч悘鎶芥煥閺囩偛鈧悂鏌ㄩ妶鍡曠箚闁靛牆鍊告禍楣冩⒑缂佹ê绗掗柣蹇斿哺婵$敻宕熼姘鳖唺閻庡箍鍎遍悧鍡涘储閿涘嫮纾藉ù锝呮惈瀛濇繝鈷€鍌滅煓闁糕斁鍋撳銈嗗坊閸嬫捇鏌涘Ο鑽ょ煉鐎规洘鍨块獮姗€寮妷锔芥澑闂備胶绮灙濞存粠鍓涚划锝夊籍閸喓鍘遍柣搴秵閸嬫帒鈻撻弮鍫熺厓閻熸瑥瀚悘瀛樸亜閵忥紕鎳呮繛鎴犳暬閹粓鎮剧仦钘夊唨婵犵數濮烽弫鎼佸磻濞戙垹绠柟瀵稿Т缁躲倝鏌涢…鎴濇殠闁挎繂顦粻娑㈡煛婢跺孩纭舵い鏂匡躬濮婃椽鎮烽弶鎸庢瘣缂佸墽铏庨崣鍐ㄧ暦娴兼潙绠婚悹鍥皺椤斿棝姊虹紒妯剁細缂侇噮鍨跺畷鐢稿箣閿旂晫鍘剧紓浣割儓濞夋洘绂掑☉娆愬弿闁挎繂妫楁慨宥嗘叏婵犲偆鐓肩€规洘甯掗~婵嬵敄閽樺澹曢梺缁樺灱婵倝宕甸崟顖涚厾闁告縿鍎查弳鈺伱归悩宕囶暡缂佺粯绻堥幃浠嬫濞戞鎹曟俊鐐€栧ú锕傚矗閸愩劎鏆︽俊銈傚亾閾伙絽銆掑鐓庣仩婵炲牄鍔岄—鍐Χ閸℃顫囬梺绋匡攻閻楁粓鍩€椤掍胶顣叉慨妯稿姂閸┾偓妞ゆ帒鍊归崵鈧繝銏㈡嚀閿曨亜鐣锋导鏉戝唨鐟滃寮搁弮鍫熺厪濠电姴绻愰々顒傜磼閳锯偓閸嬫捇姊绘担鍦菇闁搞劏妫勫玻鑳槼闁绘娴风槐鎾存媴閸濆嫪澹曞┑鐘灪宀h法鍒掗弮鍫熷仭闂侇叏绠戝▓銊╂⒑閸濆嫯顫﹂柛搴や含缁鎮介崨濠勫幍闂佺粯鍨跺玻璺ㄧ不濮椻偓閺屾盯鎮欓崹顐f瘓闂佸搫鐭夌紞渚€骞冮埡鍛€绘慨妤€妫旈崫妤呮⒑鐠囪尙绠扮紒璇茬墦瀹曟繂鐣濋崟鍨櫓闂婎偄娲︾粙鎴濇暜闁荤喐绮岄ˇ闈涚暦閹达箑绠婚柤鎼佹涧閺嬪倿姊洪崨濠冨闁告挻鐟ч崰濠傤吋閸涱亝鏂€闂佸疇妫勫Λ妤佺濠靛牏纾奸悹鍥ㄥ絻閳ь剙娼¢弫鎰版倷閸撲胶鏉稿┑鐐村灦閻燂箓宕曢鍫熲拺闂傚牃鏅涢惁婊堟煕濮椻偓缁犳牠寮鍛牚闁告劧绲鹃弬鈧梻浣哥枃濡嫬螞濡ゅ懏鍊堕柣妯肩帛閻撴瑧鐥弶鍨埞濞存粈鍗抽弻銊モ攽閸繀绮跺銈嗘尭閵堢ǹ鐣烽崼鏇炵厸闁告劘娉曢梻顖涚節閻㈤潧浠╅柟娲讳簽缁辩偞绗熼埀顒冩"闂佽宕橀褏绮堟径灞稿亾楠炲灝鍔氭い锔垮嵆閹€斥枎閹寸姷锛滈柣搴秵娴滅偞绂掗姀銈嗙厸闁糕剝绋愰幉楣冩煛瀹€瀣М闁轰焦鍔欏畷鎯邦槻妤犵偛顑呰灃闁绘﹢娼ф禒婊勩亜閹存繍妯€鐎殿噮鍋婂畷姗€顢欓懖鈺佸Е婵$偑鍊栫敮鎺楀磹缂佹ḿ鈻旂€广儱鎳夐弨浠嬫煟濡櫣锛嶆い锝嗙叀閺屾稓鈧絽澧庣粔顕€鏌$仦鍓ф创濠碉紕鍏橀獮瀣攽閸℃ɑ顔嶅┑掳鍊楁慨鏉懨洪銏犵畺婵°倕鍟崰鍡涙煕閺囥劌澧痪鏉跨Ф缁辨挻鎷呴崜鍙壭ч梺鐟版啞婵炲﹪宕规ィ鍐ㄧ睄闁割偅绻勯ˇ銊ヮ渻閵堝棙鐓ユ俊鎻掔墣椤﹀綊鏌$仦鍓ф创闁糕晛瀚板畷妤呮偑閳ь剚绂嶉鍕庢盯宕熼顐㈡倯闂佹悶鍎弲婵嬫晬濠靛洨绠鹃弶鍫濆⒔閸掓澘顭块悷甯含鐎规洘娲熼獮鍥偋閸垹骞堥梻渚€娼ф灙闁稿酣浜堕妴鍌氱暦閸モ晝锛滃銈嗘⒒閳峰牓宕曡箛鏂讳簻闁规儳鍟块幃鎴犫偓鍨緲鐎氼噣鍩€椤掑﹦绉靛ù婊勭墵瀹曟垿骞樼紒妯煎弳闁诲函绲婚崝瀣姳婵犳碍鈷戦柣鐔哄閹牏绱掓径濠勫煟閽樻繈鏌ㄩ弮鍫熸殰闁稿鎸搁埢鎾诲垂椤旂晫浜梻浣筋嚙缁绘垹鎹㈤崼銉ユ槬闁绘劕鎼粻锝夋煥閺囨浜鹃梺缁樻惈缁绘繈寮诲☉銏犵労闁告劗鍋撻悾鍏肩箾鐎电ǹ顎岄柛銊ㄦ硾椤繐煤椤忓嫬绐涙繝鐢靛Т濞寸兘宕濋崼鏇熲拺闁告稑锕ユ径鍕煕濞嗗繘顎楅悡銈夋煕濞戞﹫姊楃紒璇叉閺屾洟宕煎┑鍫㈩唺闂佸憡甯婇崡鎶藉蓟濞戙垺鍋嗗ù锝呮憸娴犳悂鎮楃憴鍕闁告梹鐟ラ悾鐤亹閹烘繃鏅濋梺鎸庣箓閹冲孩瀵兼惔銏㈢瘈缁剧増蓱椤﹪鏌涢妸锕€鈻曠€规洏鍨奸ˇ宕囩磼閸屾氨校闁靛牞缍佸畷姗€鍩℃担鎻掍壕闁割煈鍋呴崣蹇斾繆椤栨粌甯跺ù婊堢畺閹顫濋悙顒€顏�

核心提示:修复identity 类型字段数据的跳跃(译) 内容提要1、引言2、dbcc object_atts 3、下载'sp_identity' 存储过程4、使用sp_identity显示使用identity 类型字段的表5使用sp_identity显示当前表的 identity 数字6、使用sp_identi
修复identity 类型字段数据的跳跃(译)
内容提要
1、引言
2、dbcc object_atts
3、下载'sp_identity' 存储过程
4、使用sp_identity显示使用identity 类型字段的表
5 使用sp_identity显示当前表的 identity 数字
6、使用sp_identity 修改表的 identity数字
1引言
在sybase 中,有一个使用未公开的dbcc 命令 ,即 dbcc object_atts 快速修复identity 跳跃的方法,因为 dbcc
object_atts 比较难于使用,而存储过程 sp_identity 更容易完成你的问题
警告:本文的方法没有出现在sybase 发布的文档中,并且没有被 sybase 支持,使用与否取决定你自己,如果出现问题,不能从
sybase 技术支持那里得到帮助
2、dbcc object_atts
dbcc object_atts 命令提供了 一个访问 OAM 页的后门,在 OMA 中,保存了表的 identity 计数器。
不幸的是,这个命令在文档中几乎没有任何说明,并且很难使用,其语法如下:
dbcc object_atts (table_name, 0, subcommand, [ new_value ] )
第一个参数 :表名,第二个参数 0,
第三个参数: get ---显示 保存在 OMA 中的 identity 值
或put ---设置 OMA 中的 identity 值,设置的具体数据为 第四个参数数据
第四个参数 :新设置的数
主要的问题是 dbcc object_atts 显示的数据为 16字节的 16进制字符,你必须自己解释为10进制,并且,如何解释依赖于
identity 列的长度,同样,设置它也是。在实际环境中,很少作为首选。
幸运的是,有一个存储过程 sp_identity 能够处理编码与解码, 并且给出所有含 identity 列的表的情况
下载 'sp_identity'
sp_identity 只支持 11。0 以后版本,下载文件中包含两个版本,一个用于 ASE 11.9/11.5/11.0 的叫
,sp_identity.119.sql,另外一个用于ASE 12.0及以后版本(sp_identity.120.sql)
4、使用sp_identity显示使用identity 类型字段的表
sp_identity 有几个不同的功能,不带任何参数运行,只显示当前数据库中 包含 identity 列的表,
以及最大可能的 identity 跳跃
1> sp_identity
2> go
Tables with an identity column in database '':
Owner.Table.Column datatype Maximum Identity Gap
------------------------------- -------------------------------
dbo.invoices.inv_nr numeric(18) 500000000000000 (burn)
dbo.small_gap_tab.a numeric(30) 10 (identity_gap)
dbo.my_table.n numeric(6) 500 (burn)
(burn) 表示 identity列的 一次取数由系统参数"identity burning set factor" 决定,而
(identity_gap) 表示 该表有自定义的identity_gap 属性
5 使用sp_identity显示当前表的 identity 数字
确定当前特定表的 OAM 页的identity 值,必须按照以下三步过程:
首先 打开跟踪标志 3604 (运行 dbcc traceon(3604) )
运行 指定特定表名运行 sp_identity
1> sp_identity invoices
2> go
Table = invoices (id=1804533462)
Identity column = a numeric(18)
Max. Identity Gap = 500000000000000
("identity burning set factor" = 5000 = 0.05%)
Reading identity value from OAM page...
object_atts:get:return value=1
0207E20C: 0001c6bf 52634001 00000000 00000000 ....Rc@.........
0207E21C: .
DBCC execution completed. If DBCC printed error messages,
contact a user with System Administrator (SA) role.
这个 16字节的 16进制字符串是 OAM 中保存的 identity 值 (0001c6bf 52634001 00000000 00000000)
再次运行 sp_identity ,并且 指定这个字符串参数
1> sp_identity invoices, "0001c6bf 52634001 00000000 0000000"
2> go
Table = invoices (id=1804533462)
Identity column = a numeric(18)
Max. Identity Gap = 500000000000000
("identity burning set factor" = 5000 = 0.05%)
Decoded identity value on OAM page = 500000000000001
(hex=0001c6bf52634001)
现在,我们得到并解码了 OAM 中的 identity 值,但它意味着什么呢?
首先,如果你用 "with nowait" 停止服务器,这个 identity 列将跳跃多少。而不是表中数据的下一个。
而是保存在 OAM 中的数据加上 identity 种子设顶数(在 ASE 12.0, 为identity_gap 选项)
另外,当你运行 ASE 12.0, 可以通过运行 dbcc listoam看到这个数据
6、使用sp_identity 修改表的 identity数字
使用 sp_identity , OAM 中identity 的 数字可以被设置为任意数. 这个需要如下步骤:
1、确认你要设置的数据(查看表中identity 的数据应该到多少,比如 10033 )
2、正常停止服务器
3 重新启动服务器,以单用户模式,或者不让用户访问
4、 运行 sp_identity table_name, null, new_value ;
1> sp_identity invoices, null, 10032
2> go
Table = invoices (id=1804533462)
Identity column = a numeric(18)
Max. Identity Gap = 500000000000000
("identity burning set factor" = 5000 = 0.05%)
object_atts:put:return value=1
DBCC execution completed. If DBCC printed error messages,
contact a user with System Administrator (SA) role.
Identity value on OAM page has been set to 10032
(hex=0x00000000000027300000000000000000)
You should now do a 'shutdown with nowait' immediately.
After restarting the server, the value assigned to the
next row inserted into 'invoices' will be 10033.
5 然后立即运行 'shutdown with nowait' ,这样 表的下一个 identity 数字是 10033
6 重新正常启动sybase 服务
说明:如果你应用了 identity 数据类型,并且要求identity 列保持连续,并且数据量很大,那么,用这个方法需要的时间可能比较短
否则不推荐使用。
下面是SP_IDENTITY.120.SQL,用于 12.0 以后版本
/*
* SP_IDENTITY.120.SQL - version for ASE 12.0 or later
* (when running ASE 11.9/11.5/11.0, install SP_IDENTITY.119.SQL instead)
*
* Description
* ===========
* This file contains the stored procedure 'sp_identity', which performs some
* useful functions w.r.t. identity columns:
*
* - displays all tables with an identity column in the current database
* - displays the identity value stored on a table's OAM page
* - resets the identity value stored on a table's OAM page
*
* For details and background, see http://www.sypron.nl/idfix.html .
*
*
* Installation
* ============
* Execute this script using "isql", using a login having both "sa_role"
* and "sso_role".
* The stored procedure will be created in the sybsystemprocs database.
*
*
* Notes
* =====
* - Traceflag 3604 should be enabled before running sp_identity for a
* specific table ("dbcc traceon(3604)"); if omitted, you won't see
* any output.
*
* - To run sp_identity for a specific table, sa_role and sybase_ts_role
* are required.
*
* - sp_identity was successfully tested on ASE versions 11.0.3, 11.5,
* 11.9.2 and 12.0 on various platforms.
*
* - sp_identity will not work on ASE 11.0 because this version
* does not support the 'case' expression.
*
* - sp_identity was not tested on a 64-bit ASE version.
*
*
* Revision History
* ================
* Version 1.0 17-Dec-2000 First version
* Version 1.1 Oct-2002 Handle identity_gap=NULL (thanks to Alan Cooper),
* and some small improvements for installation
* Version 1.2 Apr-2003 Improved installation
*
*
* Copyright Note & Disclaimer :
* =============================
* This software is provided "as is"; there is no warranty of any kind.
* While this software is believed to work accurately, it may not work
* correctly and/or reliably in a production environment. In no event shall
* Rob Verschoor and/or Sypron B.V. be liable for any damages resulting
* from the use of this software.
* You are allowed to use this software free of charge for your own
* professional, non-commercial purposes.
* You are not allowed to sell or bundle this software or use it for any
* other commercial purpose without prior written permission from
* Rob Verschoor/Sypron B.V.
* You may (re)distribute only unaltered copies of this software, which
* must include this copyright note, as well as the copyright note in
* the header of each stored procedure.
*
* Note: All trademarks are acknowledged.
*
* Please send any comments, bugs, suggestions etc. to the below email
* address.
*
* Copyright (c) 2000-2002 Rob Verschoor/Sypron B.V.
* P.O.Box 10695
* 2501 HR Den Haag
* The Netherlands
*
* Email: rob@sypron.nl
* WWW : http://www.sypron.nl/
*----------------------------------------------------------------------------
*/
set nocount on
go
set flushmessage on
go
use sybsystemprocs
go
-- we need to be at ASE 12.0 or later; if not, abort this script
if isnull(object_id("master.dbo.sysqueryplans"),99) >= 99
begin
print ""
print ""
print "********************************************"
print "********************************************"
print " This script is for ASE 12.0 or later."
print " Please install SP_IDENTITY.119.SQL instead."
print "********************************************"
print "********************************************"
print " "
print " "
print ""
set background on -- terminate this script now
end
go
print ""
print "Installing 'sp_identity'..."
print ""
go
if object_id("sp_identity_help") <> NULL
begin
drop proc sp_identity_help
end
go
create proc sp_identity_help
/* Copyright (c) 2000-2002 Rob Verschoor/Sypron B.V. */
as
begin
print " "
print " Usage: sp_identity table_name, ""hex-string-from-OAM-page"", new-identity-value "
print " Notes: "
print " - specifying only parameter 1 retrieves the current identity value for"
print " that table from the OAM page as a hexadecimal string."
print " - specifying this hexadecimal string as the second parameter (in quotes)"
print " will decode the hex value to a numeric value."
print " - specifying a numeric value for the third parameter will set that"
print " value as the new identity value for this table."
print " - parameters 2 and 3 cannot be specified together: one of them must be NULL."
print " - ""dbcc traceon(3604)"" must be run before using option 2 or 3"
print " "
print " Copyright (c) 2000-2002 Rob Verschoor/Sypron B.V."
print " See http://www.sypron.nl/idfix.html for background information & updates."
print " "
end
go
grant execute on sp_identity_help to public
dump tran sybsystemprocs with truncate_only
go
if object_id("sp_identity") <> NULL
begin
drop proc sp_identity
end
go
create proc sp_identity
/* Copyright (c) 2000-2002 Rob Verschoor/Sypron B.V. */
@p0 varchar(50) = NULL, -- table name
@p1 varchar(50) = NULL, -- hex value to decode
@p2 numeric(38) = NULL -- new value to set
as
begin
set nocount on
declare @n numeric(38), @j numeric(38), @n256 numeric(3), @n10 numeric(38)
declare @i int, @max int, @idlen int, @idlenb int, @ib int, @len int
declare @p0_id int, @b int, @b1 binary(1), @lsb int
declare @idgap int, @idburn int, @maxidgap numeric(38), @max1 int, @max2 int
declare @idburnpct numeric(5,2), @v int, @ntab int
declare @c2 char(2), @doampg int, @indid int, @dbname varchar(32)
declare @vc50 varchar(50), @colname varchar(32), @vb16 varbinary(16)
select @dbname = db_name()
-- check version
select @v = 0
if exists (select * from sysobjects
where name = "sysqueryplans" and type = "S")
begin
select @v = 12
end
if @p0 = '?'
begin
exec sp_identity_help
return 0
end
-- numeric values
select @n256 = 256
select @n10 = 10
-- id burning set factor
select @idburn = value from master.dbo.syscurconfigs where config=141
select @idburnpct = convert(numeric(5,2), @idburn * 0.00001)
-- figure out msb/lsb
select @lsb = 0
if substring(convert(binary(4), 1), 1 ,1) = 0x01 select @lsb = 1
if substring(convert(binary(4), 1), 2 ,1) = 0x01 select @lsb = 2
if substring(convert(binary(4), 1), 3 ,1) = 0x01 select @lsb = 3
if substring(convert(binary(4), 1), 4 ,1) = 0x01 select @lsb = 4
-- get all tables containing identity columns in this database
select id = so.id, owner = su.name, uid = so.uid, so.name, si.doampg, si.indid, idgap =
isnull(si.identitygap,0),
colname = sc.name, sc.prec, maxgap = convert(numeric(38), ceiling((@idburn * 0.0000001) *
power(@n10,prec)))
into #id
from sysindexes si, syscolumns sc, sysobjects so, sysusers su
where si.indid < 2
and so.type = "U"
and sc.status & 128 = 128
and so.id = sc.id
and so.id = si.id
and so.uid = su.uid
select @ntab = @@rowcount
set arithabort numeric_truncation off
if @p0 = null
begin
-- display all tables with identity columns in the current DB
if @ntab = 0
begin
print " There are no tables with an identity column in database '%1!'", @dbname
return 0
end
print " Tables with an identity column in database '%1!':", @dbname
print " "
select @max1 = max(char_length(owner + "." + name + "." + colname)) + 12 from #id
select @max2 = max(char_length(convert(varchar(38), maxgap))) + 7 from #id
if @max1 <= 52 and @max2 <= 24
begin
select convert(varchar(52), owner + "." + name + "." + colname + " numeric(" +
convert(varchar(2),prec) + ")") "Owner.Table.Column datatype",
convert(varchar(24), case when idgap = 0 then convert(varchar(38),maxgap) + "
(burn)"
else convert(varchar, idgap) + " (identity_gap)"
end) "Maximum Identity Gap"
from #id
order by name
end
else
if @max1 <= 32 and @max2 <= 44
begin
select convert(varchar(32), owner + "." + name + "." + colname + " numeric(" +
convert(varchar(2),prec) + ")") "Owner.Table.Column datatype",
convert(varchar(44), case when idgap = 0 then convert(varchar(38),maxgap) + "
(burn)"
else convert(varchar, idgap) + " (identity_gap)"
end) "Maximum Identity Gap"
from #id
order by name
end
else
begin
select convert(varchar(78), owner + "." + name + "." + colname + " numeric(" +
convert(varchar(2),prec) + ")") "Owner.Table.Column datatype",
convert(varchar(50), case when idgap = 0 then convert(varchar(38),maxgap) + "
(burn)"
else convert(varchar, idgap) + " (identity_gap)"
end) "Maximum Identity Gap"
from #id
order by name
end
print " "
print " Legend:"
print " (burn) : gap size is determined by ""identity burning set factor"" "
if @v = 12
begin
print " (identity_gap) : gap size is determined by the ""identity_gap"" setting"
end
print " "
print " Current value for ""identity burning set factor"" = %1! (=%2!%%)", @idburn, @idburnpct
return 0
end
if charindex("sa_role", show_role()) = 0
begin
print "You must have 'sa_role' to run this procedure."
return -1
end
if charindex("sybase_ts_role", show_role()) = 0
begin
print "You must have 'sybase_ts_role' to run this procedure."
return -1
end
-- get some info on the object
select @p0_id = object_id(@p0)
if @p0_id = NULL
begin
print " Error: '%1!' is not a user table.", @p0
return -1
end
if @p0 not like "%.%"
begin
select @ntab = count(*) from sysobjects where name = @p0 and type = "U"
if @ntab > 1
begin
print " %1! tables named '%2!' exist in this database:", @ntab, @p0
print " "
select owner + "." + name "owner.table_name"
from #id where name = @p0 order by uid
print " "
print " Specify 'owner.table_name' to identify the table."
return -1
end
end
select @doampg = doampg, @indid = indid, @idgap = idgap
from #id where id = @p0_id
if not exists (select 1 from syscolumns where id = @p0_id and status & 128 = 128)
begin
print " Error: Table '%1!' does not have an identity column", @p0
return -1
end
-- retrieve the length of the numeric identity column as declared when the
-- table was created
select @len = prec, @colname = name
from syscolumns where id = @p0_id and status & 128 = 128
if @@rowcount = 0
begin
print " Error: Could not retrieve length of identity column for table '%1!'", @p0
return -1
end
select @idlen = @len -- column precision (positions)
select @idlenb = (@idlen+1-((@idlen+5)/12)-(@idlen/12))/2 -- column length (bytes)
print " "
print " Table = %1! (id=%2!)", @p0, @p0_id
print " Identity column = %1! numeric(%2!)", @colname, @len
--print " OAM page = %1!", @doampg
--print " Bytes on OAM page = %1!", @idlenb
if @idgap > 0
begin
print " Max. Identity Gap = %1! (""identity_gap"" = %2!)", @idgap, @idgap
end
else
begin
set arithabort numeric_truncation off
select @maxidgap = ceiling((convert(numeric(38),@idburn) * 0.0000001) * power(@n10,@len))
print " Max. Identity Gap = %1!", @maxidgap
print " (""identity burning set factor"" = %1! = %2!%%)", @idburn, @idburnpct
if @v = 12
begin
print " (Note: ""identity_gap"" has not been set for this table !)"
end
end
print " "
if @p1 = NULL and @p2 = NULL -- retrieve current ID value
begin
print " "
print " Reading identity value from OAM page... (traceflag 3604 should be enabled !)"
print " "
dbcc object_atts (@p0, 0, get)
print " "
print " To decode this hexadecimal value, re-run 'sp_identity' with the hexadecimal"
print " string as a quoted 2nd parameter (you can leave the spaces in). "
print " Example: sp_identity %1!, ""the-hex-string-from-the-above-output"" ", @p0
print " "
--
-- only for 12.0+, dbcc listoam will display the values in the OAM and the DES
--
--dbcc listoam(@dbname, @p0_id, @indid)
--
return 0
end
if upper(@p1) like "[ 0-9A-F]%" -- entered a hex string, decode it
begin
if @p2 != NULL
begin
print " Error: When decoding a hex value from the OAM page, parameter 3"
print " (the new identity value) must be NULL."
exec sp_identity_help
return -1
end
select @ib = @idlenb -- counts bytes
select @i = char_length(@p1) -- counts string
select @n = 0 -- holds result
while 1 = 1
begin
select @c2 = substring(@p1, (char_length(@p1)-@i)+1, 2)
--print "Step %1!, [%2!]", @ib, @c2
if upper(substring(@c2,1,1)) = " " -- ignore single space pasted in by user
begin
select @i = @i - 1
continue
end
if (upper(@c2) not like "[0-9A-F][0-9A-F]")
begin
print " Error: Invalid characters (%1!) in hex string", @c2
break
end
-- add this byte to the result
select @vc50 = @vc50 + @c2
select @j = power(@n256, (@ib-1))
select @n = @n + @j * hextoint("0x" + @c2)
--print "Step %1!, exp= %2!, result = %3!", @ib, @j, @n
-- next byte
select @ib = @ib - 1
if @ib = 0 break -- ready
-- next 2 chars
select @i = @i - 2
if @i = 0
begin
-- we shouldn't have got here, error
print " Error: ID column length and specified hex string do not match !"
break
end
end
if @ib = 0
begin
print " Decoded identity value on OAM page = %1!", @n
print " (hex= %1!)", @vc50
print " "
return 0
end
else
begin
print " Error: Aborted due to error."
return -1
end
end
if @p2 != NULL -- entered a new ID value, set it
begin
if @p1 != NULL
begin
print " Error: When setting a new identity value, parameter 2"
print " (the hex string from the OAM page) must be NULL."
exec sp_identity_help
return -1
end
-- set the new ID value
if @p2 <= 0
begin
print " Error: The new identity value must be >= 0."
print " "
exec sp_identity_help
return -1
end
if char_length(convert(varchar, @p2)) > @idlen
begin
select @vc50 = replicate("9", @idlen)
print " Error: New identity value (%1!) is too large", @p2
print " for this identity column. The maximum possible value", @p2
print " is %1! (%2! positions).", @vc50, @idlen
return -1
end
if @lsb = 0
begin
print " "
print "Internal error in 'sp_identity':"
print "Cannot figure out byte order on this platform."
print "Please send a note to 'rob@sypron.nl' with the text of this"
print "error and your @@version string."
return -1
end
-- convert the numeric value to hex
select @ib = @idlenb -- counts bytes
select @i = 15
select @vc50 = NULL -- holds result
select @vb16 = NULL -- holds result
select @n256 = 256
select @n = @p2
set arithabort numeric_truncation off
while 1 = 1
begin
select @j = power(@n256, @i)
select @b = @n / @j
select @n = @n - (@b * @j)
select @c2 = right(inttohex(@b),2)
select @b1 = substring(convert(binary(4), @b), @lsb,1)
select @vb16 = @vb16 + @b1
--print "Step %1!, @b=%2!, hex(c2)=%3!, hex(b1)=%5!, result=%4!", @i, @b, @c2, @vb16, @b1
select @i = @i - 1
if @i < 0 break -- ready
end
if @i < 0
begin
select @vb16 = substring(@vb16, 16 - (@idlenb) + 1, (@idlenb) ) + substring(@vb16, 1, 16 -
(@idlenb) )
-- set the new ID value
dbcc object_atts(@p0, 0, "put", @vb16)
print " "
print " Identity value on OAM page has been set to %1!", @p2
print " (hex= %1!)", @vb16
print " "
select @p2 = @p2 + 1
print " You should now do a 'shutdown with nowait' immediately."
print " After restarting the server, the value assigned to the next row "
print " inserted into '%1!' will be %2!.", @p0, @p2
print " "
return 0
end
else
begin
print " Error: Aborted due to error."
return -1
end
end
-- we should never get here
print "Internal error in 'sp_identity': Reached invalid end of procedure."
return -1
end
go
grant execute on sp_identity to public
dump tran sybsystemprocs with truncate_only
go
print "Ready. For usage information, run 'sp_identity ""?"" '."
print ""
go
/*
** end
*/
更多精彩
赞助商链接