Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Stored Procedure is not responding, i am executing but does nothign and donot execute Expand / Collapse
Author
Message
Posted Thursday, July 4, 2013 5:20 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, April 9, 2014 1:40 PM
Points: 39, Visits: 146

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
Post #1470534
Posted Thursday, July 4, 2013 10:42 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 12:18 AM
Points: 1,213, Visits: 1,683
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
Post #1470552
Posted Friday, July 5, 2013 6:05 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, April 9, 2014 1:40 PM
Points: 39, Visits: 146
Thanks
Post #1470688
Posted Friday, July 5, 2013 6:25 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, September 12, 2014 9:43 AM
Points: 7,284, Visits: 13,824
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


“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
Exploring Recursive CTEs by Example Dwain Camps
Post #1470695
Posted Friday, July 5, 2013 7:09 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, September 12, 2014 9:10 AM
Points: 2,848, Visits: 5,092
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...




I do also love NHS!




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

How to post your question to get the best and quick help
Post #1470723
Posted Friday, July 5, 2013 7:45 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, September 12, 2014 9:43 AM
Points: 7,284, Visits: 13,824
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...




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
Exploring Recursive CTEs by Example Dwain Camps
Post #1470738
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse