April 10, 2014 at 3:43 am
Hi
I have these tables:
CREATE TABLE [dbo].[Product](
[ProductID] [int] IDENTITY(1,1) NOT NULL,
[Code] [nvarchar](max) NOT NULL,
[Qty] [int] NULL
)
AND
CREATE TABLE [dbo].[Location](
[LocationID] [int] IDENTITY(1,1) NOT NULL,
[Code] [nvarchar](max) NOT NULL
)
How do I enforce referential integrity and optimize data retrieval as well as storage?
April 10, 2014 at 3:50 am
First fix your data types.
Second, how do those tables relate to one another?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 10, 2014 at 6:06 am
Create a foreign key between the columns that map between the two tables. Here's the documentation on that.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply