Compartilhar via


Code Sample: SCRS_GetProgramName_CUSTOM SCRM Stored Procedure

This sample demonstrates the changes made to the SCRM 2006 stored procedure SCRS_GetProgramName in How to Switch the Filter Order of an SCRM Report. The original stored procedure is in the SCRM 2006 SystemCenterPresentation database.

Requirements

SCRM 2006.

Example

SCRS_GetProgramName is changed so that it no longer requires the company name as an input parameter and instead returns the full list of program names.

USE [SystemCenterPresentation]
GO
/****** Object:  StoredProcedure [dbo].[SCRS_GetProgramName_CUSTOM]    Script Date: 04/06/2006 12:04:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[SCRS_GetProgramName_CUSTOM]   
--Declare input parameters for the Stored Procedure.  
(@LocaleID int )  
AS  
-- Prevent number of rows affected being returned as part of results.  
SET NOCOUNT ON  
 SELECT 1 AS Sequence,'<ALL>' AS ProgramName , dbo.fn_getLocalizedString('<ALL>','Misc',@LocaleID)  AS ProgramNameLabel  
 UNION ALL  
 SELECT DISTINCT  2 AS Sequence,   
  ARPUserDisplayName AS ProgramName , ARPUserDisplayName AS ProgramNameLabel  
 FROM   
  [dbo].[SCRS_AddRemoveProgram_DIMENSION_View]  
 WHERE   
  ARPUserDisplayName IS NOT NULL  
 ORDER BY  Sequence, ProgramNameLabel   
--Restore Database Settings  
SET NOCOUNT OFF

See Also

Tasks

How to Create an SCRM Stored Procedure
How to Switch the Filter Order of an SCRM Report

Reference

SCRM 2006 SCRS_AddRemoveProgram_DIMENSION_View
SCRS_GetProgramName Stored Procedure

Other Resources

SCRM 2006 SMS Views
SCRM 2006 Stored Procedures