Solved

I want to crate a composite primary key on my table....

Posted on 2011-03-03
4
242 Views
Last Modified: 2012-05-11
I want to crate a composite primary key on my table....

My only concern is that one of the columns in the composite is DATETIME.

Is this going to have a negative effect?

I am using SQL 2005/8
0
Comment
Question by:Mr_Shaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Aaron Shilo
ID: 35027488
no it wont.
but are you sure that you wont have PK vaulations ?
are you going to use this PK for filters in queries ? :

select* from my table
where col1 = 'abc'
and col2 = '2011-05-05 12:32 PM'

0
 

Author Comment

by:Mr_Shaw
ID: 35027506
Yes the primary key will be used in the WHERE cluase.
0
 
LVL 15

Accepted Solution

by:
Aaron Shilo earned 500 total points
ID: 35027582
well it wouldent be very "NICE" but you sould have no problem using datetime as a part of your PK
its no different then using any other datatype.
0
 

Author Closing Comment

by:Mr_Shaw
ID: 35027871
THANKS
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question