OK, here is the code, and some data:
/*Create Maximum ID table for getting IDS*/
CREATE TABLE MaxID (
MaxID int
)
/*Create Fact data table*/
CREATE TABLE FactData (
ID int NULL,
Name varchar(50) NULL
)
/*Insert some random maximum ID value*/
INSERT INTO MaxID VALUES (3423)
/*Insert fact values*/
INSERT INTO FactData VALUES (NULL,'Bob')
INSERT INTO FactData VALUES (NULL,'Dan')
INSERT INTO FactData VALUES (NULL,'Jane')
/*Insert more code here to give FactData id values. End result should
be that one row should be 3423, one should be
3424, one should be 3425. Doesn't matter which row is which, as long as
they have IDs*/
Thanks,
Kayda
[quoted text, click to view] Dave Markle wrote:
> Kayda -
>
> Please post the definition of your table to the newsgroups (the CREATE
> TABLE statements).
>
> -Dave
>
> Kayda wrote:
> > Hi there:
> >
> > What is the most efficient way to apply a unique ID to a table through
> > SQL? I'm working in a SQL Server 2000 DTS package--I have a table that
> > has unique rows but has a null UniqueID field, and I have another table
> > that stored the MaximumLast ID from the master table. I am currently
> > using a WHILE loop but it takes forever.
> >
> > Thanks!
> >
> > Kayda
> >