Wrox Programmer Forums
|
Forum and Wrox.com Feedback Post your suggestions for improving the Forums or Wrox.com or questions for the staff here. "Where can I find the code for my book?"
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Forum and Wrox.com Feedback section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 31st, 2013, 01:39 AM
Registered User
 
Join Date: Dec 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default primary n foreign key

I have 2 tables job order n estimate.............. job order is a primary key in its table

n estimate table include job order but in estimate table estimate order is the primary key so how estimate table job order can auto generate same as in job order table


CREATE TABLE [dbo].[Job_Order](
[JobNumber] [varchar](30) NOT NULL,
[Department] [nchar](30) NULL,
[Budget] [money] NOT NULL,
[Description] [nchar](200) NULL,
[FilledBy] [nchar](30) NOT NULL,
[Date] [date] NOT NULL,
CONSTRAINT [PK_Job_Order] PRIMARY KEY CLUSTERED
(
[JobNumber] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO


CREATE TABLE [dbo].[Estimate](
[JobNumber] [varchar](30) NOT NULL,
[EstimateNumber] [varchar](30) NOT NULL,
[Description] [varchar](200) NOT NULL,
[Amount] [money] NOT NULL,
[AmountInWords] [varchar](100) NOT NULL,
[date] [date] NOT NULL,
CONSTRAINT [PK_Estimate] PRIMARY KEY CLUSTERED
(
[EstimateNumber] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Design: Foreign Key to Multiple Primary Keys? kalel_4444 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 10 May 8th, 2008 04:14 PM
Foreign key not updating with Primary key xavier1945 BOOK: Access 2003 VBA Programmer's Reference 2 July 4th, 2007 09:48 PM
inserting records with foreign and primary keys tdaustin Classic ASP Basics 0 October 4th, 2005 12:49 AM
FOREIGN KEY and PRIMARY KEY Constraints junemo Oracle 10 June 15th, 2004 01:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.