myLittleTools Community Forum

Welcome Guest Search | Active Topics | Members | Log In | Register

Code works in SP but not in Query-Submit page? Options · View
jastewart
Posted: Thursday, September 27, 2007 4:21:37 PM
Rank: Newbie
Groups: Member

Joined: 9/27/2007
Posts: 1
Points: 0
Location: UK
When run in the "new query" box, the code given returns no results, and no errors but when simply wrapped in an SP (called 'x' ) and run using:

exec x

all is fine! How come? What are the limitations of the "new query" box and the submit button?

TIA

James.


Here is the code (familiar from Query Analyser)
--
DECLARE @RC int
DECLARE @accessibleClinicCodes varchar(7000)
DECLARE @startDate datetime
DECLARE @endDate datetime
DECLARE @healthBoardCode varchar(50)
DECLARE @clinicCode varchar(50)
DECLARE @clinicLocationId uniqueidentifier
DECLARE @gpPracticeId uniqueidentifier
DECLARE @advisorId uniqueidentifier
SELECT @accessibleClinicCodes = 'J101'
SELECT @startDate = NULL
SELECT @endDate = NULL
SELECT @healthBoardCode = NULL
SELECT @clinicCode = NULL
SELECT @clinicLocationId = NULL
SELECT @gpPracticeId = NULL
SELECT @advisorId = NULL
EXEC @RC = [Smoking].[dbo].[extract_MinimumDatasetFilteredOptimised] @accessibleClinicCodes, @startDate, @endDate, @healthBoardCode, @clinicCode, @clinicLocationId, @gpPracticeId, @advisorId
DECLARE @PrnLine nvarchar(4000)
PRINT 'Stored Procedure: Smoking.dbo.extract_MinimumDatasetFilteredOptimised'
SELECT @PrnLine = ' Return Code = ' + CONVERT(nvarchar, @RC)
PRINT @PrnLine
--
elian
Posted: Thursday, September 27, 2007 4:29:43 PM

Rank: Administration
Groups: Administration

Joined: 9/11/2006
Posts: 605
Points: 649
Location: Enghien Les Bains, France
I just run your T-SQL code, replacing line
Code:
EXEC @RC = [Smoking].[dbo].[extract_MinimumDatasetFilteredOptimised] @accessibleClinicCodes, @startDate, @endDate, @healthBoardCode, @clinicCode, @clinicLocationId, @gpPracticeId, @advisorId

by
Code:
SELECT @RC = 1

as i do not have your extract_MinimumDatasetFilteredOptimised sp.

It worked fine.
I got nothing in the Results tab and i got
Quote:
Stored Procedure: Smoking.dbo.extract_MinimumDatasetFilteredOptimised
Return Code = 1

in the Messages tab
which seems to be a normal behavior...
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Theme created by myLittleTools
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.