Home > Codes, SQL > Code for SQL Stored procedure for Search – C# & .Net codes

Code for SQL Stored procedure for Search – C# & .Net codes

////Below is the SQL Stored procedure for Search for any Project////

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[Se_SearchEnquiry]
–@RID int,
@RUser_First_name nvarchar(50)=NULL,
@RUsr_Title nvarchar(50)=NULL,
@RUsr_Company nvarchar(50)=NULL,
@RUsr_Industry nvarchar(50)=NULL,
@RUsr_CityCode nvarchar(50)=NULL,
@RUsr_Country_Code nvarchar(50)=NULL,
@RUsr_Pincode nvarchar(50)=NULL
AS
SET NOCOUNT ON
SELECT

se.User_Id,
se.User_First_name,
se.Usr_Title,
se.Usr_Company,
se.Usr_Industry,
se.Usr_CityCode,
se.Usr_Country_Code,
se.Usr_Pincode
FROM tbl_Diaspora_Registration se (nolock)
WHERE

isnull(se.User_First_Name,”) like ‘%’+@RUser_First_Name+’%’
AND  isnull(se.Usr_Title,”) like ‘%’+@RUsr_Title+’%’
AND  isnull(se.Usr_Company,”) like ‘%’+@RUsr_Company+’%’
AND  isnull(se.Usr_Industry,”) like ‘%’+@RUsr_Industry+’%’
AND  isnull(se.Usr_CityCode,”) like ‘%’+@RUsr_CityCode+’%’
AND  isnull(se.Usr_Country_Code,”) like ‘%’+@RUsr_Country_Code+’%’
AND  isnull(se.Usr_Pincode,0) like ‘%’+@RUsr_Pincode+’%’
SET NOCOUNT OFF
RETURN

Categories: Codes, SQL Tags:

Post Comments Below

  1. No comments yet.
  1. No trackbacks yet.