Help Needed in Date Logic

Hi I am working in sqlserver 2008 R2 and below is my sample research query
i am trying to get previous 6 months data.
WITH CutomMonths
AS (
SELECT UPPER(convert(VARCHAR(3), datename(month, DATEADD(MM, DATEDIFF(MM, 0, GETDATE()) - N, 0)))) Month
,DATEADD(MM, DATEDIFF(MM, 0, GETDATE()) - N, 0) startdate
,DATEADD(MM, DATEDIFF(MM, 0, GETDATE()) - N + 1, 0) enddate
FROM (
VALUES (1)
,(2)
,(3)
,(4)
,(5)
,(6)
) x(N)
WHERE N <= 6
SELECT month
,SUM(isnull(perks.amount,0)) AS PerkAmount
FROM CutomMonths
LEFT JOIN (
select 10.00 as amount,'2014-04-03' as StartDate,'2015-04-03' as EndDate union all
select 10.00 as amount,'2014-04-03' as StartDate,'2015-04-03' as EndDate
) perks ON
CutomMonths.startdate >= perks.StartDate
AND CutomMonths.startdate < perks.EndDate
GROUP BY CutomMonths.Month
,CutomMonths.startdate
ORDER BY CutomMonths.startdate ASC
current output what i am getting:
Expected Output:
I found why the April month i din't get the $20 because the startdate of my perks CTE '2014-04-03'. If it is '2014-04-01' then i will get the expected output.
But i should not change the the date on perks. How to neglect this date issue and consider the month instead to get the expected output. please help me on this as i am struggling on my logic 
loving dotnet

I'm just going to focus on the JOIN criteria in this reply since my answer above and your 2nd response are essentially the same except for the JOIN.
What your are describing and what you are doing in code is conflicting. 
You are saying this:
"I just need to check whether the perks start date falls in between month start date and month end date"
..., which translated directly to code would be this:
 ON perks.StartDate >= CustomMonths.StartDate
AND perks.StartDate <= CustomMonths.EndDate
What I believe you are getting after is this:
"I just need to check whether the dates within the perks start and end date range fall in between month start date and month end date"
..., which translated directly to code would be this, which is also my answer proposed above:
ON CustomMonths.StartDate >= DATEADD(DAY, -(DAY(perks.StartDate) - 1), perks.StartDate)
AND CustomMonths.StartDate <= perks.EndDate
However, if you really want to use the code solution you proposed, then you would actually be saying this:
"I just need to check whether the dates within the perks start and end date range fall in between month start date and month end date, but if perk end date happens to be the first day of the month, then ignore it and use the previous day."
..., in which case then your code, as follows, would be the solution:
 ON CutomMonths.startdate >= DATEADD(mm, DATEDIFF(mm, 0, perks.StartDate), 0)AND CutomMonths.startdate < DATE
ADD(mm, DATEDIFF(mm, 0, perks.EndDate), 0)
NOTE: The alternate JOIN I had commented out in my proposed answer above will do the exact same thing as your latest proposed solution
 ON CustomMonths.StartDate >= DATEADD(DAY, -(DAY(perks.StartDate) - 1), perks.StartDate)
AND CustomMonths.StartDate < perks.EndDate
BTW, I see how you are getting to the first day of the month by subtracting all the months from the given date to 01/01/1901, and then turning around and adding them all back to 01/01/1901.  While that is one way to get to the first day of the month, it
seems excessive from a calculation stand point, although I haven't performed any performance tests to know for certain.
SELECT DATEADD(mm, DATEDIFF(mm, 0, '2014-04-03'), 0)
I prefer simply subtracting one less than the current day number from the given date to get to the same first day of the month value.
SELECT DATEADD(DAY, -(DAY('2014-04-03') - 1), '2014-04-03')

Similar Messages

  • HELP needed on Date

    Hi there everyone, pls help me . i have a question as above
    "Code a Java class called Calendar which has a static variable of type Date(initialised to 1st January 2004), a static void method called tock(int days) to advance the variable by the specified number of days, and a static Date method called getDate() to return the current date.".
    What i was thinking to write is.
    public class Calendar
    Date myDate = new Date();
    myDate = java.sql.Date.valueOf("2004-01-01"); //but my fren said i could use the toString() instead
    public static void tock(int days)
         {  int i = 1;
    while i < days;
    Date = Date + 1; // i am not sure what i am doing ...i am just a beginner .pls help
    public static Date getDate()
    { return Date;
    Are my answers correct ..? how do i advance the variable (date) by the number of specified days ? the asnwer need to print out, say 4 days , u need to print 01 Jan , 02Jan , 03 Jan , 04 Jan...
    anyone please help ..

    Since your assignment is to code a class named Calendar, I doubt that you can use the java.util.Calendar class,
    which has a useful add() method in it.
    So here is another solution:
    public class Calendar
        static Date myDate = java.sql.Date.valueOf("2004-01-01");
        public static void tock(int days)
            long t = myDate.getTime(); // returns the number of milliseconds since 1970-01-01 00:00:00 GMT
            t = t + (days * 24 * 60 * 60 * 1000); // adds the appropriate number of days in milliseonds
            myDate.setTime(t);
        public static Date getDate()
            return myDate;

  • Help Needed in Relational logic

    Hi
    Working in 2008 R2 version.
    Below is the sample data to play with.
    declare @users table (IDUser int primary key identity(100,1),name varchar(20),CompanyId int, ClientID int);
    declare @Cards table (IdCard int primary key identity(1000,1),cardName varchar(50),cardURL varchar(50));
    declare @usercards table (IdUserCard int primary key identity(1,1), IDUser int,IdCard int,userCardNumber bigint);
    Declare @company table (CompanyID int primary key identity(1,1),name varchar(50),ClientID int);
    Declare @client table (ClientID int primary key identity(1,1),name varchar(50));
    Declare @company_cards table (IdcompanyCard int primary key identity(1,1),CompanyId int,IdCard int)
    Declare @Client_cards table (IdclientCard int primary key identity(1,1),ClientID int,IdCard int)
    insert into @users(name,CompanyId,ClientID)
    select 'john',1,1 union all
    select 'sam',1,1 union all
    select 'peter',2,1 union all
    select 'james',3,2
    Insert into @usercards (IdUser,IdCard,userCardNumber)
    select 100,1000,11234556 union all
    select 100,1000,11234557 union all
    select 100,1001,123222112 union all
    select 200,1000,2222222 union all
    select 200,1001,2222221 union all
    select 200,1001,2222223 union all
    select 200,1002,23454323 union all
    select 300,1000,23454345 union all
    select 300,1003,34543456;
    insert into @Cards(cardName,cardURL)
    select 'BOA','BOA.com' union all
    select 'DCU','DCU.com' union all
    select 'Citizen','Citizen.com' union all
    select 'Citi','Citi.com' union all
    select 'Americal Express','AME.com';
    insert into @Client(name)
    select 'AMC1' union all
    select 'AMC2'
    insert into @company(name,ClientId)
    select 'Microsoft',1 union all
    select 'Facebook',1 union all
    select 'Google',2;
    insert into @company_cards(CompanyId,IdCard)
    select 1,1000 union all
    select 1,1001 union all
    select 1,1002 union all
    select 1,1003 union all
    select 2,1000 union all
    select 2,1001 union all
    select 2,1002;
    Requirement : 
    1. Get the distict Users card details. the reason for using distinct is, user can have same card multiple with different UserCardNumber.
    Ex : user can have more than BOA card in the @usercards table with different UserCardNumber. But though he has two BOA card, my query should take one row.
    2. After the 1st step, i need to check if any details on @company_cards based on Users companyId.If yes then selct the details from @company_cards. if not select it from @client_cards
    In this case we need to make sure that we shouln't have repeated data on @FinalData table. 
    My Logic:
    Declare @FinalData table (IDCard int,CardName varchar(50),CardURL varchar(50))
    declare @IdUser int = 100, @ClientID int,@companyID int;
    select @ClientID = ClientID,@companyID = CompanyId from @users where IDUser = @IdUser;
    insert into @FinalData (IDCard,CardName,CardURL)
    Select distinct c.IdCard,c.cardName,c.cardURL from @usercards UC join @Cards C on(uc.IdCard = c.IdCard)
    where IDUser=@IdUser;
    if exists(select 1 from @company_cards where @companyID = @companyID)
    BEGIN
    insert into @FinalData(IDCard,CardName,CardURL)
    select c.IdCard,c.cardName,c.cardURL from @company_cards cc join @Cards c on(cc.IdCard = c.IdCard) where CompanyId = @companyID
    and cc.IdCard not in(select IDCard from @FinalData);
    END
    ELSE
    BEGIN
    insert into @FinalData(IDCard,CardName,CardURL)
    select c.IdCard,c.cardName,c.cardURL from @client_cards cc join @Cards c on(cc.IdCard = c.IdCard) where ClientID = @ClientID
    and cc.IdCard not in(select IDCard from @FinalData);
    END
    select * from @FinalData;
    the logic produces the valid result. Is there any alternative way to achieve this logic. I feel there might be some proper way to query this kind of logic. any suggestion please.
    [the sample schema and data i provided just to test. i didn't include the index and etc.]
    loving dotnet

    You can simply merge the statements like below
    Declare @FinalData table (IDCard int,CardName varchar(50),CardURL varchar(50))
    declare @IdUser int = 100
    ;With CTE
    AS
    Select IdCard, cardName, cardURL,
    ROW_NUMBER() OVER (PARTITION BY IdCard ORDER BY Ord) AS Seq
    FROM
    Select c.IdCard,c.cardName,c.cardURL,1 AS Ord
    from @usercards UC join @Cards C on(uc.IdCard = c.IdCard)
    where IDUser=@IdUser
    union all
    select c.IdCard,c.cardName,c.cardURL,2
    from @company_cards cc join @Cards c on(cc.IdCard = c.IdCard)
    join @users u on u.CompanyId = cc.CompanyId
    where u.IDUser = @IdUser
    union all
    select c.IdCard,c.cardName,c.cardURL,3
    from @client_cards cc join @Cards c on(cc.IdCard = c.IdCard)
    join @users u on u.ClientID= cc.ClientID
    where u.IDUser = @IdUser
    )t
    insert into @FinalData (IDCard,CardName,CardURL)
    SELECT IdCard, cardName, cardURL
    FROM CTE
    WHERE Seq = 1
    select * from @FinalData;
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Urgent help needed: registry.dat is missing when i run my form in web base

    Hi gurus,
    i configured my forms and report server in windows 2003 and i received the following error msg when tryin to access my web base forms 6I.
    FRM-92129: Registry file http://domain.com/form60java/oracle/forms/registry/Registry.dat is missing.
    Details...
    Java Exception:
    oracle.forms.engine.RunformException: FRM-92120: Registry file http://domain.com/form60java/oracle/forms/registry/Registry.dat is missing.
    at oracle.forms.engine.Runform.initRegistry(Unknow Source)
    at oracle.forms.engine.Runform.startRegistry(Unknow Source)
    at oracle.forms.engine.Main.createRunform(Unknow Source)
    at oracle.forms.engine.Main.start(Unknow Source)
    at sun.applet.JinitAppletPanel.run(Compiled code)
    at java.lang.Tread.run(Thread.java:466)
    what can be goes wrong with my steps to receive the above error?? i tried in windows XP and Vista, and i getting the same error message as above.
    Your urgent help and advise is needed plssssssss.......
    Many thanks in advance.

    The URL doesn't seem correct: http://domain.com/form60java/oracle/forms/registry/Registry.dat
    I'm expecting a slash (/) between forms60 and java. Have a look in the formsweb.cfg if any paths are misconfigured.
    Also, try if the URL with the slash:
    http://domain.com/form60/java/oracle/forms/registry/Registry.dat
    does work when you just paste it in a browser. It should download the Registry.dat file

  • Mapping conversion help needed for date

    Hi Experts,
    I need help in message mapping convesion for date field
    The source date field can have value '2010-06-04T02:09:59.610-07:00' or 2010-06-04T02:09:60.610-07:00
    I have to change it to '2010-06-04T02:09:59.000-07:00'. ie, if the seconds are 59.XXX, or 60.XXX, then change to 59.000.
    Please let me know the best way to do this
    Thanks
    Mike

    Again, to make it more clear
    The source date field can have any date value such as
      2010-06-04T02:09:59.610-07:00 -
    This needs to be changed to 2010-06-04T02:09:59.000-07:00
      2010-06-04T02:09:60.610-07:00 -- This needs to be changed to 2010-06-04T02:09:59.000-07:00
    2010-06-04T02:09:60.000-07:00 -- This needs to be changed to 2010-06-04T02:09:59.000-07:00
    2010-06-04T02:09:59.000-07:00  - This need not be changed
    2010-06-04T02:09:58.610-07:00 -- This need not be changed
    2010-06-04T02:09:57.610-07:00  etc etc - These need not be changed.
    The only change using date function is for the first two dates, in which 59.XXX and 60.XXX need to be replaced with  59.000
    Using the above date function, all the seconds 59.XXX, 58.XXX, 60.XXX, etc etc,,, are converted to 59.000, 58.000 and 60.000
    I dont need this as per the requirement. So looks like the UDF needs to be altered a little to accomodate my requirement.
    Please help me.
    Thanks
    Mike

  • Help needed with data security

    I need to return my Thinkpad for service but I am concerned with security. For instance, my facebook account as well as other accounts log on automatically because the passwords are automatically remembered. How do I keep my confidential information safe while the laptop is in the technicians hands?
    BTW, one of the problems that it has is that I cannot backup successfully with the lenovo application... I managed to get a backup completed with the windows backup program, but I'm not sure of it's integrity.
    Please help me with this, Thanks!

    Hi,
    If I understand you correctly, you suspect software problems.
    The first thing the techs will do (probably) is re-image your HDD.  I hope you have you important data backed up somewhere - especially if you don't trust the Windows backup.
    For that matter, if you do have software issues, restoring a full backup will also restore the problem.
    You've probably already considered this, but just in case...
    Z.
    The large print: please read the Community Participation Rules before posting. Include as much information as possible: model, machine type, operating system, and a descriptive subject line. Do not include personal information: serial number, telephone number, email address, etc.  The fine print: I do not work for, nor do I speak for Lenovo. Unsolicited private messages will be ignored. ... GeezBlog
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

  • Help needed in data type casting

    I have a java program which will receive data and its type in the String format. During program execution, the data in the String data has to be converted into the respective data type and assigned to a variable of that data type so that it could be used in the program. Programmer may not know the type of data that the value has to be converted into.
    I really got struck up with this. This is a RMI application and one process node is sending the data to another node in the String format and the type of data it should get converted into so that it can be converted into the respective type and used for computation.
    Can you understand what I am asking for ....if you can pls help and it is highly appreciated

    I dont know whether i ahve expressed it correctly
    look at this code
    dataPacket sendtoNode = send.senDatatoNode(inputReq);
    String recnodnum = sendtoNode.nodeNum;
    String recvarnum = sendtoNode.varNum;
    String recvartype = sendtoNode.dataType;
    String recvalvalue     = sendtoNode.dataVal;
    int num;     int type;
    double result;
    // here in this case the result variable type is double
    if (recvartype.equals("int")){
              type = 1;
         result = Integer.parseInt(recvalvalue); will pose problem
         else
         if (recvartype.equals("double")){
              type = 2;
              result = Double.parseDouble(recvalvalue);
         else
         if(recvartype.equals("float")){
              type =3;
              result = Float.parseFloat(recvalvalue); will pose problem
         else
         if(recvartype.equals("Boolean")){
              if ((recvalvalue.equals("true")) || (recvalvalue.equals("TRUE")))
              type = 4;
              result = Boolean.parseBoolean(recvalvalue); will pose problem
         else
         if(recvartype.equals("char")){
              type = 5;
              result = (char)recvalvalue; will pose problem
    else
    if(recvartype.equals("String")){
         type = 6;
              result = recvalvalue; will pose problem
         else
         if(recvartype.equals("byte")){
              type = 7;
              result = Byte.parseByte(recvalvalue); will pose problem
         else
         if(recvartype.equals("long")){
              type = 8;
              result = Long.parseLong(recvalvalue); will pose problem
         else
         if(recvartype.equals("short")){
              type = 9;
              result = Short.parseShort(recvalvalue); will pose problem
         //forvarval varvalue = new forvarval();
         //varvalue.forvarval(recvartype, recvalvalue);
    // this has to be done after sorting the problem of type casting string result = recvalvalue;
    //result = value; //<this will surely give me a problem as i m assigning string to double>??
    send.host(result);
    System.out.println("result received and the result is " +recvalvalue );
    now i need to assign the converted string in to a variable and use in the compuation ..thts where the challenge n not in teh conversion process...

  • Help needed on the logic used to display ERP Sales order in CRM WEB UI

    Hi,
    I have a requirement where i need to trigger an activity/workflow in CRM for orders that are created through ERP Salesorder functionality. In the workflow list, we need to give the order description and provide an hyperlink to the order number. on selection of order number, it should display the ERP sales order. To achive this in workflow, i am trying to understand the as-is standard functionality which is available in Agent Inbox search on ERP sales order.This search is getting the ERP orders and on selecting the order it is opening the ERO sales order page. I tried debugging the method GET_MAINCATAEGORY available in the component iccmp_inbox and in the view Inboxsearch.But couldnt really able to crack the logic how it is retrieving the ERP sales order from inbox search. Any pointers on how this is achieved will be of great help.
    Thanks,
    Udaya

    Hi Denis,
    very good idea. I thougt myself about that workaround, but it is not really that for what I searched.
    I mean the "SAP Query" is a really good standard tool, that are used by many customers. That is why think there must be a standard way to display the SAP Query in the Web UI without using Transaction Launcher.
    But it seems that there is no way, except of the transaction launcher or by using an additional analyse system like SAP BI.
    By the way do you know a Web UI compoment which enable the user to start reports like SE38?
    Regards
    Fabian

  • Help in implementing date logic calculation

    Hello,
    We need to implement below logic in our Webi report:
    Report Logic: Any Purchase_Order whose delivery (Promised Date) is pending next in 15 days and also any pending deliveries which has not happened beyond 15 days.
    Please suggest how the above logic can be implimented at the report level or at the Universe level.
    I have tried with below object at the universe level but it is not giving correct results.
    case when (sysdate - DWH_SSS_PO_LINE_LOC_DETAILS.PROMISED_DATE>=15) or (DWH_SSS_PO_LINE_LOC_DETAILS.PROMISED_DATE-sysdate<15 ) and DWH_SSS_PO_LINE_LOC_DETAILS.QUANTITY_RECEIVED=0 then 'Y'  else 'N' end
    It is BOXI3.1 SP7 on Oracle 11g db.
    Thank you.
    Regards,
    Kaustubh Ghate

    Hi Kaustubh,
    You could use DaysBetween function in WebI.
    So the formula would be  like the following:-
    If (DaysBetween(Currdate;Promise date)<=15) then Purchase Order
    And for the second one:-
    Pending Deliveries Where (DaysBetween(Promise date;Currdate)<15)
    Let me know if the above works.
    Regards,
    Manpreet

  • Help needed for Data Pump.

    Hi,
    I am using oracle 11g release2 and I am not able to find data pump utility in SQL developer.
    Please let me know, if I need to install it. I am new to this utility.
    Thanks.

    I do not believe SQL Developer would have DataPump utility.
    As the name implies, SQL Developer is intended to be used as a tool to facilitate development (typically of SQL code), as well as provide additional features to assist developers in their daily routines.
    DataPump, is more of a DBA tool used for extracting logical copies of data from an existing database and/or port to another database. To use this utility, you would typically need to be in the dba group (although not necessary if configured properly). But at least on the same server as the datapump utility software resides.
    There are many options and features to using datapump, including network_link which allows extraction of data from a remote database to another database on a different server without ever creating a file on the operating system.
    If I recall correctly, I believe in older versions of Oracle client (e.g., 8.x), the Oracle client provided the export/import utility. But those days are long gone now. With datapump, it is primary a DBA tool.

  • Help Needed with Data-modeling to build an application on

    Hi would anyone be able to help me in creating a data model  cause im really stuck with this one .Basically if been asked to create a survey application in oracle apex that use to excel based . So the info i was given was in a form of  excel sheet which looks like this
    NAME
    E-MAIL
    TSSA
    ORACLE
    HP
    IBM
    MS
    SAP
    INTERGRAPH
    CISCO
    Relationship
    Contracting
    Performance
    Architecture
    Supplier Feedback
    comments
    Jxxxxxx yyyyyyf
    [email protected]
    Yes
    Yes
    Yes
    Yes
    x
    requested to be added
    nnnitha iiiiiah
    [email protected]
    Yes
    Yes
    Yes
    x
    x
    Knnnn kkkikot
    [email protected]
    Yes
    x
    x
    is not payed
    Gggrt Louuuue
    [email protected]
    Yes
    Yes
    Yes
    Yes
    Yes
    Yes
    Yes
    Yes
    x
    x
    x
    x
    jeiiiha ad
    [email protected]
    Yes
    x
    to meet with
    John Rat
    [email protected]
    Yes
    x
    x
    So where it says yes thous are the vendors that people associated with them have to asses and where there's an X thous are the topics that the vendors have to be rated on . So if for example the first guy on the list Jxxxxxx yyyyyyf will asses TSSA , ORACLE, HP , IBM , MS , SAP  on the topic of Architecture and if you look at the second user nnnitha iiiiiah he would rate TSSA , ORACLE , INTERGRAPH on the topics of Relationship and performance  . Any idea how i could data model this to get my table structures right .so that features like completion status could be displayed to the user through APEX which can only be done by a correct data-model i have tried normalization but  i did go anywhere becauce there are so many variations any idea on how you would go about data modeling this would be greatly appreciated thank you    

    Not really an APEX specific question..  Maybe you should try posting this in the data modeler forum : SQL Developer Data Modeler
    Thank you,
    Tony Miller
    LuvMuffin Software

  • Help needed in business logic implmentation in oracle sql.

    I got a requirement from customer that i need to generated numbers based on first value which is entered by users but not second values..
    for example:
    c1 c2
    1 1
    2 1
    3 1
    4 1
    1 2
    2 2
    3 2
    4 2
    1 3
    2 3
    3 3
    4 3
    1 4
    2 4
    3 4
    4 4
    1 5
    2 5
    3 5
    4 5
    unlimited..
    the user input only first column values which comes from UI and i need to provide second column values when records are getting inserted into db table.
    user always enter only 1-4 values in first column but never input second values in second column of table.. both columns are numerical.
    the second values should be provided automatically or programmatically when records are getting inserted into table and automatically... how this can be done?
    Can any one help me out to get this done either using sql,plsql concept?
    thanks a lot in advance.

    Hi,
    Demonstration
    SQL> DROP TABLE t1;
    Table supprimée.
    SQL> CREATE TABLE t1 (c1 NUMBER, c2 NUMBER);
    Table créée.
    SQL>
    SQL> insert into t1 (c1) values(1);
    1 ligne créée.
    SQL> insert into t1  (c1) values(2);
    1 ligne créée.
    SQL> insert into t1 (c1) values(3);
    1 ligne créée.
    SQL> insert into t1 (c1) values(4);
    1 ligne créée.
    SQL> insert into t1 (c1) values(1);
    1 ligne créée.
    SQL> insert into t1 (c1) values(2);
    1 ligne créée.
    SQL> insert into t1 (c1) values(3);
    1 ligne créée.
    SQL> insert into t1 (c1) values(4);
    1 ligne créée.
    SQL> insert into t1 (c1) values(1);
    1 ligne créée.
    SQL> insert into t1 (c1) values(2);
    1 ligne créée.
    SQL> commit;
    Validation effectuée.
    SQL>
    SQL> CREATE OR REPLACE VIEW view_t1
      2  AS
      3     SELECT c1, ROW_NUMBER () OVER (PARTITION BY c1 ORDER BY c1) c2
      4       FROM t1;
    Vue créée.
    SQL>
    SQL>
    SQL> SELECT   c1,c2
      2      FROM view_t1
      3  ORDER BY c2, c1;
            C1         C2
             1          1
             2          1
             3          1
             4          1
             1          2
             2          2
             3          2
             4          2
             1          3
             2          3
    10 ligne(s) sélectionnée(s).
    SQL>

  • Help needed in Count Logic

    Hi Following are my table structure and data . i have two column( No.of.Fields , Text)
    No.of.Fields | Text
    8 | YYYYYYYY
    6 | YYYYYY
    4 | NNNN
    3 | NNN
    2 | YYYYY
    i want a sample query to validate the no.field count and Text char count matches. if that doesn't match i want to get the particular record details.
    In the above sameple no.of field 2 has exceeds char count. actual text shoulod be "YY".
    so please help me to identify the rows which has non matached. i have more than 500 records in the table. please help me on this by providing the sample.

    Hi.
    >
    Don't forget about NULLs:
    >
    Thanks you're right, it depends on how he want to deal with nulls, e.g. if we assume that nulls have a length of 0
    Here's one way:
    WITH data AS
         SELECT 8 n,'YYYYYYYY' string FROM DUAL UNION ALL
         SELECT 6 n,'YYYYYY' string FROM DUAL UNION ALL
         SELECT 4 n,'NNNN' string FROM DUAL UNION ALL
         SELECT 3 n,'NNN' string FROM DUAL UNION ALL
         SELECT 2 n,'YYYYY' string FROM DUAL UNION ALL
         SELECT 8 n,'YYYYYYY' string FROM DUAL UNION ALL
         SELECT 6 n,'YYYYY' string FROM DUAL UNION ALL
         SELECT 4 n,'NNN' string FROM DUAL UNION ALL
         SELECT 3 n,'NN' string FROM DUAL UNION ALL
         SELECT 2 n,'YYYY' string FROM DUAL UNION ALL
         SELECT 0 n,null string FROM DUAL UNION ALL
         SELECT 1 n,null string FROM DUAL
    SELECT
         n,
         string,
         NVL(LENGTH(string),0) ls
    FROM data
    WHERE n != NVL(LENGTH(string),0);
    N     STRING     LS
    2     YYYYY     5
    8     YYYYYYY     7
    6     YYYYY     5
    4     NNN     3
    3     NN     2
    2     YYYY     4
    1     (null)     0Best regards.

  • URGENT help needed:Address data missing after QA Refresh from PRD

    All,
    Address data for almost all user-ids are missing after QA Refresh from PRD.
    In QA, after importing the User-Master although its shows successful. The detailed log shows:
       Data inconsistency in USR21. Start RSADRCK2 (See Note 459763)
       Exit program AFTER_IMP_ADDRESS3 successfully executed
       SAP user has no address SAP*
       Error while deleting ADRVP for SAP*
       SAP user has no address SAPCPIC...
       ERROR: Type "F" user exit with SYS_ERROR:     SUSR_CLIENTCOPY_USERBUF_RESET
    We also do a Table export - import wherein the tables
    USR03
    USR07
    USR09
    USR20
    USR21
    USR30
    are included.
    The no. of entries exported and imported are same.
    Also FYI in the User-master Transport i can see the following Tables included in the object list
    USR01
    USR02
    USR04
    USR05
    USR06
    USR08
    USR14
    USR21S
    USR22
    USRACL
    USREXTID
    USREXTIDH
    Has anyone seen this before?
    Any body has any ideas?

    Hello Bidwan,
    I think it is an issue with company address. Just check if  company addresses are existing the source client ?After client copy company addreses of target client will only exist in source client. Then if you do impot of the transport containing USR* tables it will try to assign old company addresses to the users but probably they are not exisitng in target client any more.
    If this is the case then you need to create those company addresses again using SUCOMP and then once again import the transport for user master.
    Regards.
    Ruchit.

  • Help needed on Data Carrier

    Hi,
    We have a scenario where in we need to have three Data Carriers. One for PCs, One for NWBC and another for Citrix clients. We created them as shown in the screen shot.
    Further these were linked to frontend as shown in the attachment.
    Since NWBC is taking PC as default, we kept PC for NWBC. Created TR for CITRIX and VC for Individual PC.  Even after this setting, while accessing a drawing from ECC system takes up PC and looks for viewer linked to ACAD application and PC data carrier.  System should have chosen VC as I have mentioned it so.
    Experts, now let me know whether I have done some mistake in setting up the data carriers?
    Regards,
    Gireesh

    Hi,
    We have a scenario where in we need to have three Data Carriers. One for PCs, One for NWBC and another for Citrix clients. We created them as shown in the screen shot.
    Further these were linked to frontend as shown in the attachment.
    Since NWBC is taking PC as default, we kept PC for NWBC. Created TR for CITRIX and VC for Individual PC.  Even after this setting, while accessing a drawing from ECC system takes up PC and looks for viewer linked to ACAD application and PC data carrier.  System should have chosen VC as I have mentioned it so.
    Experts, now let me know whether I have done some mistake in setting up the data carriers?
    Regards,
    Gireesh

Maybe you are looking for