On Wed, Sep 21, 2011 at 7:37 AM, Ajoy Khaund <[email protected]> wrote:
> Hi,
>
> I have a composite key in VFP like
>
> Padl(empno,4,'0') + DTOS(kdate) + Str(shiftno,1)
>
> I use this index to do a seek to find out if a record exists for a particular
> employee on a particular date in a particular shift.
>
> How can I do that in sql. I am going to use cursor adaptors.
>
-------------
Do you know how to create indexs in SQL Server tables that span
multiple columns?
CREATE UNIQUE NONCLUSTERED INDEX newKey ON YourTable
(
empNumber,
kDate,
shiftNo
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
In your where clause :
Where empNumber = YourmakeshiftValue
and kDatebetween StartOfDay and EndOfDay
and shftno = 1
As a heads up. This index may never get used if the table is joined
so all of this is mute.
--
Stephen Russell
Unified Health Services
60 Germantown Court
Suite 220
Cordova, TN 38018
Telephone: 888.510.2667
901.246-0159 cell
_______________________________________________
Post Messages to: [email protected]
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/cajidmy+lr4iahdruzbhv4n25zbgqaqer4y_rupipec8t-9q...@mail.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.