Making Stored Procedure in SQL Server 2008

 

*Procedure :  p_get_test*

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALter PROCEDURE [dbo].[p_get_test]

      @v_funName VarChar(200)=null,

      @v_userId Int = 1 

AS

BEGIN       

      SET NOCOUNT ON;   

      IF @v_funName = 'GetUserMail' 

      BEGIN

      SELECT emailId from tbl_LoginMaster where userId=@v_userId

      END

      IF @v_funName = 'GetCompanyName' 

      BEGIN

      SELECT companyName from tbl_CompanyMaster where userId=@v_userId

      END

END

GO

* *

*Calling 1st  : *exec dbo.p_get_test 'GetUserMail',35

*Calling 2nd  : *exec dbo.p_get_test 'GetCompanyName',35
Advertisements
This entry was posted in MS SQLServer 2008 and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s