How to Load a data for database when format is different??

Hai all...
I have problem in Apex while loading the data to a database from external files..
Like i have my project input data in spreadsheet format..I wanted to load that in to Database..
But sequence and column names are different in spreadsheet and database tables.
My problem is like.....
In manual input format(spreadsheet) column names are employee names and while loading that to database i want to load that in a separate column named emp_name..
It looks as below
Manual data is like this:
WEEK ENDING DATE          Abc          Xyz          Pqr          
15-Nov-08                    71.4          50          100          
22-Nov-08                    76.9          100          100          
i have database table like this
Column Name               Data Type     
EMP_NAME               VARCHAR2(100)     
WEEK_END_DATE          DATE     
PERCENTAGE               NUMBER(2,0)     
So I should be able to store like this
Emp_name          Week_end_date      Percentage
Abc               15-Nov-08               71.4
Xyz               15-Nov-08          50     
Pqr               15-Nov-08               100
Abc               22-Nov-08               76.9
Xyz               22-Nov-08     100
pqr 22-Nov-08               100
But i am not able to get that..
Can any one suggest me how to do that in Apex..??
Should I use SQL loader for that???or do I have any option in Apex??or i should go for C program??
Thanks and Regards
Shan

Hello Shan,
You can access a CSV as an "External Table" (search on that). Then you can access the CSV as it was a 'normal' table and process data into your real tables.
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this reply by marking it as either Helpful or Correct ;-)

