473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Foreign Key Type for "uniqueidentifier"

NeoPa
32,556 Expert Mod 16PB
SQL Server 2000.

It's all in the title really. I have checked in quickbooks and done a quick search but time is critical just now.

I will continue to explore other avenues, but if anyone knows how an FK field should be defined so that it can link into a "uniqueidentifier" GUID field that would be helpful.
Nov 27 '08 #1
7 16167
NeoPa
32,556 Expert Mod 16PB
I did some further searching and I think the answer is that the type is actually the same ("uniqueidentifier"), but the default value and general setup are just done differently (Table ROWGUID not set for instance).

Assuming that to be the case, here's another question :
If I have two tables linked on a field (in this case HdrID - the unique ID of the header record) is it necessary for me to create an index of this field in the Detail record if I already have a Relationship Constraint set up?
Table Name=[tblTHSOPH] (AKA Header)
Expand|Select|Wrap|Line Numbers
  1. Field       Type          IndexInfo
  2. HdrID       uniqueidentifier  PK
  3. Various Header related fields...
Table Name=[tblTHDSOP] (AKA Detail)
Expand|Select|Wrap|Line Numbers
  1. Field       Type          IndexInfo
  2. DtlID       uniqueidentifier  PK
  3. HdrID       uniqueidentifier  FK
  4. Various Detail related fields...
Nov 27 '08 #2
debasisdas
8,127 Expert 4TB
That depends how frequently you use the field in SQL directly. Indexes has negative effect during hugh data loading.
Nov 29 '08 #3
NeoPa
32,556 Expert Mod 16PB
@debasisdas
Thanks Debasis.

I suppose I should have been clearer (although your answer implies yes I do). Does the index need to be specified separately, if you require it to be indexed? Put another way, does the relationship automatically create an index?
Nov 30 '08 #4
debasisdas
8,127 Expert 4TB
Yes the indexes need to be created separately. Specifying the relationship based on PK & FK will not do that automatically for you.
Dec 1 '08 #5
NeoPa
32,556 Expert Mod 16PB
Thanks for that Debasis.

All sorted cheers :)
Dec 1 '08 #6
amitpatel66
2,367 Expert 2GB
Yes the Index needs to be created seperately on the foreign key column ie on the HdrID of Details table.

But Yes an Index gets created automatically when you define a PRIMARY KEY or UNIQUE KEY on any column of a particular table.

Index does not get created automatically for any relationship defined.

Hope this helps!!
Dec 5 '08 #7
NeoPa
32,556 Expert Mod 16PB
@amitpatel66
Yes. Thanks Amit :)
Dec 5 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Jay Chan | last post by:
I keep getting the following error message when I run a serie of SQL commands: Server: Msg 9002, Level 17, State 6, Line 15 The log file for database 'tempdb' is full. Back up the transaction...
17
by: radio1 | last post by:
Configuration: Access 2002 and SQL Server 2000 using a .ADP Project. I would VERY MUCH appreciate anyone's input into this problem I'm having. I have a form in Access that does not permit...
0
by: eduardasm | last post by:
Hello, I have a problem with XML schema update for one XML column (problem exists in both SP1 and SP2 for SQL Server 2005). 1. I have a table that looks like this: CREATE TABLE .( NOT NULL...
6
by: ewpatton | last post by:
Good day, I've been trying to work with SQL and an Access database in order to handle custom user profiles. I haven't had any trouble reading from my database, but inserting new entries into...
3
by: blazeboy | last post by:
Hello, I am using a SQL data source to insert records into a table. The table uses a GUID as the primary key (GoalEventID), and a GUID for a second field (GoalID) as a foreign key. When I call...
0
by: dan | last post by:
Hi, I've been using a GridView for some time but this is the first time I need to delete a row in the grid whose primary key consists of 2 fields (table columns). I have a table with primary...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.