Solved

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

Posted on 2011-03-03
4
251 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

Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
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
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

691 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