• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

See output of executing a stored procedure via Query Analyzer ?

If I execute the following Stored Procedure via the SQL Query Analyzer, I get the following 1 line message:

The command(s) completed successfully.
---------------------------------------------------
Is there a way I can see the result set when I execute this Stored Procedure (via Execute Query button or hitting the F5 key).

ALTER PROCEDURE dbo.procFlACS

@RptYear int = 2005
AS

DECLARE @DateFI AS DATETIME
DECLARE @DateMF AS DATETIME
DECLARE @DateC AS DATETIME
DECLARE @DateE AS DATETIME
DECLARE @DateI AS DATETIME

SELECT @DateFI = CAST((@RptYear - tblStatesAll.BondsFS) AS VARCHAR) + '-06-30' from tblStatesAll
SELECT @DateMF = CAST((@RptYear - tblStatesAll.MutualFS) AS VARCHAR) + '-06-30' from tblStatesAll
SELECT @DateC = CAST((@RptYear - tblStatesAll.CashFS) AS VARCHAR) + '-06-30' from tblStatesAll
SELECT @DateE = CAST((@RptYear - tblStatesAll.StocksFS) AS VARCHAR) + '-06-30' from tblStatesAll
SELECT @DateI = CAST(((@RptYear - tblStatesAll.IRAFS)+71) AS VARCHAR) + '-12-31' from tblStatesAll

SELECT Null AS Title, UPPER(tblCustomers.FirstName) AS [First Name], UPPER(tblCustomers.MiddleInitial) AS [MI],
UPPER(tblCustomers.LastName) AS [Last Name], UPPER(tblCustomers.SecondNameFirst) AS [Second Name First],
UPPER(tblCustomers.SecondNameMid) AS [Second Name Mid], UPPER(tblCustomers.SecondNameLast) AS [Second Name Last],
Null AS Relation, UPPER(tblCustomers.Address1) AS [Address 1], UPPER (tblCustomers.Address2) AS [Address 2],
UPPER(tblCustomers.Address3) AS [Address 3], UPPER(tblCustomers.Address4) AS [Address 4], UPPER(tblCustomers.City) AS City,
UPPER(tblCustomers.State) AS State, tblCustomers.Zip AS Zip, tblCustomers.SSN, Null AS [DDA Number], Null AS [Check/Cert Number],
tblProducts.CUSIP, tblProducts.SecurityName AS [Security Name], Null AS [Sub-Issue],
Right(tblCustomers.OfficeNumber,3) + ' ' + tblCustomers.CustomerNumber AS [Account Number],
tblProducts.PropertyType AS [Property Type], Null AS [Property Status],
CASE WHEN tblProducts.CashBalance IS NULL THEN tblProducts.Quantity ELSE tblProducts.CashBalance END AS [Check/Cert Amount]
 
FROM tblStatesAll INNER JOIN (tblCustomers INNER JOIN tblProducts ON tblCustomers.CustomerNumber = tblProducts.CustomerNumber)
ON tblStatesAll.StateFS = tblCustomers.State
WHERE (tblProducts.PropertyType='OTHER' AND tblCustomers.DateLost <= @DateMF AND tblStatesAll.FallCycle= '1'  AND LEN(tblProducts.IRACode) = 0) OR  
               (tblProducts.PropertyType='MUTUAL FUND' AND tblCustomers.DateLost <= @DateMF AND tblStatesAll.FallCycle= '1'  AND LEN(tblProducts.IRACode) = 0) OR
               (tblProducts.PropertyType='CASH' AND tblCustomers.DateLost <= @DateC AND tblStatesAll.FallCycle= '1'  AND LEN(tblProducts.IRACode) = 0) OR
               (tblProducts.PropertyType='EQUITY' AND tblCustomers.DateLost <= @DateE AND tblStatesAll.FallCycle= '1'  AND LEN(tblProducts.IRACode) = 0) OR
               (tblProducts.PropertyType='FIXED INCOME' AND tblCustomers.DateLost <= @DateFI AND tblStatesAll.FallCycle= '1'  AND LEN(tblProducts.IRACode) = 0) OR
               (tblCustomers.DateOfBirth <= @DateI AND tblStatesAll.FallCycle= '1'  AND LEN(tblProducts.IRACode) > 0) OR
               (LEN(tblCustomers.DateOfBirth) = 0 AND tblStatesAll.FallCycle= '1' )
ORDER BY tblCustomers.State
GO
0
zimmer9
Asked:
zimmer9
1 Solution
 
rafranciscoCommented:
Alter procedure will only alter your stored procedure.  You have to execute it like this:

EXEC dbo.procFlACS 2005
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now