USE [CW2010]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spRob_Test]
@Sorter int ,
@Lane int ,
@ErrorCode int OUTPUT
AS
DECLARE @Now DateTime
DECLARE @Year Int
DECLARE @Month Int
DECLARE @Day Int
DECLARE @Hour Int
DECLARE @Divert Int
SET @Now = GetDate()
SET @Year = DatePart(year, @Now)
SET @Month = DatePart(month, @Now)
SET @Day = DatePart(day, @Now)
SET @Hour = DatePart(hour, @Now)
SET NOCOUNT ON
-- SELECT row(s) from the table
DECLARE @query varchar(2000)
SET @query = 'SELECT * FROM tblSorterCounts WHERE DatePart(Year, DateTimeStamp) = @Year AND DatePart(month, DateTimeStamp) = @Month AND DatePart(day, DateTimeStamp) = @Day AND Hour = @Hour AND Sorter = @Sorter AND Lane = @Lane'
EXEC(@query)
-- Get the Error Code for the statment just executed
SET @ErrorCode = @@ERROR
|