Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem using SQL Stored Procedures

Status
Not open for further replies.

dorupirvu

Programmer
Jan 10, 2002
3
CA
I have the following stored procedure:

CREATE PROCEDURE spTest
AS
DECLARE @var1 as INT
Select @var1 = 12
SELECT UserID, Name from Users
GO

If I execute this stored procedure using “SQL Query Analyzer” everything seems to be OK (I’ll obtain the fields: UserdId, Name and var1), but if I try to make an report (with Crystal Reports) using this stored procedure, I’ll have available only the UserdId, Name fields (without “var1”). I could have this field (“var1”) available in my report whether “spTest” will be as:

CREATE PROCEDURE spTest
AS
DECLARE @var1 as INT
Select @var1 = 12
SELECT “Field1” = @var1, UserID, Name from Users
GO

Is there another solution for this problem (I mean to have available in my report the “var1” field also) ?

Any idea will be appreciated.

Best regards,
Doru
 
If you want to put @var1 in your report do this in your stored procedure.

@var1 as field1

This will allow crystal to see that field and pass it to the report. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top