Run Stored Procedure

Jan 3 2016 7:53 AM
i have this stored procedure from my friend and i need to execute it to retrive all the data " i don't want to send any data to filter it   :
 
USE [Stock]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[ES_SearchStockIn]

@StockInNumber nvarchar(13),
@StockInType tinyint,
@SupplierName nvarchar(50),
@Status tinyint,
@Reference nvarchar(50),
@Identifier nvarchar(15),
@DateFrom datetime,
@DateTo datetime,
@ReferenceSupplier Nvarchar(50)
AS
BEGIN
SET @DateFrom = dbo.GetDateOnly (@DateFrom)
SET @DateTo = dbo.GetDateOnly (@DateTo)
declare @var datetime
if @DateFrom > @DateTo
Begin
set @var=@DateFrom
set @DateFrom=@DateTo
set @DateTo=@var
End

SET NOCOUNT ON;

SELECT StockInHeader.StockInNaumber,
StockInHeader.StockInDate,
StockInHeader.StockInID,
StockInHeader.Status,
ISNULL(Suppliers.SupplierName,'--') as SupplierName,
StockInHeader.StockInType,
' 'as TypeText,
' ' AS statusText,
CreatedByUser.FullName AS CreatedByUserName,
StockInHeader.CreationDate,
ModifiedByUser.FullName AS ModifiedByUserName,
StockInHeader.ModificationDate

FROM StockInHeader left outer JOIN
Suppliers ON StockInHeader.SupplierID = Suppliers.SupplierID INNER JOIN
Users AS CreatedByUser ON StockInHeader.CretaedByUserID = CreatedByUser.UserID LEFT JOIN
Users AS ModifiedByUser ON StockInHeader.LastModifiedByUserID = ModifiedByUser.UserID

where (@StockInNumber is null or StockInHeader.StockInNaumber like '%'+@StockInNumber+'%')and
(@ReferenceSupplier is null or StockInHeader.SupplierReference like '%'+@ReferenceSupplier+'%') and
(@StockInType is null or StockInHeader.StockInType = @StockInType)and
(@SupplierName is null or Suppliers.SupplierName like '%'+@SupplierName+'%')and
(@Status is null or StockInHeader.Status = @Status)and
((@DateFrom is null and @DateTo is null) or (dbo.GetDateOnly(StockInHeader.StockInDate) between @DateFrom and @DateTo)) and
(@Identifier is null or exists(SELECT 1
FROM StockInDetails INNER JOIN
ProductIdentifier ON StockInDetails.ProductId = ProductIdentifier.ProductID
WHERE (StockInDetails.StockInID = StockInHeader.StockInID) and
(ProductIdentifier.ProductIdentifierValue =@Identifier)))AND
(@Reference is null or StockInHeader.Reference like '%'+@Reference+'%')
order by StockInHeader.StockInID desc
END

can some one help me to do this 
 
 

Answers (8)