Difference between Stored Procedure and Functions in SQL Server

  Stored Procedure Function In Stored Procedure it is optional, it can return zero, single or multiple values Function Must Return Value Stored Procedures are pre-compile objects and can be executed whenever it is called Function is compiled and executed every time when it is called. Stored Procedure Can Accept Both Input and Output Parameters Function … Continue reading Difference between Stored Procedure and Functions in SQL Server

Sample Solution for Creating Stored Procedure using Search, Sort and Pagination with Parameters

CREATE PROCEDURE SP_OwnersListing ( @OwnersId int = NULL ,@SearchString nvarchar(max) = NULL ,@SortString nvarchar(max) = ' ' ,@PageNumber int = 1 ) AS BEGIN DECLARE @OLSortString nvarchar(max), @PageSize int SET @OLSortString = @SortString SET @PageSize = 10 SET @SearchString = LTRIM(RTRIM(@SearchString)) SELECT Owners.Id As OwnerID, RL.PropertyId, RL.Id As ListingId, Concat(A.Number,',',A.Street,',',A.Suburb,',',A.City)As Location, P.Bedroom, P.Bathroom, P.ParkingSpace, RL.Title, … Continue reading Sample Solution for Creating Stored Procedure using Search, Sort and Pagination with Parameters