Delete previous day data in table

Hi,
I want to delete the data in the table with the condition sysdate-1 i.e. i want to delete yesterday's data, please guide me. if i use the below query my data on the first day of month is not getting deleted.
select datadate from DELETED_RECORD_LOG where datadate=to_char(sysdate,'yyyymmdd')-1

why the to_char?
delete from tbl
where datadate=sysdate-1or when you are also storing the time information (which you are when you use a DATE)
delete from tbl
where trunc  (datadate) = trunc (sysdate) -1Edited by: Alex Nuijten on Jun 1, 2009 12:09 PM

Similar Messages

  • How to get previous day data if i dont have current day data.

    Hello Gurus,
    I have a stock levels data in ODS. when there is no movements, we are not getting any stocks into ODS. So we have to get previous day data as it is for current day data into another ODS.
    Could you please help me in this regard.
    Thanks in advance,
    Rama

    Rama -    
            0CALDAY can't help us in this scenario .
    Step 1 :
        To do this - You have to add one ZDATE (InfoObject ) to 1st ODS. ZDATE is updated by itself from current date of system  when ever you are loading data to 1st ODS.
    Step 2:
       You have to do full update to 2nd ods.At the selection screen of InfoPackage  (from 1st ODS to 2nd ODS ) you have to write following code for ZDATE.
    pseudo Code:
    1) Select fields "Rec_INSERT","Time stamp","Request Status" and "Request ID"  where ICUBE = ODS1 from table "RSMONICDP"
    2) Populate above selected fields data in INTERNAL TABLE
    3) Sort INTERNAL TABLE by Time stamp .
    4)
         If (Record Count = ' 0 ' for current date in internal table )
         update records from  ODS1 to ODS2 where ZDATE = "yesterday date"
         else
         update records from ODS1 to ODS2 where ZDATE= "today date"
         endif.
    Make sure this is full update not delta update from ODS1 to ODS2
    I am sorry, I m not good in Coding but I am sure if  u use this logic,You can meet your requirement.
    I hope you can understand my logic. Let me know if you have any questions,
    Anesh B .

  • SQL Server - Previous day data retrieval + conditions

    Hi Guys,
    I am retrieving data from a view for a dashboard and I need some help with my query to retrieve yesterday's data where the following conditions meet:
    When 'Monday' retrieve JUST friday's data. When 'Tuesday' retrieve data from Saturday until Monday, When 'other days' JUST retrieve previous day,
    But there is another condition: Exclude 'previous day' data WHERE "DESP_PostedDate..." column is empty. (as this will skew the percentages)
    This is what I have so far:
    SELECT CORD_DocumentCode
    ,OpenDate
    ,datedue
    ,DESP_PostedDate
    ,COUNT(CORD_DocumentCode) AS Order_Count
    ,SUM(CASE WHEN InFullAndOneTime = 2 THEN 1 ELSE 0 END) AS Difot_count
    ,SUM(CASE WHEN InFullAndOneTime = 2 THEN 1 ELSE 0 END) * 1.0 /COUNT(CORD_DocumentCode) AS DIFOT
    FROM DIFOTIS_View
    WHERE (OpenDate >= CASE
    WHEN DATENAME(dw, CONVERT(CHAR(8), GETDATE(), 112)) LIKE 'Monday' THEN CONVERT(CHAR(8), DATEADD(dd, - 2, GETDATE()), 112)
    WHEN DATENAME(dw, CONVERT(CHAR(8), GETDATE(), 112)) LIKE 'Tuesday' THEN CONVERT(CHAR(8), DATEADD(dd, - 3, GETDATE()), 112) ELSE CONVERT(CHAR(8),
    DATEADD(dd, - 1, GETDATE()), 112) END) GETDATE(), 112))
    GROUP BY OpenDate
    ,CORD_DocumentCode
    ,datedue
    ,DESP_PostedDate
    ORDER BY OpenDate
    This will show you last week's date from "Wednesday" and the result is 15.4 % (or 4/26) whereas I would like it to show 80% (or 4 / 5)
    I have tried adding
    ((Datediff(day,Opendate,getdate())=1) and DESP_PostedDate is not null)
    but it shows then ONLY data from the previous day.
    What do you suggest I should do? Please find below Data from friday for your perusal.
    All help is appreciated. Thanks
    Eric
    CORD_DocumentCode OpenDate datedue DESP_PostedDate Order_Count Difot_count DIFOT
    CASW92195 2014-10-19 2014-10-19 2014-10-20 1 1 1.000000000000
    CASW92196 2014-10-19 2014-10-19 2014-10-20 1 1 1.000000000000
    CASW92197 2014-10-19 2014-10-19 2014-10-20 1 1 1.000000000000
    CASW92198 2014-10-19 2014-10-19 2014-10-20 1 1 1.000000000000
    CASW92199 2014-10-19 2014-10-19 2014-10-20 1 1 1.000000000000
    CASW92200 2014-10-19 2014-10-19 NULL 1 0 0.000000000000
    CASW92201 2014-10-20 2014-10-20 2014-10-20 1 1 1.000000000000
    CASW92202 2014-10-20 2014-10-20 2014-10-20 1 1 1.000000000000
    CASW92203 2014-10-20 2014-10-20 2014-10-21 1 1 1.000000000000
    CASW92204 2014-10-20 2014-10-20 2014-10-21 1 1 1.000000000000
    CASW92205 2014-10-20 2014-10-20 2014-10-21 1 1 1.000000000000
    CASW92206 2014-10-20 2014-10-20 2014-10-21 1 1 1.000000000000
    CORD37188 2014-10-20 2014-10-20 NULL 1 0 0.000000000000
    CORD37189 2014-10-20 2014-10-20 2014-10-20 1 0 0.000000000000
    CORD37190 2014-10-20 2014-10-20 2014-10-20 1 0 0.000000000000
    CORD37191 2014-10-20 2014-10-20 2014-10-21 1 0 0.000000000000
    CORD37192 2014-10-20 2014-10-20 2014-10-20 1 0 0.000000000000
    CORD37193 2014-10-20 2014-10-20 2014-10-20 1 0 0.000000000000
    CORD37195 2014-10-20 2014-10-20 2014-10-20 1 0 0.000000000000
    CORD37196 2014-10-20 2014-10-20 2014-10-20 1 0 0.000000000000
    CORD37197 2014-10-20 2014-10-20 2014-10-21 1 0 0.000000000000
    CORD37198 2014-10-20 2014-10-20 2014-10-21 1 0 0.000000000000
    CORD37199 2014-10-20 2014-10-20 2014-10-20 1 0 0.000000000000
    CORD37200 2014-10-20 2014-10-20 NULL 1 0 0.000000000000
    CORD37211 2014-10-20 2014-10-20 2014-10-21 1 1 1.000000000000
    CORD37216 2014-10-20 2014-10-20 2014-10-21 1 1 1.000000000000
    CASW92207 2014-10-21 2014-10-21 2014-10-21 1 1 1.000000000000
    CASW92208 2014-10-21 2014-10-21 2014-10-21 1 1 1.000000000000
    CASW92209 2014-10-21 2014-10-21 2014-10-21 1 1 1.000000000000
    CASW92210 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CASW92211 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CASW92212 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CASW92213 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37218 2014-10-21 2014-10-21 2014-10-21 1 1 1.000000000000
    CORD37220 2014-10-21 2014-10-20 2014-10-21 1 0 0.000000000000
    CORD37221 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37222 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37225 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37227 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37228 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37229 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37230 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37231 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37232 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37233 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37234 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37235 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37236 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37237 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37238 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37239 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    CORD37241 2014-10-21 2014-10-21 NULL 1 0 0.000000000000
    Thanks
    Eric

    Hi Eric,
    Pleas try below code ,Hope this help you
    As per My understanding you were looking for below logic
    If Monday --> Friday only
     Tuesday --> Saturday,sunday, Monday
    Rest Days-->only Preovious Day
    plus additional rule desp_posted date is null then exclude yestreday's data.
    /*Main Query */
    declare @ReportDate datetime
    set @ReportDate='2014-10-22 00:00:00.000'
    select
    OpenDate,cast(datepart(dw,OpenDate) as varchar),DESP_PostedDate
    from base
    where cast(datepart(dw,OpenDate) as varchar)
    in ( SELECT * FROM dbo.CSVToTable(
    case
    when datepart(dw,@ReportDate) =7 then '6'
    when datepart(dw,@ReportDate) =6 then '5'
    when datepart(dw,@ReportDate) =5 then '4'
    when datepart(dw,@ReportDate) =4 then '3'
    when datepart(dw,@ReportDate) =2 then '6'
    when datepart(dw,@ReportDate) =3 and DESP_PostedDate is not null then '7,1,2'
    when datepart(dw,@ReportDate) =3 and DESP_PostedDate is null then '7,1'
    when datepart(dw,@ReportDate) =1 then '7' Else NULL END )) and opendate>=DATEADD(day, -7,@ReportDate)
    /* Table Creation & Sample data */
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE FUNCTION [dbo].[CSVToTable] (@InStr VARCHAR(MAX))
    RETURNS @TempTab TABLE
    (id int not null)
    AS
    BEGIN
    ;-- Ensure input ends with comma
    SET @InStr = REPLACE(@InStr + ',', ',,', ',')
    DECLARE @SP INT
    DECLARE @VALUE VARCHAR(1000)
    WHILE PATINDEX('%,%', @INSTR ) <> 0
    BEGIN
    SELECT @SP = PATINDEX('%,%',@INSTR)
    SELECT @VALUE = LEFT(@INSTR , @SP - 1)
    SELECT @INSTR = STUFF(@INSTR, 1, @SP, '')
    INSERT INTO @TempTab(id) VALUES (@VALUE)
    END
    RETURN
    END
    GO
    /****** Object: Table [dbo].[base] Script Date: 10/28/2014 6:07:17 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[base](
    [CORD_DocumentCode] [varchar](50) NULL,
    [OpenDate] [datetime] NULL,
    [datedue] [datetime] NULL,
    [DESP_PostedDate] [datetime] NULL,
    [Order_Count] [int] NULL,
    [Difot_count] [int] NULL,
    [DIFOT] [numeric](18, 2) NULL
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92195', CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92196', CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92197', CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92198', CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92199', CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92200', CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3C900000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92201', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92202', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92203', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92204', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92205', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92206', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37188', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37189', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37190', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37191', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37192', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37193', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37195', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37196', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37197', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37198', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37199', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37200', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37211', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37216', CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92207', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92208', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92209', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92210', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92211', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92212', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CASW92213', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37218', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37220', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CA00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37221', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37222', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37225', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37227', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37228', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37229', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37230', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37231', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37232', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37233', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37234', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37235', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37236', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37237', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37238', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37239', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37241', CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37985', CAST(0x0000A3C800000000 AS DateTime), CAST(0x0000A3C800000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 2, 0, CAST(1.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD379865', CAST(0x0000A3C700000000 AS DateTime), CAST(0x0000A3C700000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 1, CAST(3.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37875', CAST(0x0000A3C600000000 AS DateTime), CAST(0x0000A3C600000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37241', CAST(0x0000A3C500000000 AS DateTime), CAST(0x0000A3C500000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 1, 0, CAST(0.00 AS Numeric(18, 2)))
    GO
    INSERT [dbo].[base] ([CORD_DocumentCode], [OpenDate], [datedue], [DESP_PostedDate], [Order_Count], [Difot_count], [DIFOT]) VALUES (N'CORD37263', CAST(0x0000A3C400000000 AS DateTime), CAST(0x0000A3C500000000 AS DateTime), CAST(0x0000A3CB00000000 AS DateTime), 2, 0, CAST(3.00 AS Numeric(18, 2)))
    GO
    Shiv
    please mark as Answer if helpfull

  • Previous days data based on passing parameter and date

    Hi,
    i have one rek..that requirement to to show the previous days data based on the number passing to the parameter parameter.
    lets suppose if user enters the date '25 Mar 2012 in one dashboard prompt and in another prompt user enters the no.of days(Ex: 5).then report should display the last 5 days data i.e 25 mar 2012,24 mar 2012,23 mar 2012,22 mar 2012,21 mar 2012.
    can anybody tell me how can i achieve this..
    Thanks in advance...

    user12255470 wrote:
    Hi,
    i have one rek..that requirement to to show the previous days data based on the number passing to the parameter parameter.
    lets suppose if user enters the date '25 Mar 2012 in one dashboard prompt and in another prompt user enters the no.of days(Ex: 5).then report should display the last 5 days data i.e 25 mar 2012,24 mar 2012,23 mar 2012,22 mar 2012,21 mar 2012.
    can anybody tell me how can i achieve this..
    Thanks in advance...Read the article and adapt it to what you are doing. It's very similar...
    http://oraclebizint.wordpress.com/2008/03/11/oracle-bi-ee-101332-rolling-yearmonth-and-date-filters-moving-window-filters/

  • ST03 - Previous day data???

    Hi Guru's,
    I have a query on ST03. My Question is when I log onto a server and try to get the ST03 data for the previous day, I do not get the data until 3AM server time. ie if I want the data for 3/12/08, the data does not reflect on the system till 3AM 3/13/08. Why is it I do not get the data of the previous day at 12.10AM on 3/13/08.
    Useful answers will be rewarded.
    Cheers
    Shankam

    Hi Praveen,
    1) SAP standard job SAP_COLLECTOR_FOR_PERFORMANCE must be schedule hourly in each SAP system. The job must always be scheduled in client 000 with user DDIC or with a user with the same authorisation.
    2) If you want to schedule the SAP_COLLECTOR_FOR_PERFORMANCE job daily. Can you check when SAP_COLLECTOR_FOR_PERFORMANCE job has been scheduled. If you can change the schedule time of SAP_COLLECTOR_FOR_PERFORMANCE job, i think it should resolve your problem.
    Kindly refer below sap notes
    *Note 12103 - Contents of the TCOLL table*
    *Note 16083 - Standard jobs, reorganization jobs*
    Cheers
    Kanthi Kiran

  • How to delete a single data from table using control file

    I want delete a single row data from table using sql loder control file
    Edited by: 977940 on Dec 19, 2012 9:00 PM

    977940 wrote:
    I want delete a single row data from table using sql loder control file
    Edited by: 977940 on Dec 19, 2012 9:00 PMWhy?
    And how do you imagine this happening with sqlloader?
    The entire purpose of sqlloader is to load data (hence, the name sql*loader*) into a table from an external source. If you want to delete rows from a table, you use the sql DELETE statement.
    What is the business problem you are trying to solve?

  • Previous day date to pick up

    i want to pick up the previous latest date from a column. that means
    if i have a column name batch_id and the dates avaiable are
    batch_id Previous date
    27-06-07 26-06-07
    26-06-07 25-06-07
    25-06-07 23-06-07 -----saturday date out here
    Its a sunday therefore no business for this day and therefore no entry for this day.
    23-06-07 22-06-07
    please let me know how to achive this through SQL
    Thanks in advance

    Is this?
    select batch_id
      ,case when to_cahr(batch_id,'fmday','nls_date_language=american') = 'monday'
        then batch_id-3
        else batch_id-1
       end  previous_date
    from your_table
    ;But, how do you want to treate holidays?

  • Alert on Today's Data Compared with Previous Day Data

    Hi All,
    I've a report with multiple tabs having data like,
    Tab:1                                   Tab:2                                 Tab:3                          Tab:4
    Franchise: ABC                   Franchise                          Franchise                    Same as Tab:3
    Start Date:                           Start Date                          Month
    Operator: XYZ                     Operator                            Operator
    Incoming Node:N01            Outgoing Node                  Incoming Node
    Incoming Path:P01             Outgoing Path                    Incoming Path
    Incoming Count:2                Outgoing Count                 Incoming Count
    Incoming Mins: 10.63          Outgoing Mins                   Incoming Mins
    My requirement here is, I've want an alert on Percentage of Mins comparing its data with the previous day(Month for Tab 3 & 4) mins data. For now I've done this by creating a variable(with Relative Value Function) that stores the previous day or month's mins and stored the difference of these two data into another variable as Variation. I've put a percentage on the Variation variable and put a alert on it. It went well till here but, my requirement also has graphical alert on percentage. I tried adding the Variation variable and percentage and all available measures. But an error showed up with every try saying "Error in dataset values :#COMPUTATION"
    Is there any other to do this report?
    Note: I'm using WebI Rich Client v4.1 SP1

    I tried using Franchise(Dim) and with that i've used Incoming Count, Incoming Mins, Variation separately. But nothing worked.

  • Previous Days Date

    I am looking for a formula that will give me just the date from the current date in Crystal Reports 2008.  I need to produce reports from the previous day for publishing to the users.  So if I am producing reports today "May 5, 2009" and want to select records based on those posted the previous day "May 4, 2009" how would I do that

    I assume you have a posting date field, if so then use this statement in your selection criteria.
    {posting.date} = currentdate - 1
    That should pick up only those records that were posted the previous day, if you run the report today and so on...

  • ST03N, i am not able to see today n previous day data

    Hii All
    In my ST03N, i am not able to see today n last day data, it shows me data upto last two day before data. plz tell me abt where i can check the retention period.
    System Details:
    SAP: ECC 6.0
    DATA BASE: ORACLE 10G
    OS: AIX5.3
    SAP KERNEL:179
    SAP_ABA: SAPKA70015
    SAP_BASIS:SAPKB70015
    ST-PI:2008_1_700
    PI_BASIS:SAPKIPYJ7F
    Already jobs:
    SAP_COLLECTOR_FOR_PERFMONITOR
    SAP_APPLICATION_STAT_COLLECTOR
    SAP_CCMS_MAPPING_SCHEDULER
    SAP_COLLECTOR_FOR_JOBSTATISTIC
    and saposcol running fine.
    Thanks
    Amit Srivastava
    Basis

    Hi
    You can refere this [Link|No system load data available; may help you
    Regards
    Uday

  • JavaScript function deletes previously entered data

    Hello, I am using Adobe LiveCycle Designer version 9.0 and have created a one page form with a radio button list which allows a user to create an additional duplicate page when selected. All of the form was created as a master mage with the exception of the additional page radio button list that exists on &quot;Page1.&quot; The script works great except all data entered by the user on Page1 is deleted when the additional page is created. Any suggestions would be greatly appreciated. I know just enough about JavaScript and FormCalc to paint myself into a corner (obviously) so speak slow and use small words please ...
    Here is the code to add additional page:
    topmostSubform.Page1.RadioButtonList::click - (JavaScript, client)
    if (RadioButtonList.rawValue==&quot;1&quot;)
    {Page2.presence = &quot;visible&quot;;}
    else if (RadioButtonList.rawValue ==&quot;2&quot;)
    {Page2.presence = &quot;hidden&quot;;}
    else
    {Page2.presence = &quot;hidden&quot;;}

    I see two things that are problematic:
    In general, you should try to avoid putting fields on a master page...you can sometimes experience unexpected results when you do.  Move your table to the body page instead and your problem will go away.
    All of your fields are set with binding of "No data binding" (Object-->Binding-->Data Binding).  As a result, if you save your form, close and re-open it, the data will likely be lost.  At a minimum you should set the data binding to "Use Name".
    Some other recommendations:
    Try to avoid using so many rectangles...they are unneccessary, and the the number of objects used on your form can impact performance.  Use borders around text fields or text objects instead.
    You should have a single table rather than two separate tables on two separate pages.  If you add a second page, then the totals at the bottom of each page will only reflect the totals for that page.  Create a dynamic table and allow people to add new rows rather than adding an entire page.  The use of a flowed layout and a content area on the master page will prevent the data from flowing into the footer and will force the creation of a new page as needed.
    You have a bunch of scripts on your dropdowns that try to connect to a database connection that doesn't appear to exist.  Remove these if they aren't needed.
    Because the Approving Official field is on the master page, it will appear at the bottom of every page.  Do you want it at the bottom of every page, or just at the bottom of the last page?  If the bottom of the last page, then add it to the body page in a flowed layout, or create two separate master pages.
    Week Ending appears at the top of every page, but you have to enter a value on every page.  Set the data binding to "Use global data" and it will ensure that the values on each page are kept in synch.

  • Manually Deleting Previous Day/Week/Month Backups

    Hi,
    I use an external drive solely for time machine; however, I have a need to transfer about 20 GBs and want to use the external for such. Time machine currently maxes out the 200 GB hard drive with all its previous (years worth) of backups.
    1) Wondering if I could manually browse (via finder) the time machine drive and delete my previous (oldest) backups to free up some space... Is this possible or will it ruin my backups?
    2) Similarly, in a similar manner what if I wanted to retain only the latest backup of my files, and extinguish ALL the previous ones--to have a clean slate (I don't need any previous files).
    I notice when I browse (via finder) I can see all the incremental time periods of backups. Is it as easy as deleting all of these folders except for the "latest" one? I realize the point of time machine is it references files that have not changed, so I'm weary that all my sub folder dates link/reference others, and in destroying one could ruin all of them...
    Thanks,
    TM

    {quote:title=T.M. wrote:}{quote
    1) Wondering if I could manually browse (via finder) the time machine drive and delete my previous (oldest) backups to free up some space... Is this possible or will it ruin my backups?
    Don't use Finder to alter TM backups. You are asking for trouble. You can open the TM interface and try to delete backups from there.
    2) Similarly, in a similar manner what if I wanted to retain only the latest backup of my files, and extinguish ALL the previous ones--to have a clean slate (I don't need any previous files).
    In that case, erase your backup drive and start over. Seriously. That will clear out your backup drive the best.
    I notice when I browse (via finder) I can see all the incremental time periods of backups. Is it as easy as deleting all of these folders except for the "latest" one? I realize the point of time machine is it references files that have not changed, so I'm weary that all my sub folder dates link/reference others, and in destroying one could ruin all of them...
    Repeat of answer to question one. Don't mess with TM via Finder. Use the TM interface. Open Finder and click the TM icon on the Dock to open the TM interface.

  • Previous day data

    i need todo following in the reports:
    1. In the beginning of the report, a summary of the following:
           For the last 5 days, count of "emails(string)"
           (ii) For the last 5 days, the u201CFromu201D addresses and the count of how many emails they had sent to the address each day.
    Can you give idea of how todo in crystal report?

    Hi, 
    If your report is only for the last 5 days you can create a Record Selection Formula like: 
    {table.SENT_DATE} >= Today - 5;
    In the Report Header you can do a Count summary of the e-mails. 
    For the From addresses, you can create a group on the From address.  In the GroupHeader, you can show the e-mail address and a Count summary. 
    Hope this helps,
    Brian

  • Get records from previous day to today

    hi
    i have 1 main table, table A, which has all the data .
    now i have table b which has previous day data and table c which has current data. i need to compare table a(each column)
    to each column in table b and c
    and need to find out rows that has been changed from yesterday to today and send that data.
    table B and table C doesnt have any date which say which date it got changed

    >> I have 1 main table, table A, which has all the data .<<
    What is a “main table”? I never used or heard that term. I am old, so I remember “main” or “master” tape files, however. 
    No table should have all the data in a schema that has more than one relationship in it. Where is the DDL?  
    >> now I have table b which has previous day data and table c which has current data <<
    NO! This design error is called “Attribute splitting” and it usually comes from programmers like you who are using SQL to write 1950's magnetic tape files. Would you have a “Male_Personnel” and a “Female_Personnel”  table or a “Personnel” table? Those
    two absurd tables were split on sex_code, just like you want to split this unknown data on a “<something>_date” attribute. 
    >>  I need to compare table a(each column) to each column in table b and c and need to find out rows that has been changed from yesterday to today and send that data. <<
    No, you need to stop trying to write SQL until you know what you are doing. To track the history of, say, Foobars we need to see time as a continuum and model it as (begin_date, end_date) pairs that define when a foobar had a particular value. Here is the skeleton. 
    CREATE TABLE Foobar_History 
    (foo_id CHAR(9) NOT NULL, 
     start_date DATE NOT NULL, 
     end_date DATE, --null means current 
     CHECK (start_date <= end_date),
     foo_status INTEGER NOT NULL, 
     PRIMARY KEY (foo_id, start_date)); 
    When the end_date is NULL, that state of being is still current. You use a simple query for the status on any particular date;
    SELECT * 
      FROM Foobar
     WHERE @in_cal_date
         BETWEEN start_date
          AND COALESCE (end_date, CURRENT_TIMESTAMP);
    There are more tricks in the DDL to prevent gaps, etc
    CREATE TABLE Events
    (event_id CHAR(10) NOT NULL,
     previous_event_end_date DATE NOT NULL  
     CONSTRAINT Chained_Dates  
      REFERENCES Events (event_end_date), 
     event_start_date DATE NOT NULL, 
     event_end_date DATE UNIQUE, -- null means event in progress
      PRIMARY KEY (event_id, event_start_date), 
     CONSTRAINT Event_Order_Valid 
      CHECK (event_start_date <= event_end_date), 
     CONSTRAINT Chained_Dates 
      CHECK (DATEADD(DAY, 1, previous_event_end_date) = event_start_date)
    -- CHECK (previous_event_end_date + INTERVAL '01' DAYS) = event_start_date)
    -- disable the Chained_Dates constraint
    ALTER TABLE Events NOCHECK CONSTRAINT Chained_Dates;
    GO
    -- insert a starter row
    INSERT INTO Events(event_id, previous_event_end_date, event_start_date, event_end_date)
    VALUES ('Foo Fest', '2010-01-01', '2010-01-02', '2010-01-05');
    GO
    -- enable the constraint in the table
    ALTER TABLE Events CHECK CONSTRAINT Chained_Dates;
    GO
    -- this works
    INSERT INTO Events(event_id, previous_event_end_date, event_start_date, event_end_date)
    VALUES ('Glob Week', '2010-01-05', '2010-01-06', '2010-01-10');
    -- this fails
    INSERT INTO Events(event_id, previous_event_end_date, event_start_date, event_end_date)
    VALUES ('Snoob', '2010-01-09', '2010-01-11', '2010-01-15');  
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • To retrieve previous day's data-ods

    Hi friends,
    i got a requirement like we should get the previous days data in to our ods.
    i.e. we are extracting the data daily into our ods from crm (the data related to the daily complaints.i.e. if the user enters the complaint on 25.06.2008, then the officer who is related to that particular department can see the report on 26.06.2008)
    now my requirement is if the user enters the data on 25.06.2008 the should see the corresponding data on 27.06.2008).
    we are extracting the data using function module.
    is there any way to extract the data od day before's.
    please help me
    regards
    sridath
    Edited by: sridath on Jun 27, 2008 11:28 AM

    Hi Sridath,
    Are u talking about the backend side or from the report side of issue..
    If its from the backend side then u cannt get the day before yesterdays data to load.. unless is there is no load has happend yesterday.. If there is no load has happend yesterday .. then u can delete the data before yesterdays load from ur ODS and then take a repeat delta.. in this repeat u can get total 3 days data including the new postings which is there in RSA7.
    Or u can look at the PSA data anyway will load only that particular day load only..
    Let us know the details..
    Thanks
    Assign points if this helps

Maybe you are looking for

  • What is going on with UIScrollView

    Hi everyone, I defined my own ZoomScrollView Class as a sub-class of UIScrollView and find something I do not understand. Here is my code: #import <UIKit/UIKit.h> @interface ZoomScrollView : UIScrollView { @end and #import "ZoomScrollView.h" @impleme

  • Video driver for Vision

    Hello everyone, I am currently trying to display an image on a Real-Time Desktop using Vision. To do this, I am using the RT Video Out with Overlay example. The VI appears to run, however there is no new image displayed on the monitor and when I stop

  • Cumulative Sales and %

    Hi There, I am trying to achieve cumulative sales by region for each month in OBIEE. Here is what all the columns i have RSUM(sales by region), Region(AMR,APAC,JPN etc), Fiscal_month (values like FEB-06), month_end_date when i run this result in OBIE

  • HT3702 I've use different credit cards but unable to accept my info keeps asking my for my security code even though I've entered it

    I'm unable to use my iTunes credit. I've entered my billing info and it has been rejected even when different credit cards are used

  • Problems backing up, is it the internal hd or the external hd.

    I have an early Intel MBP with a replaced Western Digital 750Gb internal drive I installed about 2 years ago.  The machine is slow and I haven't even gotten it into Snow Leopard, let alone Lion, so the time has come: wipe this drive clean and do a fr