Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to view a print statement with this SP

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2007-04-08 : 06:28:37
Please help, is it possible to get the print statement for this Stored Proc. I want to check what is wrong witht his SP. i just added the selectcase: have i done it correctly or not.

I just want to check when progid=0, please help.

*********************
ALTER PROCEDURE [dbo].[USP_GetRptAllProjectsByModule]
@UserName nvarchar(50),
@ModuleType nvarchar(50),
@ProgID int
AS

DECLARE @ErrorCode int
DECLARE @SQLSelect nvarchar(200)

SET NOCOUNT ON
SELECT @ErrorCode = @@Error
IF @ErrorCode = 0
SELECT @SQLSelect =
CASE @ModuleType
WHEN 'All' THEN ''
ELSE ' AND B.ccsNetModule = @ModuleType'
END
BEGIN
-- get all projects this user is authorized to see
IF @ProgID = 0
BEGIN
SELECT distinct (A.ProjID) as ProjID, A.ProjNO, A.ProjName FROM TAB_ccsNetProjects AS A join TAB_ccsNetUserAccess AS B ON
(A.ProjID = B.ProjID)
WHERE B.UserName = @UserName and A.Deleted = '0' and B.Deleted = '0' + @SQLSelect
SELECT @ErrorCode = @@Error
END
ELSE
BEGIN
SELECT distinct (A.ProjID) as ProjID, A.ProjNO, A.ProjName FROM TAB_ccsNetProjects AS A join TAB_ccsNetUserAccess AS B ON
(A.ProjID = B.ProjID)
WHERE B.UserName = @UserName AND A.ProgID = @ProgID AND A.Deleted = '0' AND B.Deleted = '0' + @SQLSelect
SELECT @ErrorCode = @@Error
END
END
SET NOCOUNT OFF
RETURN @ErrorCode

*******************************************

Thank you very much for the info.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-08 : 09:13:04
DECLARE @SQLSelect nvarchar(2000)
Why, why, why do you need to work with dyanmic sql?

www.sommarskog.se/dynamic_sql.html


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-10 : 06:48:00
quote:
Originally posted by Peso

DECLARE @SQLSelect nvarchar(2000)
Why, why, why do you need to work with dyanmic sql?

www.sommarskog.se/dynamic_sql.html


Peter Larsson
Helsingborg, Sweden


Becuase somepeople want complex code

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-04-10 : 09:37:18
dynamic sql is fresh, new, and exciting sql!!!

static sql is stale, old, unchanging, status quo sql...

the choice is clear, isn't it?




www.elsasoft.org
Go to Top of Page
   

- Advertisement -