RE: Composite Key in Sql Server 2008

Author: Grigore Dolghin

Posted: 2011-09-21 at 17:45:37

Hey, Stephen

Are you sure the indexes won't be used in the WHERE clause I posted? Why it

would do a tablescan?

-----Original Message-----

From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On

Behalf Of Stephen Russell

Sent: Wednesday, September 21, 2011 5:24 PM

To: profoxtech@leafe.com

Subject: Re: Composite Key in Sql Server 2008

On Wed, Sep 21, 2011 at 8:22 AM, Grigore Dolghin <gdolghin@gmail.com> wrote:

> I would create three indexes, one for each column, and use a WHERE

> clause in SELECT, similar to this one:

>

> WHERE empno = ?m.empno AND kdate = ?m.kdate AND shiftno = ?m.shiftno

Those 3 indexes would never be considered for use in SQL Server. It will do

a tablescan all the time.

If the user sees empno as 12334 but the data has it as 0001324 you will have

to append the "0" but I am sure you know that.

Dates in SQL Server are to the second, so [SQLServer] getdate() <>

date() [VFP] All of your dates coming from VFP may be set to midnight?

That would be great for now but you will get burned sooner or later on it.

Always use a between in date searches

--

Stephen Russell

Unified Health Services

60 Germantown Court

Suite 220

Cordova, TN 38018

Telephone: 888.510.2667

901.246-0159 cell

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/001b01cc78a7$cdbcdd40$693697c0$@gmail.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Grigore Dolghin