Similar Messages

  • How to load a data from XML when a data is clicked in a datagrid

    Hi,
         I have populated a datagrid with XML data. My requirement is like, whenever a user clicks on a particular data i need to load a popup based on the data that he has selected.
         I'm using advanced datagrid in this process and i'm not able to trace the element that the user has selected in the datagrid.
         It would be great if someone could help me on how to trace this particular element and how to load the corresponding xml values. It really a burning issue in my project.

    Will this work for you:
    dataGrid.selectedItem.@yourfieldname
    with popup:
    var popupWindow:TitleWindow = new TitleWindow;
    popupWindow = showPopupWindow(DisplayObject(FlexGlobals.topLevelApplication), yourclassname);
    popupWindow.someproperty = dataGrid.selectedItem.@yourfieldname
    public function showPopupWindow(parent:DisplayObject, WhatToShow:Class):TitleWindow
         var popupWindow:TitleWindow =
         TitleWindow(PopUpManager.createPopUp(parent, WhatToShow, true));
          PopUpManager.centerPopUp(popupWindow);
          return popupWindow;
    Nothing to write home about, but hope it helps a bit.

  • How to Load Next Data to LongListSelector when Scrolling reaches at the end of the LongListSelector

    I need to call a function LoadNextData() on reaching at the end of the LongListSelector . I tried to Implement using the msdn twitter sample(https://code.msdn.microsoft.com/windowsapps/TwitterSearch-Windows-b7fc4e5e) with Incremental Loading but it uses
    ItemRealized and ItemUnRealized  events. But when i used these events , they fires only when an item is added or removed from list what should i do?  Is there any alternative ? When i Scroll to the bottom these events are not fired . Is there any
    way to solve this?

    Hi Joel,
    Based on my knowledge, the sample uses the ItemRealized event handler to check if the app need load more data.
    if ((e.Container.Content as TwitterSearchResult).Equals(resultListBox.ItemsSource[resultListBox.ItemsSource.Count - _offsetKnob]))
    Debug.WriteLine("Searching for {0}", _pageNumber);
    _viewModel.LoadPage(_searchTerm, _pageNumber++);
    The above code snippet ask for more if the app trigger certain conditions. I’ve tested the code sample you provided. It worked. If you still cannot make it working, please post more information for reproduction.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate
    the survey.

  • SEM-BPS how to load additional data for special users at runtime?

    Let´s assume you have a transactional info cube which contains SD Data from the source system.
    If you want to show additional data, let´s say the attributes of the sold materials which can be read in the table MARA of the source system (provided you use R/3, etc.)
    and you only want to show this data for a small amount of users, which need to see it, then i wonder how to do  this.
    am i right, that i can use the exit functions to init key figures, i.e. i could write some code which connects to the source system over RFC, downloads the data at runtime and presents it at the users excel sheet????
    moreover, is it necessary to extend the existing cube, just to achieve this aim?
    Message was edited by: Gideon Lenz

    Hello Gideon,
    there's no need to program anything. You can display any attribute in planning layouts. In your case you would extract the master data from material from SAP R/3 (MARA) into BW. The setup the layout to show the required attribute(s) in the layout in BPS.
    If the attribute is relevant only for a specific user group, just give them access to this "special" layout (create a planning folder or web interface for this group).
    Regards
    Marc
    SAP NetWeaver RIG

  • Helped, how to load xml data into database

    Hi,
    Given a DTD, can the XML SQL Utility generate
    the database schema?
    I currently have the dtd file to define
    the data type and xml data and I am looking
    for ways of how the XML/DTD can be loaded
    into the oracle db.
    Any suggestions/recommendations are
    appreciated.
    Thanks,
    Judy
    null

    You could check out this web site:
    http://www.rpbourret.com/xml/XMLAndDatabases.htm#software
    where you can find a list of products that can translate a DTD to a relational schema. Also, there are several technical papers that discuss algorithms to carry out this translation. FYI, We have implemented a similar system,and testing it out.
    null

  • How to load master data texts for (0calmonth)

    Hi pro's
    i hve a issue.
    How to load master data texts for 0calmonth.
    any help is appreciated
    regards
    cheers

    within the admin workbench goto source systems, right click on your source system and click on transfer global settings. There you can choose fiscal year variants and some other options to be loaded to BW.
    Regards

  • How can I purchase items for app when the app was loaded on another ID before? I has to Chang my AppleID and also transferred an app to new phone. I can't purchase items for app because it wants me to buy the app through new ID. The app was free.

    How can I purchase items for app when the app was loaded on another ID before? I has to Chang my AppleID and also transferred an app to new phone. I can't purchase items for app because it wants me to buy the app through new ID. The app was free.

    All apps (and other content from the store) are tied to the account that downloaded them, whether or not they are free. To do in-app purchases in that app you will either need to log in with the account that downloaded it, or delete it (which will delete its content) and download it with your currently logged in account if you want to do IAPs on that account.

  • How to load the data from .csv file to oracle table???

    Hi,
    I am using oracle 10g , plsql developer. Can anyone help me in how to load the data from .csv file to oracle table. The table is already created with the required columns. The .csv file is having about 10lakh records. Is it possible to load 10lakh records. can any one please tell me how to proceed.
    Thanks in advance

    981145 wrote:
    Can you tell more about sql * loader??? how to know that utility is available for me or not??? I am using oracle 10g database and plsql developer???SQL*Loader is part of the Oracle client. If you have a developer installation you should normally have it on your client.
    the command is
    sqlldrType it and see if you have it installed.
    Have a look also at the FAQ link posted by Marwin.
    There are plenty of examples also on the web.
    Regards.
    Al

  • 11.5.10.2 to R12.1.1 upgrade: Error loading seed data for GL_DEFAS_ACCESS_SETS:  DEFINITION_ACCESS_SET = SUPER_USER_DEFAS,  ORA-06508: PL/SQL: could not find program unit being called

    Hello,
    EBS version : 11.5.10.2
    DB version : 11.2.0.3
    OS version : AIX 6.1
    As a part of 11.5.10.2 to R12.1.1 upgrade, while applying merged 12.1.1 upgrade driver(u6678700.drv), we got below error :
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ATTENTION: All workers either have failed or are waiting:
               FAILED: file glsupdas.ldt on worker  3.
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    drix10:/fmstop/r12apps/apps/apps_st/appl/admin/FMSTEST/log>tail -20 adwork003.log
    Restarting job that failed and was fixed.
    Time when worker restarted job: Wed Aug 07 2013 10:36:14
    Loading data using  FNDLOAD function.
    FNDLOAD APPS/***** 0 Y UPLOAD @SQLGL:patch/115/import/glnlsdas.lct @SQLGL:patch/115/import/US/glsupdas.ldt -
    Connecting to APPS......Connected successfully.
    Calling FNDLOAD function.
    Returned from FNDLOAD function.
    Log file: /fmstop/r12apps/apps/apps_st/appl/admin/FMSTEST/log/US_glsupdas_ldt.log
    Error calling FNDLOAD function.
    Time when worker failed: Wed Aug 07 2013 10:36:14
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    drix10:/fmstop/r12apps/apps/apps_st/appl/admin/FMSTEST/log>tail -20 US_glsupdas_ldt.log
    Current system time is Wed Aug  7 10:36:14 2013
    Uploading from the data file /fmstop/r12apps/apps/apps_st/appl/gl/12.0.0/patch/115/import/US/glsupdas.ldt
    Altering database NLS_LANGUAGE environment to AMERICAN
    Dumping from LCT/LDT files (/fmstop/r12apps/apps/apps_st/appl/gl/12.0.0/patch/115/import/glnlsdas.lct(120.0), /fmstop/r12apps/apps/apps_st/appl/gl/12.0.0/patch/115/import/US/glsupdas.ldt) to staging tables
    Dumping LCT file /fmstop/r12apps/apps/apps_st/appl/gl/12.0.0/patch/115/import/glnlsdas.lct(120.0) into FND_SEED_STAGE_CONFIG
    Dumping LDT file /fmstop/r12apps/apps/apps_st/appl/gl/12.0.0/patch/115/import/US/glsupdas.ldt into FND_SEED_STAGE_ENTITY
    Dumped the batch (GL_DEFAS_ACCESS_SETS SUPER_USER_DEFAS , GL_DEFAS_ACCESS_SETS SUPER_USER_DEFAS ) into FND_SEED_STAGE_ENTITY
    Uploading from staging tables
      Error loading seed data for GL_DEFAS_ACCESS_SETS:  DEFINITION_ACCESS_SET = SUPER_USER_DEFAS,  ORA-06508: PL/SQL: could not find program unit being called
    Concurrent request completed
    Current system time is Wed Aug  7 10:36:14 2013
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Below is info about file versions and INVALID packages related to GL.
    PACKAGE BODY GL_DEFAS_ACCESS_SETS_PKG is invalid with error component 'GL_DEFAS_DBNAME_S' must be declared.
    I can see GL_DEFAS_DBNAME_S is a VALID sequence accessible by apps user with or without specifying GL as owner.
    SQL> select text from dba_source where name in ('GL_DEFAS_ACCESS_DETAILS_PKG','GL_DEFAS_ACCESS_SETS_PKG') and line=2;
     TEXT
    /* $Header: glistdds.pls 120.4 2005/05/05 01:23:16 kvora ship $ */
    /* $Header: glistddb.pls 120.16 2006/04/10 21:28:48 cma ship $ */
    /* $Header: glistdas.pls 120.4 2005/05/05 01:23:02 kvora ship $ */
    /* $Header: glistdab.pls 120.5 2006/03/13 19:56:21 cma ship $ */ 
    SQL> select * from all_objects where object_name in ('GL_DEFAS_ACCESS_DETAILS_PKG','GL_DEFAS_ACCESS_SETS_PKG')
      2 ; OWNER OBJECT_NAME SUBOBJECT_NAM OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS T G S NAMESPACE
    EDITION_NAME
    APPS GL_DEFAS_ACCESS_DETAILS_PKG 1118545 PACKAGE 05-AUG-13 05-AUG-13 2013-08-05:18:54:51 VALID N N N 1 
    APPS GL_DEFAS_ACCESS_SETS_PKG 1118548 PACKAGE 05-AUG-13 06-AUG-13 2013-08-05:18:54:51 VALID N N N 1 
    APPS GL_DEFAS_ACCESS_SETS_PKG 1128507 PACKAGE BODY 05-AUG-13 06-AUG-13 2013-08-06:12:56:50 INVALID N N N 2 
    APPS GL_DEFAS_ACCESS_DETAILS_PKG 1128508 PACKAGE BODY 05-AUG-13 05-AUG-13 2013-08-05:19:43:51 VALID N N N 2 
    SQL> select * from all_objects where object_name='GL_DEFAS_DBNAME_S'; OWNER OBJECT_NAME SUBOBJECT_NAM OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS T G S NAMESPACE
    EDITION_NAME
    GL GL_DEFAS_DBNAME_S 1087285 SEQUENCE 05-AUG-13 05-AUG-13 2013-08-05:17:34:43 VALIDN N N 1 
    APPS GL_DEFAS_DBNAME_S 1087299 SYNONYM 05-AUG-13 05-AUG-13 2013-08-05:17:34:43 VALIDN N N 1 
    SQL> conn apps/apps
    Connected.
    SQL> SELECT OWNER, OBJECT_NAME, OBJECT_TYPE, STATUS
    FROM DBA_OBJECTS
    WHERE OBJECT_NAME = 'GL_DEFAS_ACCESS_SETS_PKG'; 2 3 OWNER OBJECT_NAME OBJECT_TYPE STATUS
    APPS GL_DEFAS_ACCESS_SETS_PKG PACKAGE VALID
    APPS GL_DEFAS_ACCESS_SETS_PKG PACKAGE BODY INVALID SQL> ALTER PACKAGE GL_DEFAS_ACCESS_SETS_PKG COMPILE; Warning: Package altered with compilation errors. SQL> show error
    No errors.
    SQL> ALTER PACKAGE GL_DEFAS_ACCESS_SETS_PKG COMPILE BODY; Warning: Package Body altered with compilation errors. SQL> show error
    Errors for PACKAGE BODY GL_DEFAS_ACCESS_SETS_PKG: LINE/COL ERROR
    39/17 PLS-00302: component 'GL_DEFAS_DBNAME_S' must be declared 
    drix10:/fmstop/r12apps/apps/apps_st/appl/gl/12.0.0/patch/115/odf>cat $GL_TOP/patch/115/sql/glistdab.pls|grep -n GL_DEFAS_DBNAME_S
    68: SELECT GL.GL_DEFAS_DBNAME_S.NEXTVAL
    81: fnd_message.set_token('SEQUENCE', 'GL_DEFAS_DBNAME_S');
    SQL> show user
    USER is "APPS"
    SQL> SELECT GL.GL_DEFAS_DBNAME_S.NEXTVAL
      FROM dual; 2                         -- with GL.
      NEXTVAL
      1002
    SQL> SELECT GL_DEFAS_DBNAME_S.NEXTVAL from dual;               --without GL. or using synonym.
      NEXTVAL
      1003
    drix10:/fmstop/r12apps/apps/apps_st/appl/gl/12.0.0/patch/115/odf>strings -a $GL_TOP/patch/115/sql/glistdab.pls|grep '$Header'
    REM | $Header: glistdab.pls 120.5 2006/03/13 19:56:21 cma ship $ |
    /* $Header: glistdab.pls 120.5 2006/03/13 19:56:21 cma ship $ */
    drix10:/fmstop/r12apps/apps/apps_st/appl/gl/12.0.0/patch/115/odf>strings -a $GL_TOP/patch/115/sql/glistdas.pls |grep '$Header'
    REM | $Header: glistdas.pls 120.4 2005/05/05 01:23:02 kvora ship $ |
    /* $Header: glistdas.pls 120.4 2005/05/05 01:23:02 kvora ship $ */

  • Cannot provide connect data for database target system CONFIG_DB

    Hello,
    I'm trying to install SP22 in NW04 but I'm getting an error on step 11 Deploy JDDI
    Cannot provide connect data for database target system "CONFIG_DB".
    Cannot connect to database: Cannot create class loaders for DB target system CONFIG_DB.
    ERROR      2008-10-01 17:51:09
               CJSlibModule::writeError_impl()
    MUT-03025  Caught ESAPinstException in Modulecall: ESAPinstException: error text undefined.
    ERROR      2008-10-01 17:51:09 [iaxxinscbk.cpp:289]
               abortInstallation
    MUT-02041  SDM call of deploySdaList ends with returncode 4. See output of logfile C:\Program Files\sapinst_instdir\PATCH\MSS\callSdmViaSapinst.log.
    callSdmViaSapinst.log:
    com.sap.sdm.apiint.serverext.servertype.TargetServiceException: Cannot provide connect data for database target system "CONFIG_DB".
    Additional error message is:
    com.sap.sdm.serverext.servertype.dbsc.DatabaseConnectException: Cannot connect to database: Cannot create class loaders for DB target system CONFIG_DB.
    Additional error message is:
    com.sap.sdm.util.classloaders.SDMClassLoaderException: Cannot create class loader for component com.sap.sdm.serverext.servertype.dbsc.SERVEREXT_DBSC_EXTERN(CONFIG_DB): Referenced loader #0 for component com.sap.sdm.serverext.servertype.dbsc.JDBC_DRIVER(D:\usr\sap/WDA/DVEBMGS00/j2ee\jdbc\base.jar;D:\usr\sap/WDA/DVEBMGS00/j2ee\jdbc\util.jar;D:\usr\sap/WDA/DVEBMGS00/j2ee\jdbc\sqlserver.jar;D:\usr\sap/WDA/DVEBMGS00/j2ee\jdbc\spy.jar) is not available.
    Additional error message is:
    com.sap.sdm.util.classloaders.SDMClassLoaderException: Cannot create class loader for component com.sap.sdm.serverext.servertype.dbsc.JDBC_DRIVER(D:\usr\sap/WDA/DVEBMGS00/j2ee\jdbc\base.jar;D:\usr\sap/WDA/DVEBMGS00/j2ee\jdbc\util.jar;D:\usr\sap/WDA/DVEBMGS00/j2ee\jdbc\sqlserver.jar;D:\usr\sap/WDA/DVEBMGS00/j2ee\jdbc\spy.jar).
    Additional error message is:
    com.sap.sdm.util.classloaders.SDMClassLoaderException: Cannot create class loader instance: Jar file #1 cannot be read: D:\usr\sap\WDA\DVEBMGS00\j2ee\jdbc\base.jar
    Oct 1, 2008 5:51:08 PM   Info: Summarizing the deployment results:
    Oct 1, 2008 5:51:08 PM   Error: Admitted: D:\Software\parches\del18_al22\J2EE-RUNT-CD\J2EE-ENG\JDD\SYNCLOG.SDA
    Oct 1, 2008 5:51:08 PM   Error: Aborted: D:\Software\parches\del18_al22\J2EE-RUNT-CD\J2EE-ENG\JDD\J2EE_JDDSCHEMA.SDA
    Oct 1, 2008 5:51:08 PM   Error: Admitted: D:\Software\parches\del18_al22\J2EE-RUNT-CD\J2EE-ENG\JDD\COM.SAP.SECURITY.DBSCHEMA.SDA
    Oct 1, 2008 5:51:08 PM   Error: Admitted: D:\Software\parches\del18_al22\J2EE-RUNT-CD\J2EE-ENG\JDD\XML_DAS_SCHEMA.SDA
    Oct 1, 2008 5:51:08 PM   Error: Admitted: D:\Software\parches\del18_al22\J2EE-RUNT-CD\J2EE-ENG\JDD\JMS_JDDSCHEMA.SDA
    Oct 1, 2008 5:51:08 PM   Error: Processing error. Return code: 4
    the spy.jar was there but some how it got deleted.
    Any ideas?
    Thanks

    For others who may be facing the same problem and would like to have a permanent fix, you can download the largest JDBC drivers from http://service.sap.com/msplatforms and refer to note 639702 and if your system is NW7.0 with EHP1 or SR3, you should also refer to note 1109274.

  • How to maintain the data  into database table

    Hi,
    experts,
    how to maintain the data  into database table

    There are several ways to maintain data in the database
    1. Use table maintanance generator . You can create this using SE11 and data can be edited through SM30.
    2. Loginto  SE11 with the specified table and check the ATTRIBUTES tab. There you can set some parameters for maintaining the database. When you set Maintain database, you edit the data thorugh SE11 it self
    3. Through Se16 as well.
    4. A small abap program can do the above task as well.
    Thanks,
    Raj
    Edited by: Rajanya Kolavennu on Feb 5, 2008 8:33 PM

  • Reg: Loading historic data for the enhanced field

    Hello All,
    We need to add a new field 0VENDOR to our datasource 0FI_GL_4. This field is available in our BSEG table. Hence, we are planning to go ahead with datasource enhancement.
    Now, please advice on how to update the historical data to this newly added field.I have heard there is a BW functionality/program to do so without deleting the entire data. Kindly advice on the possible solutions.
    Thanks & Regards
    Sneha Santhanakrishnan

    HI Sneha,
    Using remodeling option you will be able to do that, ie.. loading historical data for new attributes without deleting existing data. But the problem is in remodeling either you can assign constant or some other attribute value or values determined using EXIT.
    Now when you are loading data from source system and if you need historical data as well the best practise is delete existing data and reload it from source sytsem.
    But if you don't want to do that then I can give you one trick but not sure whether it will work or not. The idea is to populate the historical values for 0Vendor using customer exit option of remodeling. Now to get the historical values in customer exit you will need all that data in some BW table, here you can think of creating some generic extractor which will store the values of all the documents and the respective vendor, as you will load data form source system you will get historical values as well.
    Now read that table in customer exit and populate vendor value. This will be one time process to populate the historical values.
    Regards,
    Durgesh.

  • NT - How to embed the date for the export output file?

    I want to know how to embed a date for the export file on Windows NT?
    Example :
    In Unix you can use a shell variable and attach to the file like exp file=exp_prod_$A,
    where $A will have the system date, My output will be like exp_prod_10012000.dmp.
    I want to know how to do the above on NT.
    Thanks
    Ravi
    null

    Welcome to the forum!
    When you want to post a block of code, you can enclose it with the mark ups { code }
    That is the key word code surrounded by curly brackets, but without the spaces
    You seem to be running a very old (and unsupported release of the database)
    7.3 has not been a current release for about 10 years.
    It's probably been that long since I've used this technique, but i think it should work.
    You should consider welcoming your system to the 21st century by upgrading to a supported release ;-)
    If you used split to chop up your export file, use cat or dd to reassemble it.
    So, something like this:
    mknod bk.dmp p
    cat xaa xab xac xad xae xaf xag xah xai > bk.dmp &
    imp SYSTEM/$PASSWD parfile=imp_bk.parfile
    rm bk.dmp
    $ cat imp_bk.parfile
    file=bk.dmp
    log=imp.log
    full=y
    buffer=1048576
    ignore=y
    commit=y let us know if still have problems.
    Good Luck!

  • How do i add data from database to JTable ! Urgent

    How do i add data from database to the columns of JTable?.

    hi,
    Thanks for ur link. but this is just a part of my application which i am developing user interface in swing package for which i want to know how to show data to user in the table format where by table input data will be from the database. say something like todays activity is shown to the user in table format... So u have any idea of how to do this...

  • How to Get Missing Dates for Each Support Ticket In My Query?

    Hello -
    I'm really baffled as to how to get missing dates for each support ticket in my query.  I did a search for this and found several CTE's however they only provide ways to find missing dates in a date table rather than missing dates for another column
    in a table.  Let me explain a bit further here -
    I have a query which has a list of support tickets for the month of January.  Each support ticket is supposed to be updated daily by a support rep, however that isn't happening so the business wants to know for each ticket which dates have NOT been
    updated.  So, for example, I might have support ticket 44BS which was updated on 2014-01-01, 2014-01-05, 2014-01-07.  Each time the ticket is updated a new row is inserted into the table.  I need a query which will return the missing dates per
    each support ticket.
    I should also add that I DO NOT have any sort of admin nor write permissions to the database...none at all.  My team has tried and they won't give 'em.   So proposing a function or storable solution will not work.  I'm stuck with doing everything
    in a query.
    I'll try and provide some sample data as an example -
    CREATE TABLE #Tickets
    TicketNo VARCHAR(4)
    ,DateUpdated DATE
    INSERT INTO #Tickets VALUES ('44BS', '2014-01-01')
    INSERT INTO #Tickets VALUES ('44BS', '2014-01-05')
    INSERT INTO #Tickets VALUES ('44BS', '2014-01-07')
    INSERT INTO #Tickets VALUES ('32VT', '2014-01-03')
    INSERT INTO #Tickets VALUES ('32VT', '2014-01-09')
    INSERT INTO #Tickets VALUES ('32VT', '2014-01-11')
    So for ticket 44BS, I need to return the missing dates between January 1st and January 5th, again between January 5th and January 7th.  A set-based solution would be best.
    I'm sure this is easier than i'm making it.  However, after playing around for a couple of hours my head hurts and I need sleep.  If anyone can help, you'd be a job-saver :)
    Thanks!!

    CREATE TABLE #Tickets (
    TicketNo VARCHAR(4)
    ,DateUpdated DATETIME
    GO
    INSERT INTO #Tickets
    VALUES (
    '44BS'
    ,'2014-01-01'
    INSERT INTO #Tickets
    VALUES (
    '44BS'
    ,'2014-01-05'
    INSERT INTO #Tickets
    VALUES (
    '44BS'
    ,'2014-01-07'
    INSERT INTO #Tickets
    VALUES (
    '32VT'
    ,'2014-01-03'
    INSERT INTO #Tickets
    VALUES (
    '32VT'
    ,'2014-01-09'
    INSERT INTO #Tickets
    VALUES (
    '32VT'
    ,'2014-01-11'
    GO
    GO
    SELECT *
    FROM #Tickets
    GO
    GO
    CREATE TABLE #tempDist (
    NRow INT
    ,TicketNo VARCHAR(4)
    ,MinDate DATETIME
    ,MaxDate DATETIME
    GO
    CREATE TABLE #tempUnUserdDate (
    TicketNo VARCHAR(4)
    ,MissDate DATETIME
    GO
    INSERT INTO #tempDist
    SELECT Row_Number() OVER (
    ORDER BY TicketNo
    ) AS NROw
    ,TicketNo
    ,Min(DateUpdated) AS MinDate
    ,MAx(DateUpdated) AS MaxDate
    FROM #Tickets
    GROUP BY TicketNo
    SELECT *
    FROM #tempDist
    GO
    -- Get the number of rows in the looping table
    DECLARE @RowCount INT
    SET @RowCount = (
    SELECT COUNT(TicketNo)
    FROM #tempDist
    -- Declare an iterator
    DECLARE @I INT
    -- Initialize the iterator
    SET @I = 1
    -- Loop through the rows of a table @myTable
    WHILE (@I <= @RowCount)
    BEGIN
    --  Declare variables to hold the data which we get after looping each record
    DECLARE @MyDate DATETIME
    DECLARE @TicketNo VARCHAR(50)
    ,@MinDate DATETIME
    ,@MaxDate DATETIME
    -- Get the data from table and set to variables
    SELECT @TicketNo = TicketNo
    ,@MinDate = MinDate
    ,@MaxDate = MaxDate
    FROM #tempDist
    WHERE NRow = @I
    SET @MyDate = @MinDate
    WHILE @MaxDate > @MyDate
    BEGIN
    IF NOT EXISTS (
    SELECT *
    FROM #Tickets
    WHERE TicketNo = @TicketNo
    AND DateUpdated = @MyDate
    BEGIN
    INSERT INTO #tempUnUserdDate
    VALUES (
    @TicketNo
    ,@MyDate
    END
    SET @MyDate = dateadd(d, 1, @MyDate)
    END
    SET @I = @I + 1
    END
    GO
    SELECT *
    FROM #tempUnUserdDate
    GO
    GO
    DROP TABLE #tickets
    GO
    DROP TABLE #tempDist
    GO
    DROP TABLE #tempUnUserdDate
    Thanks, 
    Shridhar J Joshi 
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

Maybe you are looking for