Solved

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

Posted on 2011-03-03
4
209 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
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Aaron Shilo
Comment Utility
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
Comment Utility
Yes the primary key will be used in the WHERE cluase.
0
 
LVL 15

Accepted Solution

by:
Aaron Shilo earned 500 total points
Comment Utility
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
Comment Utility
THANKS
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now