This is the example of how to use stored procedure as a data source. This sample stored procedure has one parameter and returns the result of select statement.
This is the sample for SQLServer.
Run this SQL on the database
CREATE TABLE [dbo].[USER]( [USER_NO] [tinyint] NULL, [USER_NAME] [varchar](20) COLLATE Japanese_CI_AS NULL ) ON [PRIMARY] GO INSERT INTO [dbo].[USER] ([USER_NO] ,[USER_NAME]) VALUES (1,'MAHESH') INSERT INTO [dbo].[USER] ([USER_NO] ,[USER_NAME]) VALUES (2,'DAVID') INSERT INTO [dbo].[USER] ([USER_NO] ,[USER_NAME]) VALUES (3,'KOICHI') INSERT INTO [dbo].[USER] ([USER_NO] ,[USER_NAME]) VALUES (4,'BRAD') GO CREATE PROCEDURE SP_SELECT_USER (@USER_NO TINYINT) AS SELECT [USER_NO] ,[USER_NAME] FROM [dbo].[USER] WHERE [USER_NO] = @USER_NO GO
Import stored procedure as a Metadata on Framework Manager
Edit definition of stored procedure
If ths stored procedure has a parameter, you have to set the value in this form.Click Test before setting the value and Set 1 in value on Prompt Values form
Select the parameter and click Edit
Set the value on Edit Value form
?PROMPT_NAME?You can use user prompt here with this expression. When user runs a report which uses this data source, this prompt is shown. The stored procedure is imported as a data source. Then it is be able to used in Report Studio/Query Studio.
No comments:
Post a Comment