ExamNotes.net  -  IT certification portal

ForumsCertResearchTop sitesNewslettersFree email
HomeRegister
Exams Notes
Practice exams
Exam games
Questions by email
Online training
Training videos
College degrees
Boot camps
Book store
Links directory
Tell a friend
For webmasters

CompTIA Exam Vouchers
Save money on CompTIA exams
Question of the day
Sign up to receive
interactive practice questions
for MCSE, CompTIA
Cisco and other exams
TestKing
Get MCSE, MCSD, CCNA, CCNP,A+, N+ and many more

* ExamSheets *
Guide for Success!
Actual Questions & Answers
MCSE, MCSD, A+ ,CCNA, CCNP
Oracle 8i, Oracle 9i

Online practice tests

Certification sites

Online university

Online college

Online education

Distance learning

Software forum

Server administration forum

Programming resources






This is interesting: Free IT Magazines | Databases help forum



General discussions > Public newsgroups > microsoft.public.sqlserver.server > Re: Getting correct sequence numbers in a table. (Correction)

Show a Printable Version
Email This Page to Someone!
Receive updates to this thread






Author Re: Getting correct sequence numbers in a table. (Correction)
Steve Kass
Guest




Registered: Not Yet
Location:
Country:
State:
Certifications:
Working on:

Total Posts: N/A
Re: Getting correct sequence numbers in a table. (Correction)

Oops, I think I misread what you want - it's actually simpler:

declare @count int
set @count = 0
update T
set @count = Seq_id = @count + 1
go

Steve

Ben Brugman wrote:

> This is partly a repeat.
>
> We had (it is solved now) a problem. During solving it I tried some
> constructions which did not work. In the end the problem was solved
> using a Delphi program with an ADO interface. This took about 2
> hours to run which was acceptable in our situation.
>
> My problem (partly psycological) ;
> I wasn't able to solve the problem within the given time frame using
> only tools supplied with SQL-server !
>
> The problem.
> An imported table with 3.6 millions rows, about 20 fields, 6 indexes
> and quite some relations with other tables.
> Three important fields where
> Object_id OID
> Seq_id S_ID
> date D
>
> OID and D together form a unique key. S_ID should be in the order
> of the date. But during transport and import this order was not
> kept correctly. So the S_ID had to be 'renumbered', with a specific
> range.
>
> The end solution was the Delphi program running over all OID, doing a
> SELECT on each OID with an ORDER on date and UPDATE the S_ID with a
> number then increase the number with one and continue.
> (The Delphi program was an adaptation from an existing program and
> took only minutes to build).
>
> My Question is :
> How to solve this kind of problem with only SQL-server tools ?
> Especially on larger tables. (millions or tens of millions of
> records).
>
> I tried to cluster the table in the correct order (OID,D), and
> make the S_ID an identity key starting with a correct seed
> for the range. (Tried this on a small table.) Problems it
> took too long, and the S_ID didn't get changed. From experience
> I know that the identity key does not always get created in
> the order of which the table is clustered. As said because
> of the time pressure with did the Delphi solution.
>
> Thanks in advance
>
> Ben Brugman


Report this post to a moderator

Old Post 06-28-02 01:25 PM
Reply w/Quote Edit/Delete Message IP: Logged
All times are GMT.
Post new thread   Post reply

Featured site: MCSE, MCSD, CompTIA, CCNA training videos



Forum Jump:
Rate This Thread:
Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is OFF.
 

ExamNotes forum archive


Powered by: vBulletin 2.2.8
Copyright ©2000, Jelsoft Enterprises Limited.

  Free Braindumps | mcse braindumps