infinite loop excution stored procedure

  • Hi guys

    Thanks for your time.,i am facing some problem for infinte loop excution please guide me to reslove this issue

    stored procedure :

    PROCEDURE [dbo].[sp_Blackberrydata]

    AS

    Declare @Count int

    Declare @Insertcount int

    Declare @VendorID int

    Declare @VendorName varchar(225)

    Declare @EmpID varchar(225)

    Declare @Provider varchar(225)

    Declare @Datetime datetime

    Declare @Fname varchar(225)

    select @Datetime=getdate()

    select @Provider='AT&T Mobile'

    select @insertCount = 0

    select @Count = count(FName) from tblAT_TMOBILEPROCESS with(nolock)

    New:

    select @EmpID = EmpID from tblEMPLOYEE with(nolock) where First_Name in (select fname from tblAT_TMOBILEPROCESS)

    select @Fname=First_Name from tblEMPLOYEE with(nolock) where EmpID=@EmpID

    select @VendorID=Vendor_ID from tblVENDORMASTER with(nolock) where Vendor_Name=@Provider

    IF not exists (select * from tblVENDORMASTER with(nolock) where Vendor_Name=@Provider)

    BEGIN

    insert into tblVENDORMASTER(Vendor_Name)values(@Provider)

    END

    insert into tblBLACKBERRY(Vendor_ID,EmpID,FName,LName,WLessNumber,Totalchrge,MAccesschrge,FChrge,Airchrge,Addkbchrge,Msgchrge,EQCharge,LDchrge,RMchrge,otherMisChrge,TaxRegulator,Vediochrge,chrgecredit,Date)

    select @VendorID,@EmpID,FNAME,LNAME,WirelessNumber,totalcurrentcharges,monthlyaccesscharges,fcharges,airtimecharges,AdditionalKBusagescharges,Messaging_charges,Eqcharges,LDCharges,RoamingCharges,OtherMiscellaneousCharges,TaxesSurchargesRegulator,VideoShareCallingUsageCharges,OtherChargesCredits,@Datetime

    from tblAT_TMOBILEPROCESS

    select @insertCount = @insertCount + 1

    if @insertCount < @Count

    begin

    GOTO New

    end

    Thanks

  • The code you posted is simply going to reprocess the same data continously. There is a better way to accomplish what you are attempting to do here. To help we will need more from you, so please read the first article I reference below regarding asking for help.

    We need the DDL (CREATE TABLE statements) for the table involved, sample data for the source tables (as a series of INSERT INTO statements, and NO REAL DATA please), and expected results based on the sample data provided.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply