?
Solved

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

Posted on 2011-03-03
4
Medium Priority
?
257 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 2000 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to shrink a transaction log file down to a reasonable size.
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.

765 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