Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

have problem with stored procedure

$
0
0

Basically, I would like to retrieve the SES10 from the table dbo.ses2010_blk$ when it matches both the input parameters of census2010 and the blkgrp. 

I wrote this stored procedure and it executed sucessfully:

ALTER PROCEDURE [dbo].[Ses2010]
  @census2010  varchar(6),
  @blkgrp      varchar(4),
  @ses10       varchar(1)   out
AS

BEGIN

--  SET NOCOUNT ON
--  SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

  SELECT @ses10 = SES
  FROM dbo.ses2010_blk$
  WHERE CT2010 = @CENSUS2010
    AND substring(blkgrp,1,1) = substring(@BLKGRP,1,1)

END

However, when I tried to use the procedure to get the output of SES10, I am having this error:

cannot find either column "dbo" or the user-defined function or aggregate "dbo.ses219", or the name is ambiguous.

SELECT t.Patient_ID, t.Tumor_ID, t.CensusTract2010, t.CensusBlock2010, t.Date_DX, t.County_DX,

dbo.ses2010(t.CensusTract2010, t.CensusBlock2010) AS SES10
FROM     Eureka.dbo.tblTumor AS t RIGHT OUTER JOIN
                  dbo.ses2010_blk$ AS s ON t.CensusTract2010 = s.CT2010 AND SUBSTRING(s.BLKGRP, 1, 1) = SUBSTRING(t.CensusBlock2010, 1, 1) AND t.Year_DX = '2011'
WHERE  (NOT (t.Patient_ID IS NULL)) AND (NOT (t.Tumor_ID IS NULL))

Please advise what is wrong of this statement.

Thank you very much for your advice.

Sincerely,

Sally


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>