Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Row ID

Author  Topic 

Jim Beam
Posting Yak Master

137 Posts

Posted - 2010-12-21 : 14:09:26
Hi all,

Typically, in what kinds of scenarios would you need to reference rows by their RowID's? Any pro's/cons? I've seen instances of people doing it here but never known the business reasons for it.

Cheers,

Jim


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-21 : 14:25:29
Do you mean an identity column? Maybe you are asking about the ROW_NUMBER() function? Please elaborate.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

SparkByte
Yak Posting Veteran

60 Posts

Posted - 2010-12-21 : 16:12:51
I think he may be asking about RowGUID.

[RowGUID] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_tblEmployee_RowGUID] DEFAULT (newid()),

One reason and the reason I am changing a database to support them is for merging several remote sites into a central copy(for reporting)


Thank You,

John
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-21 : 16:45:31
You should be aware of the performance penalties of GUIDs then: http://www.sqlskills.com/BLOGS/KIMBERLY/post/Disk-space-is-cheap.aspx

You can still use an identity column with several remote sites, just need to seed them properly.



Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Jim Beam
Posting Yak Master

137 Posts

Posted - 2010-12-23 : 10:26:03
I'm really not sure to be honest about the difference between the ID column and RowGuid, this is one of those times when I wish I'd actually finished the old SQL Server 2000 Design + Implementation course!!

I've spent so much time on Prod issues I've never gotten around to a refresh of the Dev basics. Probably need a beginners guide article about how SS2K5 identifies each row, as well as the pro's and con's of how best (and when) to query by row(gu)id. I know about PK's of course but outside of that it's all a dim memory...
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-12-23 : 11:02:59
If you use an IDENTITY column in each of the remote sites you can still uniquely identify a record by using a combination of that ID and a SiteID (or something similar). You could even surrogate that into a single identity in your central location if it makes sense. But, at least a 2 column key will work well.
Go to Top of Page
   

- Advertisement -