Stored Procedure is not responding, i am executing but does nothign and donot execute

  • I am getting error message when i run SP at the bottom

    Error Msg:

    Msg 2714, Level 16, State 3, Procedure NIC_OA_GetPhysicianXRayReportsOut, Line 119

    There is already an object named 'NIC_OA_GetPhysicianXRayReportsOut' in the database

    /****** Object: StoredProcedure [dbo].[NIC_OA_GetPatientXRayReportsOut] Script Date: 03/27/2012 18:18:31 ******/

    IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NIC_OA_GetPatientXRayReportsOut]') AND type in (N'P', N'PC'))

    DROP PROCEDURE [dbo].[NIC_OA_GetPatientXRayReportsOut]

    GO

    /****** Object: StoredProcedure [dbo].[NIC_OA_GetPatientXRayReportsOut] Script Date: 03/27/2012 18:18:31 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    '

    '

    ' Execution Samples: NIC_OA_GetPhysicianXRayReportsOut @lPhysician

    ' NIC_OA_GetPhysicianXRayReportsOut 70

    '

    '

    ' REVISION HISTORY

    '

    ' Date Developer Comments

    ' _________ __________________ _____________________________________________

    '

    '******************************************************************************/

    create PROCEDURE [dbo].[NIC_OA_GetPhysicianXRayReportsOut] @lPhysician INT,

    @Page INT=1,

    @RecsPerPage INT=50

    AS

    SET TRANSACTION ISOLATION LEVEL READ COMMITTED

    SET NOCOUNT ON

    CREATE TABLE #TempItems

    (

    ID INT IDENTITY,

    lID INT NOT NULL

    )

    INSERT INTO #TempItems

    (lID)

    --SELECT lID FROM tblItem

    SELECT a.lid

    FROM [PhysicianXRayRequisitions] a

    INNER JOIN [Map_XRayRequisitionToProgressNote] b

    ON a.lID = b.lXRayRequisition

    INNER JOIN [ProgressNote] c

    ON c.lID = b.lProgressNote

    INNER JOIN patient d

    ON c.lPatient = d.lID

    WHERE a.lPhysician = @lPhysician

    AND a.nRecordStatus = 1

    AND a.bReportReceived = 0

    AND a.bReportRemoved = 0

    AND a.szLastPrintedBy IS NOT NULL

    ORDER BY a.dDateOrdered ASC

    -- Find out the first and last record we want

    DECLARE @FirstRec INT,

    @LastRec INT

    SELECT @FirstRec = ( @Page - 1 ) * @RecsPerPage

    SELECT @LastRec = ( @Page * @RecsPerPage + 1 )

    SELECT Isnull(b.szLaboratory, 'non selected') AS szLaboratory,

    a.lID,

    a.bDiagnosticMammogram,

    a.bScreeningMammogram,

    a.dDateOrdered,

    a.dCheckForReport,

    p.szLast,

    p.szFirst,

    a.lPhysician,

    p.szFirst AS szPhysicianFirst,

    p.szLast AS szPhysicianLast,

    szLastPrintedBy,

    pat.szFirst AS szPatFirst,

    pat.szLast AS szPatLast,

    pat.lid AS lPatient,

    Rtrim(Isnull(DIform.szFileName, '')) AS szDIFormFileName,

    a.lDIform_data,

    DIform_data.lDIform,

    a.szListRequisition_FreeForm,

    Isnull(f.FormLiteFormID, 0) AS FormLiteFormID,

    f.FormLiteSnapshotID,

    TotalRecords = (SELECT Count(*) FROM #TempItems TI)

    FROM #TempItems

    Inner join [PhysicianXrayRequisitions] a

    ON a.lid = #TempItems.lID

    LEFT JOIN [Laboratory] b

    ON b.lID = a.lLaboratory

    LEFT JOIN FormLiteSnapshotMap f

    ON a.lid = f.lPhysicianXRayRequisitions

    INNER JOIN [Map_XRayRequisitionToProgressNote] c

    ON c.lXRayRequisition = a.lID

    INNER JOIN [ProgressNote] d

    ON c.lProgressNote = d.lID

    INNER JOIN [Patient] pat

    ON d.lPatient = pat.lID

    INNER JOIN [Physician] p

    ON p.lid = a.lPhysician

    LEFT JOIN DIform_data

    ON DIform_data.lid = a.lDIform_data

    LEFT JOIN DIform

    ON DIform.lid = DIform_data.lDIform

    WHERE #TempItems.ID > @FirstRec

    AND #TempItems.ID < @LastRec

    ORDER BY #TempItems.ID

    SET NOCOUNT OFF

  • The DROP procedure statement refers to a different procedure:

    DROP PROCEDURE [dbo].[NIC_OA_GetPatientXRayReportsOut]

    create PROCEDURE [dbo].[NIC_OA_GetPhysicianXRayReportsOut]

    One is PatientXray, the other is PhysicianXray, change DROP statement to:

    IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NIC_OA_GetPhysicianXRayReportsOut]') AND type in (N'P', N'PC'))

    DROP PROCEDURE [dbo].[NIC_OA_GetPhysicianXRayReportsOut]

    GO

  • Thanks

  • Andrew G (7/4/2013)


    The DROP procedure statement refers to a different procedure:

    DROP PROCEDURE [dbo].[NIC_OA_GetPatientXRayReportsOut]

    create PROCEDURE [dbo].[NIC_OA_GetPhysicianXRayReportsOut]

    One is PatientXray, the other is PhysicianXray, change DROP statement to:

    IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NIC_OA_GetPhysicianXRayReportsOut]') AND type in (N'P', N'PC'))

    DROP PROCEDURE [dbo].[NIC_OA_GetPhysicianXRayReportsOut]

    GO

    Don't you just love the NHS :w00t:

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • I wonder, do NHS operating surgeons ask questions on innet forums while inside of someone body?

    OP:

    Hi guys, I've just cut the man and I'm not sure what to do with a small red wire which I've unexpectedly found inside, can someone help! It's pretty urgent...

    R:

    Ough, is it a homework you're doing?

    OP:

    No, I'm working in hospital, consultant is not available and I've been asked to fix the man.

    R:

    Ok, we will be glad to help you, But we need some more details from you, can you read "forum etiquete article" which will help you to post what we need so we can promptly assist you

    OP:

    No, I'm too busy to read articles, I'm operating right now. I just can see the red wire here and I need your help to fix the man.

    R:

    Sorry, but in order to help we need a bit more details from you. Please post the picture of his "inside", analyses results allong with current reading of his blood pressure and heart rate. Also, could you please state exact expected results of the operation you are doing.

    OP:

    I thought I will get a help on this NHSSurgeryCentral forum, and not questions which I cannot even understand. I will try to google it out somewhere else! Thanks...

    :w00t::hehe::w00t:

    I do also love NHS!

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Eugene Elutin (7/5/2013)


    I wonder, do NHS operating surgeons ask questions on innet forums while inside of someone body?

    OP:

    Hi guys, I've just cut the man and I'm not sure what to do with a small red wire which I've unexpectedly found inside, can someone help! It's pretty urgent...

    R:

    Ough, is it a homework you're doing?

    OP:

    No, I'm working in hospital, consultant is not available and I've been asked to fix the man.

    R:

    Ok, we will be glad to help you, But we need some more details from you, can you read "forum etiquete article" which will help you to post what we need so we can promptly assist you

    OP:

    No, I'm too busy to read articles, I'm operating right now. I just can see the red wire here and I need your help to fix the man.

    R:

    Sorry, but in order to help we need a bit more details from you. Please post the picture of his "inside", analyses results allong with current reading of his blood pressure and heart rate. Also, could you please state exact expected results of the operation you are doing.

    OP:

    I thought I will get a help on this NHSSurgeryCentral forum, and not questions which I cannot even understand. I will try to google it out somewhere else! Thanks...

    :w00t::hehe::w00t:

    I do also love NHS!

    LOL! Brilliant, Eugene!

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

Viewing 6 posts - 1 through 5 (of 5 total)

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