Tuesday, March 20, 2012

Can't see stored proc results

I have this stored proc:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[usp_CrimRecTest]
-- Add the parameters for the stored procedure here
@.caseID [nvarchar]

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
SELECT dbo.tblCASENOMASTER.CASENO, dbo.tblCASEMAST.LASTNAME, dbo.tblCASEMAST.FRSTNAME
FROM dbo.tblCASENOMASTER LEFT OUTER JOIN
dbo.tblCASEMAST ON dbo.tblCASENOMASTER.CASENO = dbo.tblCASEMAST.CASENO
WHERE (dbo.tblCASENOMASTER.CASENO = @.caseID)
END

When I run this with an EXEC statement, the result pane shows no results but the message pane says it completed successfully and one row is affected. I know my input data is good. I also get nothing when I call this sproc from a VB front end. Any ideas?

Thanks.

What did you mean by --Insert statements for procedure here ? Is there something which you commented out for posting here ? The insert can prdouce x rows affected also as the Select part can. So the insert suceeded with X rows, but the query didn′t bring back any results.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||All comment lines in this post are from the template produced when I created the sproc in SQL Server 2005. The code posted is copied directly from my sproc - nothing deleted, altered or commented out.|||

I found the problem.

@.caseID [nvarchar] was changed to:

@.caseID nvarchar(12)

This ran correctly.

Thanks for your reply Jens.

No comments:

Post a Comment