Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Store procedure help Expand / Collapse
Author
Message
Posted Tuesday, August 28, 2012 1:27 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, March 12, 2014 12:13 AM
Points: 258, Visits: 690
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 !!!!!
Post #1350711
Posted Tuesday, August 28, 2012 1:34 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, March 12, 2014 12:13 AM
Points: 258, Visits: 690
Hi all,



I made it... it got solved with slight modifications... Thanks al:)








************************************
Every Dog has a Tail !!!!!
Post #1350714
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse