August 28, 2012 at 1:27 am
I want to write a stored procedure where it will take 1 parameter that is DateTime..
but it is showing wrong output 🙁
Below is the SP -
***********************************START
USE [Test]
GO
/****** Object: StoredProcedure [dbo].[sps_Final] Script Date: 08/28/2012 02:33:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:Runal Jagtap
-- Create date: 28 AUG 2012
-- Description:Copying Data from FinalRecord Table to the Archieve Table (FinalRequiredRecord) & then Purging the data from FinalRecord according to the said Date.
-- =============================================
ALTER PROCEDURE [dbo].[sps_Final]
@FinaldtCompleted DateTime
AS
BEGIN
-- ====== Inserting Data from FinalRecord Table to FinalRequiredRecord Table ===============================
INSERT INTO dbo.FinalRequiredRecord
SELECT * from dbo.FinalRecord
WHERE convert(nvarchar(100), FinaldtCompleted, 106) <= 'convert(nvarchar(100), @FinaldtCompleted, 106)'
-- =============================================
-- ====== PURGING Data from FinalRecord Table ===============================
DELETE from dbo.FinalRecord
WHERE convert(nvarchar(100), FinaldtCompleted, 106) <= 'convert(nvarchar(100), @FinaldtCompleted, 106)'
-- =============================================*/
SELECT * FROM dbo.FinalRequiredRecord
END
***********************************END
Now actually the problem is the FinaldtCompleted format is '2012-08-28 03:26:07.697' (DateTime)
and while executing SP i want to give the simple parameter value..like - '2012-08-28' or any other..
please help 🙁
************************************
Every Dog has a Tail !!!!! :-D
August 28, 2012 at 1:34 am
Hi all,
I made it... it got solved with slight modifications... Thanks al:)
************************************
Every Dog has a Tail !!!!! :-D
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply