473,692 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Guid as primary key

When using a Guid as your primary key in a table, does it make
sense to make it a clustered index?

Thanks,
Rick
Jul 20 '05 #1
1 3288
Depends on how the table is used. But if you do and if you are retrieving
many records at a time by PK and there is a good chance that those records
were created at the same time (for example an order details table), you may
want to generate the GUIDs using the 'old' GUID generation function
UuidCreateSeque ntial.

http://msdn.microsoft.com/library/de...sequential.asp
"Rick" <ri**@abasoftwa re.com> wrote in message
news:28******** *************** ***@posting.goo gle.com...
When using a Guid as your primary key in a table, does it make
sense to make it a clustered index?

Thanks,
Rick

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
10877
by: Ilija_G | last post by:
Hi, Is there any replace for "Select @@identity" that could return "just inserted" GUID as a primary key? Has anyone tested what's faster, working with Guid or Autonumber ?
3
630
by: Robert Chapman | last post by:
I know that this should be impossible, yet it is happening... I have some c# code that uses a method scoped variable of type Guid. The code assigns Guid.NewGuid() to the variable. This value is then used as a primary key in a database table. I have seen two occasions over the last 6 months where after a certain point in time the same Guid is always generated by the code. I have verified that there is nothing static, the code is...
1
5822
by: Leon | last post by:
Hi, I have SQL DB table with a GUID Primary key. i used the C# data form wizard to create a data form (though has a typed dataset) with a Grid (the GUID column is not shown on the grid). when the user adds a new row at the end of rows in the grid (, types data in) and moves to another row the error message appears: "primary key cant be null". what should i do to make the system generate a new GUID for the primary key column in the newly...
1
2496
by: Omer kamal | last post by:
When in database(.mdb) the primary key have fields size type "Replication ID" it creates Guid. I tried to create string of Guid and insert it but did it not work. Control.databindings.add(), Method for this field is only working one way that,it is not saving back the data into table. I wonder if there is some way so it creat automatic Guid when I add new field?
4
1392
by: Grey | last post by:
I used .NET to generate a GUID for creating a new record in Access DB as primary key. Is it guaratee to be unique in the DB as the GUID is not generate in DB?? If so, is that mean GUID is generated based on machine instead of application, right?? Million Thanks
12
1492
by: Geoff Jones | last post by:
Hi How do I set a primary key to be a GUID? That is, using the following code, I can set an integer primary key, but how do I change it to a GUID? Dim databaseCommand As OleDbCommand = New OleDbCommand("CREATE TABLE books (" ID INT IDENTITY, Book VARCHAR(50), CONSTRAINT PRIMARY KEY (ID))", myDatabaseConnection)
14
6560
by: Roy | last post by:
Is there an equivalent class function in C# to generate sequencial guid just like the NewSequentialID() function in SQL Server 2005?
8
19003
by: Leon_Amirreza | last post by:
I have a column named "ID" and its type is "uniqueidentifier" in SQL Server 2005 Express. this column is the primary key and its default value is "newid()" in SQL Server. I have generated a DataSet in C# that has this column but its default value is DBNull what can I do to make the default value be the return value of this function ( or I want the Id be generated by default in the DataSet)? System.Guid.NewGuid()
1
5719
by: Jeff | last post by:
ASP.NET 2.0 This problem occur using the basic version of SQL Server 2005 which get installed when installing Visual Studio 2005! I have inserted a record in the Test table. But when I try to insert a second record I get this error: {"Violation of PRIMARY KEY constraint 'PK_Test'. Cannot insert duplicate key in object 'dbo.Test'.
4
5517
by: Marc | last post by:
Hi, I don't get it I cannot get this to work, can somebody give me a hint Table1 contains a field Id which is a GUID as primary key and DATA a string, I want to insert a new row but it does not work. void gv_RowCommand(Object sender, GridViewCommandEventArgs e) { ClientScript.RegisterStartupScript(GetType(), "MyAlert2", "alert('Command=" + e.CommandName + "');", true); if (e.CommandName == "New")
0
9090
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8968
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8810
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8810
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6462
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4325
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2977
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2242
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1961
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.