-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Prem720
Message 11 in Discussion
Hi Group,
I am having a small problem in the UDF. My UDF looks
like this
CREATE FUNCTION UDF_ContractSearch
(
@contractid int = null,
@employer int = null
)
RETURNS @retContracts TABLE
( IDX int IDENTITY(1,1) PRIMARY KEY CLUSTERED,
ContractId int,
Employer int,
MaxCnt int
)
AS
BEGIN
Declare @maxCnt int
select @maxCnt=Count(*)
from Contract
Where (ContractId=rtrim(@ContractId)
or Isnull(@ContractId, -1) = -1 )
and
(Employer=rtrim(@Employer) or Isnull(@Employer, -1) = -1 )
INSERT INTO @retContracts
select ContractId,Employer,@MaxCnt
from Contract
Where (ContractId=rtrim(@ContractId)
or Isnull(@ContractId, -1)=-1 )
and
(Employer=rtrim(@Employer) or Isnull(@Employer, -1)=-1 )
RETURN
END
If I execute the above UDF function, IDX column is
not in proper order. Since it is an identity field, I am expecting
the IDX will be in sequence. But in this case, after
some records, the IDX is not in order. For ex: If the Select statements
has given 20000 records, up to some 800 records, the
IDX is in sequence, but after that it will give 15000, somewhere down the
line I will be having 801. Because of this behavior
my logic is giving problem. Any help on this will be very helpful
Regards
Premchand
____________________________________________
Confidential: This electronic message and all contents contain information
from Syntel, Inc. which may be privileged, confidential or otherwise
protected from disclosure. The information is intended to be for the
addressee only. If you are not the addressee, any disclosure, copy,
distribution or use of the contents of this message is prohibited. If you
have received this electronic message in error, please notify the sender
immediately and destroy the original message and all copies.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]