Data doesn't come up in SQL database

Hi,
I have been trying add data to my local .mdf database through C#. My code executes successfully but the data doesn't come up when I view the table data through Server Explorer. My database is not read-only and I have set it to never copy the database. Here
is my code:
SqlConnection con = new SqlConnection(global::Quizz.Properties.Settings.Default.QAConnectionString);
            string sql = "INSERT INTO Old (Question, AnsOne, ansTwo, ansThree, Correct) VALUES (@Question, @AnsOne, @ansTwo, @ansThree, @Correct)";
            SqlCommand sqlcmd = new SqlCommand(sql,con);
            sqlcmd.Parameters.AddWithValue("@Question", questiontxtbox.Text.ToString());
            sqlcmd.Parameters.AddWithValue("@AnsOne", ans1textbox.Text.ToString());
            sqlcmd.Parameters.AddWithValue("@AnsTwo", ans2textbox.Text.ToString());
            sqlcmd.Parameters.AddWithValue("@AnsThree", ans3textbox.Text.ToString());
            sqlcmd.Parameters.AddWithValue("@Correct", selectedradio);
            con.Open();
            sqlcmd.ExecuteNonQuery();
            MessageBox.Show("success!");
How do I solve this problem?

If your result of "sqlcmd.ExecuteNonQuery();" >
0 without any exceptions, I think you should try to see whether your local db is copied again each time. I mean you are dealling with a copy type of db instead of real one.
If so, please:
1) Please change the property by switching to the db and change the "Copy To Local" to false.
2) Create an "App_Data" folder.
3) Change your db connection string to this following:
Server=.\SQLExpress;AttachDbFilename=|DataDirectory|\MyDataFile.mdf;Database=dbname;
Trusted_Connection=Yes;
For more about connection string, plz see: http://www.connectionstrings.com/sql-server/
ASP.NET Forum
Other Discussion Forums
FreeRice Donate
Issues to report
Free Tech Books Search and Download

Similar Messages

  • Deleting old data won't reduce Windows Azure SQL Database usage

    My Windows Azure SQL Database usage keeps increasing. Deleting old data didn't help much. I was wondering how to figure out the distribution of the usage. All tables in my DB should not occupy more than 5GB and now it is most 12GB. Please help!
    http://yanflex.com

    Hello,
    The database fee is amortized over the month and charged daily. The daily fee depends on the peak size that each database reached that day and the maximum number of databases you use. So, if the peak size of database is 12 GB  and then you delete data
    to reduce the size, it still charge based on 12GB this day.
    You can use the following statement to get the database size:
    SELECT SUM(reserved_page_count)*8.0/1024 as DBsizeinMB
    FROM sys.dm_db_partition_stats;
    Reference:Accounts and Billing in Windows Azure SQL Database
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here.
    Fanny Liu
    TechNet Community Support

  • Date is not getting updated in SQL database.

    Hello Everyone,
    Regarding my problem, i am using business connector to transfer data from SAP to SQL Server. But in BC, on executing, it shows syntax error for the date field. I used "trim" transformer to convert the date field, bt the error is still same.
    Can anyone tell me which type of transformer should i use or is there any other way to do this?????
    Thanks,
    Vinita

    Hi DJ,
    It's interesting that the value is showing when the page loads, that would imply that you have done everything in terms of setting the item's source up properly. Can you answer the following questions:
    1) What version of APEX are you using?
    2) Is there any 'on update' trigger logic firing that could be doing this. Does a simple update using a SQL statement directly work properly?
    3) Is this item disabled in anyway when the form is submitted (dynamic action disable for example)?
    4) Can you also just verify (although I'm pretty sure you did this already), that all the 'Source' attributes are correct (eg 'Source Used = Always...', 'Source Type = Database Column' and 'Source value or expression = [your column]')?
    Regards,
    Anthony.

  • Data type for Saving Image in SQL database

    Hi,
        Which is the best way for saving images in the database? Filestream or Varbinary(max)?. Will the Varbinary max comsume much space or it will only take the actual size of the data?

    I've used FILETABLE for storing images in SQL 2012
    You can configure it to have transact and non transact access if you want
    see
    http://visakhm.blogspot.in/2012/07/working-with-filetables-in-sql-2012.html
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Send form data via email after posting to MySQL database

    I have created a form in DreamweaverMX 2004 and then tied it to mySQL database so that on submit the data posts to the database.
    This works fine. It also goes to a "success" page just fine. I then added in some php code to also email a few of the fields from the form to a specific email address. This functions correctly using this code below (the email does go - the "from" email address has my login for MySQL database) EXCEPT that the data from the fields does not come through. The field labels are there as indicated below and the email is formatted correctly, but the data doesn't come through.
    mail( $to = "[email protected]", $subject = "Someone has submitted an application",
    $content= "Essay 1: ".$Essay1."\r\n"
    ."Essay 2: ".$Essay2."\r\n"
    ."Essay 3: ".$Essay3."\r\n"
    ."Essay 4: ".$Essay4."\r\n"
    ."Essay 5: ".$Essay5."\r\n");
    What am I doing wrong?
    That's problem #1 - then problem #2 is that I actually also need to send the ID code in this email for the specific record which has been created in my database so the end recipient can associate the email with that specific ID later for other purposes. So even if I figure out problem #1, I'm not sure that I can use this code for problem #2 because the field isn't on the html form, but actually created by the database upon submission.
    Any suggestions would be helpful!
    Thanks

    Moved to the Dreamweaver Application Development forum, which deals with PHP and other server-side issues.

  • SQL Database is corrupted....... plz help.

    Respected Sir,
    unfortunately hard disk of my system is damaged, now i recovered my database. but it cannot be attached again to SQL management
    studio 2005.
    the error is myfile.mdf is not a primary database file. (SQL server , error 5171)
    plz sir help me...

    Corruption in SQL server database can happen due to any uncertain like virus attack, power
    failure, hardware issue, OS malfunction, sudden system shutdown, so on. When a SQL server data file (.mdf) is corrupt then DBAs can try several methods to repair and recover data from it. 
    Run DBCC CHECKDB: It checks & reports all the error message
    in errorlog, if there is any problem with the database. Try to analyze & understand the error message logged in the errorlog. Re-run DBCC CHECKDB with the recommended minimum repair option to repair the file. 
    Detailed information about DBCC CHECKDB is available here: http://www.techrepublic.com/forums/discussions/sql-database-recovery-from-corrupt-database-file/
    Restore from backup: If above command fails to fix the error
    message the try to restore the database from clean backup. 
    3rd party tool: Try 3rd party
    Recovery Toolbox for SQL Server to recover data from corrupt mdf file. Most of the software have demo version that shows the preview of corrupt SQL server data file. 
    http://www.sql.recoverytoolbox.com/

  • What is max capacity of Azure SQL database? 500GB? Possible to compress?

    I have 1TB data on SQL Server VM and would like to migrate to Azure SQL.
    Is 500GB really the max? Any compression available so that I can fit 1TB data?
    Kenny_I

    Hi,
    on the contrary, this was announced a while back but for some reason the announcement was pulled out
    it seems there's support for compression though, check:
    http://thomaslarock.com/2014/06/microsoft-azure-sql-database-data-compression/
    I don't think you can compress 1TB data to SQL Azure.
    Request to provide your feedback
    http://feedback.azure.com/forums/217321-sql-database/suggestions/403510-allow-data-compression-to-improve-size-performanc
    Girish Prajwal

  • Advise on SQL database process

    Dear all,
    We have build our own product CMS platform configuration which is running on SQL server and CMS web site link to it.
    We will lauch our product soon but need to identify the correct hosting plan for not having any further issue.
    For exemple for now all is hosted in our company azure account with a Standard Basic 5 DTU's.
    When we go in production we can expect some connection and big amount of data on our database.
    My question are as follow :
    - Does using a single database storage for my potential Customers would be enough ?
    - How should I plan backup efficiently ?
    - Should I plan a safety replication process somewhere in azure or duplicate the storage in order to switch in case of lack of place ?
    My concern is to avoid my database beeing full while customers increase
    Thanks for your advise and help
    regards
    serge

    Hi Solatys,
    - If I select by default STANDARD Azure database, which size, DTU, etc should I select ? 
    For this question, you may reference the below link. You can scale your Azure database performance based on the real-time requirement.
    Azure
    SQL Database introduces new near real-time performance metrics 
    - If for instance the initial URL of the web portal connected to SQL server1 has a trouble, how can I switch users transparently to a second replicated server in order that user will notify anything ?
    Azure SQL Database has a built-in high availability subsystem that protects your database from failures of individual servers and devices in a datacenter. Azure SQL
    Database maintains multiple copies of all data in different physical nodes located across fully independent physical sub-systems to mitigate outages due to failures of individual server components, such as hard drives, network interface adapters, or even entire
    servers. At any one time, three database replicas are running—one primary replica and two or more
    secondary replicas. Data is written to the primary and one secondary replica using a quorum based commit scheme before the transaction is considered committed.
    If the hardware fails on the primary replica, Azure SQL Database detects the failure and fails over to the secondary replica. In case of a physical loss of a replica, a new replica is automatically created.
    So there are always at minimum two physical, transactionally consistent copies of your data in the datacenter.
    Azure SQL Database Business Continuity
    - IF I select the Maximum size of the database, what will happen in case it will be nearly full and need to provide more space ?
    Insert and update transactions that exceed the upper limit will be rejected because the database will be in read-only mode. The maximum size has been gained from 50GB to 500GB as of now, you may have no concern about it. You can
    set a monitoring alertto
    notify the storage utilization and CPU percentage etc.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How to use java to create an XML document from an SQL database?

    Hi,
    I'm a complete novice at XML and have only recently started programming in Java.
    I'm currently trying to develop a package in Java 1.1.8 which requires a set of very specifically formatted XML documents. These documents would need to be updated regularly by people with no knowledge of Java and I would like to make it as simple as possible.
    Since the data will already be in an SQL database, I thought it might be possible to generate the XML documents from the data using a small Java application, but I'm not too sure how to go about this or if this is even possible! Any help or pointers in the right direction would be very much appreciated.
    Louise

    Do you have the option of upgrading to a newer version of the JDK?
    JAXB does what you are wanting very easily. Also there are tools if you don't want to write your own. JAXB is available as early release on Sun's site as is the newest JDK. Otherwise, you have to design a factory and interface that will do this for you (which is what JAXB basically is in a very simplified view).

  • Error upon inserting data in sql Database using stream analytics job: Datatye error conversion

    I have a data passed into the Event Hubs, queried by stream analytic job inserting it into sql database. Upon running the job, it becomes idle a few seconds after since it has an error:
    Message: Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64.
    Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64. Exception message at level [1], exception number [0], parent exception number [0]: Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64.
    The data type in one of my field(IsHistorical) is Boolean with a value of false. The data type of the column in the sql table where this is to be inserted is of type bit. In this case, it seems that stream analytics could not convert the value "false"
    into a bit data type when inserting in sql table.
    I'm wondering if you already have encountered this problem. Could you help me resolve this problem?
    Thank you.

    Azure Stream Analytics does not have Boolean type. On input we will convert JSON Boolean value to bigint.
    Here is the list of supported types and conversions:
    https://msdn.microsoft.com/en-us/library/azure/dn835065.aspx 
    You  can fix this erro by changing column type from bit to int in SQL table schema.

  • Is it possible to save / extract data from a MS SQL database 2008 using lookout 6.2?

    Is it possible to save / extract data from a MS SQL database 2008 using lookout 6.2?
      Now a days we are saving / extracting data in a excel spreadsheet, but we would like to do that using a database because it is better.

    You can use ODBC connection to work with SQL Server database.
    Use SQLExec object to execute the SQL statement. Here is a KB about the SQL statement.
    http://digital.ni.com/public.nsf/allkb/4ADEEA04CD24AE0B862565E20002A16F?OpenDocument
    To write data to spreadsheet is more straightforward because Lookout has built-in spreadsheet object. But you need to write SQL statement by yourself to interact with other database.
    To read the data back is the same way. Just use "select" SQL statement to query. You can use Datatable object to query.
    The "Data Source" can be "DSN = data source name;". The data source name is configured in Control Panel->Administrative Tools->Data Sources(ODBC).
    Ryan Shi
    National Instruments

  • Displaying the data from a "LINQ to SQL database"

    I have created a LINQ to SQL database with a simple table/class with the following properties:
    Counter
    Subject
    Description
    About the Counter, how do I set the properties so it behaves like a "Counter". For each row I want it to automatically add new numbers like this:
    1 Subject1 Decsription1
    2 Subject2 Description2
    3 Subject3 Description3...and so on for every new data inserted.
    For now I have "Auto Generated Value=True" and "Primary Key=True". Is that the right way to go? What do I set for "Auto-Sync"? There are options like "Never, OnInsert, OnUpdate, Always".
    I believe I've manage to do the coding for the insert part:
    private void btnAddReminder_Click(object sender, RoutedEventArgs e)
    DataClasses1DataContext db = new DataClasses1DataContext("db");
    Reminders reminder = new Reminders();
    reminder.Subject = txtSubject.Text;
    reminder.Description = txtDescription.Text;
    db.Reminders.InsertOnSubmit(reminder);
    MessageBox.Show("Content added!");
    Now first of all, is there a way I can display the database content directly in Visual Studio so I can see if I've manage to add any content in the table? I haven't yet find a way so far.
    Second how do I get the content from the datatable row by row and display it in MainWindow.xaml? What would the code look like? For every row I would like it to be displayed like this:
    1. Subject1
    Description1
    2. Subject2
    Description2
    3. Subject3
    Description3
    Is it possible to display "1. Subject1" in a Label. It should be sort of a headline.
    Then would it be possible to display "Description1" in a TextBlock?
    The idea is that Subject along with the number should have a larger font size, and the Description shoud be a bit smaller font size.
     

    >>For now I have "Auto Generated Value=True" and "Primary Key=True". Is that the right way to go?
    Yes, this means that the database takes care of the actual incrementation for you which is perfectly fine and probably what you want.
    >>how do I get the content from the datatable row by row and display it in MainWindow.xaml
    You need to an ItemsControl that can render all items in a collection somewhere in the MainWindow, e.g.:
    <ItemsControl x:Name="ic">
    <ItemsControl.ItemTemplate>
    <DataTemplate>
    <StackPanel>
    <StackPanel Orientation="Horizontal" Margin="0 0 0 10">
    <TextBlock Text="{Binding Counter}"/>
    <TextBlock Text=". "/>
    <TextBlock Text="{Binding Subject}"/>
    </StackPanel>
    <TextBlock Text="{Binding Description}"/>
    </StackPanel>
    </DataTemplate>
    </ItemsControl.ItemTemplate>
    </ItemsControl>
    The ItemTemplate (DataTemplate) of the ItemsControl defines the appearance of each item in its ItemsSource collection, i.e. a Reminders object in your case.
    You then simply set the ItemsSource of the ItemsControl to the collection of Reminders object that you want to display in it in your code:
    private void btnAddReminder_Click(object sender, RoutedEventArgs e)
    DataClasses1DataContext db = new DataClasses1DataContext("db");
    Reminders reminder = new Reminders();
    reminder.Subject = txtSubject.Text;
    reminder.Description = txtDescription.Text;
    db.Reminders.InsertOnSubmit(reminder);
    MessageBox.Show("Content added!");
    ic.ItemsSource = db.Reminders;
    >>is there a way I can display the database content directly in Visual Studio so I can see if I've manage to add any content in the table?
    First of all, please don't ask several questions in the same thread. Second, this is not a WPF question. If you are using a service-based database, you could select data from it from the Server Explorer in Visual Studio:
    http://msdn.microsoft.com/en-us/library/vstudio/ms233763(v=vs.120).aspx. Otherwise you typically use SQL Sever Management Studio to query a database. For Visual Studio specific questions, please use the Visual Studio forums:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=visualstudio%2Cvsarch%2Cvsdbg%2Cvstest%2Cvstfs%2Cvsdata%2Cvsappdev%2Cvisualbasic%2Cvisualcsharp%2Cvisualc
    Please remember to mark helpful posts as answer and/or helpful.

  • Saving data in sql database

    Ive seen same title subjects but apparently these topics have been deleted. Anyway,
    I have a data base named "TestDB", under url www.mysql.com/TestDB. I did in it 2 fields, "ProjectNr", "ProjectName".
    Now, I have Webdyn Pro app with two InputFields binded to Contexts "ProjectNr", "ProjectName" and a button "Save"
    What code do I need to write in onActionSave() part to make data written into those two fields be saved in sql database after pressing Save button.

    Hi,
    Following is the code, pl aligh that to your requirement
    try {
              Class.forName("com.sap.dbtech.jdbc.DriverSapDB");
               String url="jdbc:sapdb://<HostID>/J2E?sqlmode=ORACLE";
                Connection con=DriverManager.getConnection(url,"UserID","password");
                String projectID = wdContext.current<Yournode>Element().get<yourAttribute>();
                String projectName = wdContext.current<YourNode>Element().get<your Attribute>();
                String sql = "insert into Project values (?,?)";
                PreparedStatement stmt = con.prepareStatement(sql);
                stmt.setString(1, projectID);
                stmt.setString(1, projectName);
         } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    try to make use of JNDI for database connections. That s one of the best practises.
    http://java.sun.com/javase/technologies/database/
    Regards
    Ayyapparaj

  • Sql query is hung, doesn't comes back

    Hello Every one,
    Two node Rac on Linux 5 64-bit, 11.2.0.1.0
    In our data ware housing environment, i have a sql query which doesn't comes back at all, when i run, it is just hung for a long time with no output. I did following basic testing
    1. All the indexes are valid and stats are up to date(count(*) matches num rows)
    2. There is a union clause in the query, i divided the query in two parts - the first part prior to union and second part after union, then i ran those two parts separately - the first part comes back quickly with no rows selected but the second part has a main problem(its just hung).
    Please note that one table in the query has a partitioned table. following is the query and the tables involved in it.
    Please let me know if you need any further information, it will be of great help if i get through this. Thanks in advance.
    OWNER                          TABLE_NAME                     STATUS   LAST_ANAL   NUM_ROWS
    MAINTENANCE_DM                 D_VEHICLE                      VALID    21-NOV-12     752590
    PTL_HOLD                       R_COMP_CODES                   VALID    21-NOV-12        108
    PTL_HOLD                       USER_GEO                       VALID    20-DEC-12        300
    PTL_EDW                        D_CUSTOMER                     VALID    20-DEC-12     219498
    PTL_EDW                        D_LOCN                         VALID    20-DEC-12      19456
    PTL_EDW                        D_VEHICLE                      VALID    20-DEC-12    3973271
    PTL_EDW                        F_VEH_LOCN                     VALID    20-DEC-12    3131138
    PTL_EDW                        F_RO_DETL                      VALID    21-NOV-12   29234052
    8 rows selected.
    SELECT
      '../../opendoc/',
      '&hideSave=true&hideEdit=true&hideRefresh=true&hideUserPromptInput=true',
      'Data As Of:',
      'Run Date:',
      ptl_hold.get_stgextr_time('FACT_FPNA_RO'),
      'RO Date',
      PTL_EDW.F_RO_DETL.RO_TYP,
      PTL_EDW.D_CUSTOMER.CUST_NUM,
      (PTL_EDW.D_CUSTOMER.CUST_NUM )||' - '||( PTL_EDW.D_CUSTOMER.CUST_PRIME_NM),
      PTL_EDW.D_CUSTOMER.BILL_GRP,
      CASE WHEN PTL_EDW.D_LOCN.CORP_CD='HPTL' THEN 'US' ELSE CASE WHEN  PTL_EDW.D_LOCN.CORP_CD='2000' THEN 'CANADA' ELSE 'UNKNOWN' END END,
      PTL_EDW.D_LOCN.REGN_NUM,
      PTL_EDW.D_LOCN.REGN_NUM ||' - '||PTL_EDW.D_LOCN.REGN_NM,
      PTL_EDW.D_LOCN.AREA_NUM,
      PTL_EDW.D_LOCN.AREA_NUM||' - '||PTL_EDW.D_LOCN.AREA_NM,
      PTL_EDW.D_LOCN.RDIST_NUM,
      PTL_EDW.D_LOCN.RDIST_NUM||' - '||PTL_EDW.D_LOCN.RDIST_NM,
      PTL_EDW.D_LOCN.DIST_NUM,
      PTL_EDW.D_LOCN.DIST_NUM||' - '||PTL_EDW.D_LOCN.DIST_NM,
      CASE WHEN TRIM(PTL_EDW.D_VEHICLE.VEH_CAP_STAT) IN ('ACTIVE','ACCRUED') THEN 'Active' ELSE 'Inactive' END,
      DECODE(PTL_EDW.D_VEHICLE.CONTR_GRP, 'X' ,'NON-CONTRACT',PTL_EDW.D_VEHICLE.VEH_CAT),
      PTL_EDW.D_VEHICLE.VEH_UNIT_TYP,
      PTL_EDW.D_VEHICLE.VEH_MODL_YR,
      PTL_EDW.D_VEHICLE.VEH_MAKE,
      PTL_EDW.D_VEHICLE.VEH_MODEL,
      CASE WHEN ( PTL_HOLD.R_COMP_CODES.COMP_CD ) IN ('057','061') THEN 'Accident/Incident' ELSE 'Non-Accident/Incident' END,
      PTL_HOLD.R_COMP_CODES.COMP_CD,
      PTL_HOLD.R_COMP_CODES.COMP_DESC,
      PTL_HOLD.R_COMP_CODES.COMP_CD||' - '||PTL_HOLD.R_COMP_CODES.COMP_DESC,
      PTL_EDW.D_VEHICLE.UNIT_NUM,
      PTL_EDW_D_RO_LOCN.DIST_NUM || PTL_EDW_D_RO_LOCN.DIST_SUFX ||  PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM,
      PTL_EDW_D_RO_LOCN.DIST_NUM || PTL_EDW_D_RO_LOCN.DIST_SUFX || PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM || PTL_EDW.F_RO_DETL.RO_SEQ_NUM
      PTL_EDW.F_RO_DETL.RO_SRC,
      PTL_EDW.F_RO_DETL.TOTAL_LABOR_HRS,
      PTL_EDW.F_RO_DETL.TOTAL_LABOR_COST,
      PTL_EDW.F_RO_DETL.OUT_COST,
      PTL_EDW.F_RO_DETL.PARTS_COST,
      PTL_EDW.F_RO_DETL.RO_COST,
      TO_CHAR(PTL_EDW_D_RO_LOCN.LOCN_KEY),
      PTL_EDW.F_RO_DETL.RO_NUM,
      PTL_EDW.F_RO_DETL.RO_SEQ_NUM,
      PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
    FROM
      PTL_EDW.F_RO_DETL,
      PTL_EDW.D_CUSTOMER,
      PTL_EDW.D_LOCN,
      PTL_EDW.D_VEHICLE,
      PTL_HOLD.R_COMP_CODES,
      PTL_EDW.D_LOCN  PTL_EDW_D_RO_LOCN,
      PTL_EDW.D_LOCN  PTL_EDW_D_CHRG_LOCN,
      PTL_EDW.D_TIME,
      PTL_EDW.D_LOCN  CURRENT_VEH_LOCN,
      PTL_EDW.F_VEH_LOCN,
      PTL_EDW.D_VEHICLE  CURRENT_VEH
    WHERE
      ( PTL_EDW.F_RO_DETL.CUST_KEY=PTL_EDW.D_CUSTOMER.CUST_KEY  )
      AND  ( PTL_EDW.F_RO_DETL.LOCN_KEY=PTL_EDW.D_LOCN.LOCN_KEY  )
      AND  ( PTL_EDW.D_TIME.TIME_KEY=PTL_EDW.F_RO_DETL.RO_TIME_KEY  )
      AND  ( PTL_EDW.D_VEHICLE.VEH_KEY=PTL_EDW.F_RO_DETL.VEH_KEY  )
      AND  ( PTL_EDW_D_RO_LOCN.LOCN_KEY=PTL_EDW.F_RO_DETL.RO_LOCN_KEY  )
      AND  ( PTL_EDW.F_RO_DETL.CHRG_LOCN_KEY=PTL_EDW_D_CHRG_LOCN.LOCN_KEY  )
      AND  ( CURRENT_VEH_LOCN.LOCN_KEY=PTL_EDW.F_VEH_LOCN.LOCN_KEY  )
      AND  ( CURRENT_VEH.SCD_FLG='A'  )
      AND  ( CURRENT_VEH.CONTR_GRP='P'  )
      AND  ( CURRENT_VEH.CORP_CD=PTL_EDW.D_VEHICLE.CORP_CD and CURRENT_VEH.UNIT_NUM=PTL_EDW.D_VEHICLE.UNIT_NUM  )
      AND  ( CURRENT_VEH.VEH_KEY=PTL_EDW.F_VEH_LOCN.VEH_KEY  )
      AND  ( PTL_HOLD.R_COMP_CODES.COMP_CD=PTL_EDW.F_RO_DETL.COMP_CD  )
      AND 
       ( 'Accounting Month' = 'RO Date'  )
       AND
       ( '2500' = 'NO-MIN'
    OR    EXISTS(SELECT RO_TOTAL_COST.RO_LOCN_KEY, RO_TOTAL_COST.ORIGINAL_RO_NUM 
    FROM      PTL_EDW.F_RO_DETL RO_TOTAL_COST,
        PTL_EDW.D_TIME DTIME
    WHERE
        ('I' = 'I'
        OR ('I' = 'E'
            AND RO_TOTAL_COST.RO_TYP  <>  'W'))
        AND RO_TOTAL_COST.RO_LOCN_KEY = PTL_EDW.F_RO_DETL.RO_LOCN_KEY
        AND RO_TOTAL_COST.ORIGINAL_RO_NUM = PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
        AND RO_TOTAL_COST.RO_TIME_KEY = DTIME.TIME_KEY
        AND DTIME.CALENDAR_DT BETWEEN to_date('2011-JAN-01') AND to_date('2012-SEP-24')
    GROUP BY
        RO_TOTAL_COST.RO_LOCN_KEY,
        RO_TOTAL_COST.ORIGINAL_RO_NUM
    HAVING
    Sum(RO_TOTAL_COST.RO_COST) >= TO_NUMBER(translate('2500','NO-MIN',' ')))
       AND
       PTL_EDW_D_CHRG_LOCN.DIST_NUM_SUFX  IN  ('014810')
       AND
       ( PTL_EDW.D_TIME.CALENDAR_DT  BETWEEN  to_date('2011-JAN-01') AND to_date('2012-SEP-24')  )
       AND
       ( 'I'  = 'I'
      OR
      ( 'I' = 'E'
         And ( ( PTL_EDW.F_RO_DETL.RO_TYP ) <> 'W'
       AND
       ( EXISTS(SELECT *  FROM PTL_HOLD.USER_GEO WHERE USERID='600125729' AND PTL_HOLD.USER_GEO.GEO IN (CURRENT_VEH_LOCN.CORP_CD, CURRENT_VEH_LOCN.REGN_NUM, CURRENT_VEH_LOCN.AREA_NUM, CURRENT_VEH_LOCN.RDIST_NUM, CURRENT_VEH_LOCN.DIST_NUM))  )
    UNION 
    SELECT
      '../../opendoc/',
      '&hideSave=true&hideEdit=true&hideRefresh=true&hideUserPromptInput=true',
      'Data As Of:',
      'Run Date:',
      ptl_hold.get_stgextr_time('FACT_FPNA_RO'),
      'Accounting Month',
      PTL_EDW.F_RO_DETL.RO_TYP,
      PTL_EDW.D_CUSTOMER.CUST_NUM,
      (PTL_EDW.D_CUSTOMER.CUST_NUM )||' - '||( PTL_EDW.D_CUSTOMER.CUST_PRIME_NM),
      PTL_EDW.D_CUSTOMER.BILL_GRP,
      CASE WHEN PTL_EDW.D_LOCN.CORP_CD='HPTL' THEN 'US' ELSE CASE WHEN  PTL_EDW.D_LOCN.CORP_CD='2000' THEN 'CANADA' ELSE 'UNKNOWN' END END,
      PTL_EDW.D_LOCN.REGN_NUM,
      PTL_EDW.D_LOCN.REGN_NUM ||' - '||PTL_EDW.D_LOCN.REGN_NM,
      PTL_EDW.D_LOCN.AREA_NUM,
      PTL_EDW.D_LOCN.AREA_NUM||' - '||PTL_EDW.D_LOCN.AREA_NM,
      PTL_EDW.D_LOCN.RDIST_NUM,
      PTL_EDW.D_LOCN.RDIST_NUM||' - '||PTL_EDW.D_LOCN.RDIST_NM,
      PTL_EDW.D_LOCN.DIST_NUM,
      PTL_EDW.D_LOCN.DIST_NUM||' - '||PTL_EDW.D_LOCN.DIST_NM,
      CASE WHEN TRIM(PTL_EDW.D_VEHICLE.VEH_CAP_STAT) IN ('ACTIVE','ACCRUED') THEN 'Active' ELSE 'Inactive' END,
      DECODE(PTL_EDW.D_VEHICLE.CONTR_GRP, 'X' ,'NON-CONTRACT',PTL_EDW.D_VEHICLE.VEH_CAT),
      PTL_EDW.D_VEHICLE.VEH_UNIT_TYP,
      PTL_EDW.D_VEHICLE.VEH_MODL_YR,
      PTL_EDW.D_VEHICLE.VEH_MAKE,
      PTL_EDW.D_VEHICLE.VEH_MODEL,
      CASE WHEN ( PTL_HOLD.R_COMP_CODES.COMP_CD ) IN ('057','061') THEN 'Accident/Incident' ELSE 'Non-Accident/Incident' END,
      PTL_HOLD.R_COMP_CODES.COMP_CD,
      PTL_HOLD.R_COMP_CODES.COMP_DESC,
      PTL_HOLD.R_COMP_CODES.COMP_CD||' - '||PTL_HOLD.R_COMP_CODES.COMP_DESC,
      PTL_EDW.D_VEHICLE.UNIT_NUM,
      PTL_EDW_D_RO_LOCN.DIST_NUM || PTL_EDW_D_RO_LOCN.DIST_SUFX ||  PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM,
      PTL_EDW_D_RO_LOCN.DIST_NUM || PTL_EDW_D_RO_LOCN.DIST_SUFX || PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM || PTL_EDW.F_RO_DETL.RO_SEQ_NUM
      PTL_EDW.F_RO_DETL.RO_SRC,
      PTL_EDW.F_RO_DETL.TOTAL_LABOR_HRS,
      PTL_EDW.F_RO_DETL.TOTAL_LABOR_COST,
      PTL_EDW.F_RO_DETL.OUT_COST,
      PTL_EDW.F_RO_DETL.PARTS_COST,
      PTL_EDW.F_RO_DETL.RO_COST,
      TO_CHAR(PTL_EDW_D_RO_LOCN.LOCN_KEY),
      PTL_EDW.F_RO_DETL.RO_NUM,
      PTL_EDW.F_RO_DETL.RO_SEQ_NUM,
      PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
    FROM
      PTL_EDW.F_RO_DETL,
      PTL_EDW.D_CUSTOMER,
      PTL_EDW.D_LOCN,
      PTL_EDW.D_VEHICLE,
      PTL_HOLD.R_COMP_CODES,
      PTL_EDW.D_LOCN  PTL_EDW_D_RO_LOCN,
      PTL_EDW.D_LOCN  PTL_EDW_D_CHRG_LOCN,
      PTL_EDW.D_LOCN  CURRENT_VEH_LOCN,
      PTL_EDW.F_VEH_LOCN,
      PTL_EDW.D_VEHICLE  CURRENT_VEH
    WHERE
      ( PTL_EDW.F_RO_DETL.CUST_KEY=PTL_EDW.D_CUSTOMER.CUST_KEY  )
      AND  ( PTL_EDW.F_RO_DETL.LOCN_KEY=PTL_EDW.D_LOCN.LOCN_KEY  )
      AND  ( PTL_EDW.D_VEHICLE.VEH_KEY=PTL_EDW.F_RO_DETL.VEH_KEY  )
      AND  ( PTL_EDW_D_RO_LOCN.LOCN_KEY=PTL_EDW.F_RO_DETL.RO_LOCN_KEY  )
      AND  ( PTL_EDW.F_RO_DETL.CHRG_LOCN_KEY=PTL_EDW_D_CHRG_LOCN.LOCN_KEY  )
      AND  ( CURRENT_VEH_LOCN.LOCN_KEY=PTL_EDW.F_VEH_LOCN.LOCN_KEY  )
      AND  ( CURRENT_VEH.SCD_FLG='A'  )
      AND  ( CURRENT_VEH.CONTR_GRP='P'  )
      AND  ( CURRENT_VEH.CORP_CD=PTL_EDW.D_VEHICLE.CORP_CD and CURRENT_VEH.UNIT_NUM=PTL_EDW.D_VEHICLE.UNIT_NUM  )
      AND  ( CURRENT_VEH.VEH_KEY=PTL_EDW.F_VEH_LOCN.VEH_KEY  )
      AND  ( PTL_HOLD.R_COMP_CODES.COMP_CD=PTL_EDW.F_RO_DETL.COMP_CD  )
      AND 
       ( 'Accounting Month' = 'Accounting Month'  )
       AND
       ( '2500' = 'NO-MIN'
    OR           EXISTS(SELECT RO_TOTAL_COST.RO_LOCN_KEY, RO_TOTAL_COST.ORIGINAL_RO_NUM
    FROM      PTL_EDW.F_RO_DETL RO_TOTAL_COST
    WHERE
        ('I' = 'I'
        OR ('I' = 'E'
            AND RO_TOTAL_COST.RO_TYP  <>  'W'))
        AND RO_TOTAL_COST.RO_LOCN_KEY = PTL_EDW.F_RO_DETL.RO_LOCN_KEY
        AND RO_TOTAL_COST.ORIGINAL_RO_NUM = PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
        AND RO_TOTAL_COST.PARTITION_KEY BETWEEN 
           to_number(to_char(to_date('2011-JAN-01','YYYY-MON-DD'),'yyyymm')) 
           AND  to_number(to_char(to_date('2012-SEP-24','YYYY-MON-DD'),'yyyymm'))
    GROUP BY
        RO_TOTAL_COST.RO_LOCN_KEY,
        RO_TOTAL_COST.ORIGINAL_RO_NUM
    HAVING
    Sum(RO_TOTAL_COST.RO_COST) >= TO_NUMBER(translate('2500','NO-MIN',' ')))  )
       AND
       PTL_EDW_D_CHRG_LOCN.DIST_NUM_SUFX  IN  ('014810')
       AND
       ( (PTL_EDW.F_RO_DETL.PARTITION_KEY BETWEEN 
           to_number(to_char(to_date('2011-JAN-01','YYYY-MON-DD'),'yyyymm')) 
           AND  to_number(to_char(to_date('2012-SEP-24','YYYY-MON-DD'),'yyyymm'))
       AND
       ( 'I'  = 'I'
      OR
      ( 'I' = 'E'
         And ( ( PTL_EDW.F_RO_DETL.RO_TYP ) <> 'W'
       AND
       ( EXISTS(SELECT *  FROM PTL_HOLD.USER_GEO WHERE USERID='600125729' AND PTL_HOLD.USER_GEO.GEO IN (CURRENT_VEH_LOCN.CORP_CD, CURRENT_VEH_LOCN.REGN_NUM, CURRENT_VEH_LOCN.AREA_NUM, CURRENT_VEH_LOCN.RDIST_NUM, CURRENT_VEH_LOCN.DIST_NUM))  )
    );Thank you.

    For your own sanity, you should learn to format your code. For the sake of the forum members, you should preserve the formatting by using the \ tags. 
    I've done that for you here, and some other questions popped right out.  Look for my embedded comments near the bottomSELECT
    '../../opendoc/',
    '&hideSave=true&hideEdit=true&hideRefresh=true&hideUserPromptInput=true'
    'Data As Of:' ,
    'Run Date:' ,
    ptl_hold.get_stgextr_time('FACT_FPNA_RO'),
    'RO Date' ,
    PTL_EDW.F_RO_DETL.RO_TYP ,
    PTL_EDW.D_CUSTOMER.CUST_NUM ,
    (PTL_EDW.D_CUSTOMER.CUST_NUM )
    ||' - '
    ||( PTL_EDW.D_CUSTOMER.CUST_PRIME_NM),
    PTL_EDW.D_CUSTOMER.BILL_GRP ,
    CASE
    WHEN PTL_EDW.D_LOCN.CORP_CD='HPTL'
    THEN 'US'
    ELSE
    CASE
    WHEN PTL_EDW.D_LOCN.CORP_CD='2000'
    THEN 'CANADA'
    ELSE 'UNKNOWN'
    END
    END ,
    PTL_EDW.D_LOCN.REGN_NUM,
    PTL_EDW.D_LOCN.REGN_NUM
    ||' - '
    ||PTL_EDW.D_LOCN.REGN_NM,
    PTL_EDW.D_LOCN.AREA_NUM ,
    PTL_EDW.D_LOCN.AREA_NUM
    ||' - '
    ||PTL_EDW.D_LOCN.AREA_NM,
    PTL_EDW.D_LOCN.RDIST_NUM,
    PTL_EDW.D_LOCN.RDIST_NUM
    ||' - '
    ||PTL_EDW.D_LOCN.RDIST_NM,
    PTL_EDW.D_LOCN.DIST_NUM ,
    PTL_EDW.D_LOCN.DIST_NUM
    ||' - '
    ||PTL_EDW.D_LOCN.DIST_NM,
    CASE
    WHEN TRIM(PTL_EDW.D_VEHICLE.VEH_CAP_STAT) IN
    ('ACTIVE','ACCRUED')
    THEN 'Active'
    ELSE 'Inactive'
    END,
    DECODE(PTL_EDW.D_VEHICLE.CONTR_GRP, 'X' ,
    'NON-CONTRACT',PTL_EDW.D_VEHICLE.VEH_CAT),
    PTL_EDW.D_VEHICLE.VEH_UNIT_TYP ,
    PTL_EDW.D_VEHICLE.VEH_MODL_YR ,
    PTL_EDW.D_VEHICLE.VEH_MAKE ,
    PTL_EDW.D_VEHICLE.VEH_MODEL ,
    CASE
    WHEN
    PTL_HOLD.R_COMP_CODES.COMP_CD
    IN ('057','061')
    THEN 'Accident/Incident'
    ELSE 'Non-Accident/Incident'
    END ,
    PTL_HOLD.R_COMP_CODES.COMP_CD ,
    PTL_HOLD.R_COMP_CODES.COMP_DESC,
    PTL_HOLD.R_COMP_CODES.COMP_CD
    ||' - '
    ||PTL_HOLD.R_COMP_CODES.COMP_DESC,
    PTL_EDW.D_VEHICLE.UNIT_NUM ,
    PTL_EDW_D_RO_LOCN.DIST_NUM
    || PTL_EDW_D_RO_LOCN.DIST_SUFX
    || PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM,
    PTL_EDW_D_RO_LOCN.DIST_NUM
    || PTL_EDW_D_RO_LOCN.DIST_SUFX
    || PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
    || PTL_EDW.F_RO_DETL.RO_SEQ_NUM ,
    PTL_EDW.F_RO_DETL.RO_SRC ,
    PTL_EDW.F_RO_DETL.TOTAL_LABOR_HRS ,
    PTL_EDW.F_RO_DETL.TOTAL_LABOR_COST ,
    PTL_EDW.F_RO_DETL.OUT_COST ,
    PTL_EDW.F_RO_DETL.PARTS_COST ,
    PTL_EDW.F_RO_DETL.RO_COST ,
    TO_CHAR(PTL_EDW_D_RO_LOCN.LOCN_KEY),
    PTL_EDW.F_RO_DETL.RO_NUM ,
    PTL_EDW.F_RO_DETL.RO_SEQ_NUM ,
    PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
    FROM
    PTL_EDW.F_RO_DETL ,
    PTL_EDW.D_CUSTOMER ,
    PTL_EDW.D_LOCN ,
    PTL_EDW.D_VEHICLE ,
    PTL_HOLD.R_COMP_CODES ,
    PTL_EDW.D_LOCN PTL_EDW_D_RO_LOCN ,
    PTL_EDW.D_LOCN PTL_EDW_D_CHRG_LOCN,
    PTL_EDW.D_TIME ,
    PTL_EDW.D_LOCN CURRENT_VEH_LOCN ,
    PTL_EDW.F_VEH_LOCN ,
    PTL_EDW.D_VEHICLE CURRENT_VEH
    WHERE
    PTL_EDW.F_RO_DETL.CUST_KEY =
    PTL_EDW.D_CUSTOMER.CUST_KEY
    AND
    PTL_EDW.F_RO_DETL.LOCN_KEY =
    PTL_EDW.D_LOCN.LOCN_KEY
    AND
    PTL_EDW.D_TIME.TIME_KEY =
    PTL_EDW.F_RO_DETL.RO_TIME_KEY
    AND
    PTL_EDW.D_VEHICLE.VEH_KEY =
    PTL_EDW.F_RO_DETL.VEH_KEY
    AND
    PTL_EDW_D_RO_LOCN.LOCN_KEY =
    PTL_EDW.F_RO_DETL.RO_LOCN_KEY
    AND
    PTL_EDW.F_RO_DETL.CHRG_LOCN_KEY=
    PTL_EDW_D_CHRG_LOCN.LOCN_KEY
    AND
    CURRENT_VEH_LOCN.LOCN_KEY =
    PTL_EDW.F_VEH_LOCN.LOCN_KEY
    AND
    CURRENT_VEH.SCD_FLG ='A'
    AND
    CURRENT_VEH.CONTR_GRP ='P'
    AND
    CURRENT_VEH.CORP_CD =
    PTL_EDW.D_VEHICLE.CORP_CD
    AND CURRENT_VEH.UNIT_NUM =
    PTL_EDW.D_VEHICLE.UNIT_NUM
    AND
    CURRENT_VEH.VEH_KEY =
    PTL_EDW.F_VEH_LOCN.VEH_KEY
    AND
    PTL_HOLD.R_COMP_CODES.COMP_CD =
    PTL_EDW.F_RO_DETL.COMP_CD
    AND
    'Accounting Month' = 'RO Date'
    AND
    '2500' = 'NO-MIN'
    OR EXISTS
    SELECT
    RO_TOTAL_COST.RO_LOCN_KEY,
    RO_TOTAL_COST.ORIGINAL_RO_NUM
    FROM
    PTL_EDW.F_RO_DETL RO_TOTAL_COST,
    PTL_EDW.D_TIME DTIME
    WHERE
    'I' = 'I'
    OR
    'I' = 'E'
    AND RO_TOTAL_COST.RO_TYP 'W'
    AND RO_TOTAL_COST.RO_LOCN_KEY =
    PTL_EDW.F_RO_DETL.RO_LOCN_KEY
    AND RO_TOTAL_COST.ORIGINAL_RO_NUM =
    PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
    AND RO_TOTAL_COST.RO_TIME_KEY =
    DTIME.TIME_KEY
    AND DTIME.CALENDAR_DT BETWEEN to_date(
    '2011-JAN-01') AND to_date(
    '2012-SEP-24')
    GROUP BY
    RO_TOTAL_COST.RO_LOCN_KEY,
    RO_TOTAL_COST.ORIGINAL_RO_NUM
    HAVING
    SUM(RO_TOTAL_COST.RO_COST) >= TO_NUMBER
    (TRANSLATE('2500','NO-MIN',' '))
    AND PTL_EDW_D_CHRG_LOCN.DIST_NUM_SUFX IN (
    '014810')
    AND
    PTL_EDW.D_TIME.CALENDAR_DT BETWEEN to_date(
    '2011-JAN-01') AND to_date('2012-SEP-24')
    AND
    'I' = 'I'
    OR
    'I' = 'E'
    AND
    PTL_EDW.F_RO_DETL.RO_TYP
    'W'
    AND
    EXISTS
    SELECT
    FROM
    PTL_HOLD.USER_GEO
    WHERE
    USERID ='600125729'
    AND PTL_HOLD.USER_GEO.GEO IN (
    CURRENT_VEH_LOCN.CORP_CD,
    CURRENT_VEH_LOCN.REGN_NUM,
    CURRENT_VEH_LOCN.AREA_NUM,
    CURRENT_VEH_LOCN.RDIST_NUM,
    CURRENT_VEH_LOCN.DIST_NUM)
    UNION
    SELECT
    '../../opendoc/',
    '&hideSave=true&hideEdit=true&hideRefresh=true&hideUserPromptInput=true'
    'Data As Of:' ,
    'Run Date:' ,
    ptl_hold.get_stgextr_time('FACT_FPNA_RO'),
    'Accounting Month' ,
    PTL_EDW.F_RO_DETL.RO_TYP ,
    PTL_EDW.D_CUSTOMER.CUST_NUM ,
    (PTL_EDW.D_CUSTOMER.CUST_NUM )
    ||' - '
    ||( PTL_EDW.D_CUSTOMER.CUST_PRIME_NM),
    PTL_EDW.D_CUSTOMER.BILL_GRP ,
    CASE
    WHEN PTL_EDW.D_LOCN.CORP_CD='HPTL'
    THEN 'US'
    ELSE
    CASE
    WHEN PTL_EDW.D_LOCN.CORP_CD='2000'
    THEN 'CANADA'
    ELSE 'UNKNOWN'
    END
    END ,
    PTL_EDW.D_LOCN.REGN_NUM,
    PTL_EDW.D_LOCN.REGN_NUM
    ||' - '
    ||PTL_EDW.D_LOCN.REGN_NM,
    PTL_EDW.D_LOCN.AREA_NUM ,
    PTL_EDW.D_LOCN.AREA_NUM
    ||' - '
    ||PTL_EDW.D_LOCN.AREA_NM,
    PTL_EDW.D_LOCN.RDIST_NUM,
    PTL_EDW.D_LOCN.RDIST_NUM
    ||' - '
    ||PTL_EDW.D_LOCN.RDIST_NM,
    PTL_EDW.D_LOCN.DIST_NUM ,
    PTL_EDW.D_LOCN.DIST_NUM
    ||' - '
    ||PTL_EDW.D_LOCN.DIST_NM,
    CASE
    WHEN TRIM(PTL_EDW.D_VEHICLE.VEH_CAP_STAT) IN
    ('ACTIVE','ACCRUED')
    THEN 'Active'
    ELSE 'Inactive'
    END,
    DECODE(PTL_EDW.D_VEHICLE.CONTR_GRP, 'X' ,
    'NON-CONTRACT',PTL_EDW.D_VEHICLE.VEH_CAT),
    PTL_EDW.D_VEHICLE.VEH_UNIT_TYP ,
    PTL_EDW.D_VEHICLE.VEH_MODL_YR ,
    PTL_EDW.D_VEHICLE.VEH_MAKE ,
    PTL_EDW.D_VEHICLE.VEH_MODEL ,
    CASE
    WHEN
    PTL_HOLD.R_COMP_CODES.COMP_CD
    IN ('057','061')
    THEN 'Accident/Incident'
    ELSE 'Non-Accident/Incident'
    END ,
    PTL_HOLD.R_COMP_CODES.COMP_CD ,
    PTL_HOLD.R_COMP_CODES.COMP_DESC,
    PTL_HOLD.R_COMP_CODES.COMP_CD
    ||' - '
    ||PTL_HOLD.R_COMP_CODES.COMP_DESC,
    PTL_EDW.D_VEHICLE.UNIT_NUM ,
    PTL_EDW_D_RO_LOCN.DIST_NUM
    || PTL_EDW_D_RO_LOCN.DIST_SUFX
    || PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM,
    PTL_EDW_D_RO_LOCN.DIST_NUM
    || PTL_EDW_D_RO_LOCN.DIST_SUFX
    || PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
    || PTL_EDW.F_RO_DETL.RO_SEQ_NUM ,
    PTL_EDW.F_RO_DETL.RO_SRC ,
    PTL_EDW.F_RO_DETL.TOTAL_LABOR_HRS ,
    PTL_EDW.F_RO_DETL.TOTAL_LABOR_COST ,
    PTL_EDW.F_RO_DETL.OUT_COST ,
    PTL_EDW.F_RO_DETL.PARTS_COST ,
    PTL_EDW.F_RO_DETL.RO_COST ,
    TO_CHAR(PTL_EDW_D_RO_LOCN.LOCN_KEY),
    PTL_EDW.F_RO_DETL.RO_NUM ,
    PTL_EDW.F_RO_DETL.RO_SEQ_NUM ,
    PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
    FROM
    PTL_EDW.F_RO_DETL ,
    PTL_EDW.D_CUSTOMER ,
    PTL_EDW.D_LOCN ,
    PTL_EDW.D_VEHICLE ,
    PTL_HOLD.R_COMP_CODES ,
    PTL_EDW.D_LOCN PTL_EDW_D_RO_LOCN ,
    PTL_EDW.D_LOCN PTL_EDW_D_CHRG_LOCN,
    PTL_EDW.D_LOCN CURRENT_VEH_LOCN ,
    PTL_EDW.F_VEH_LOCN ,
    PTL_EDW.D_VEHICLE CURRENT_VEH
    WHERE
    PTL_EDW.F_RO_DETL.CUST_KEY =
    PTL_EDW.D_CUSTOMER.CUST_KEY
    AND
    PTL_EDW.F_RO_DETL.LOCN_KEY =
    PTL_EDW.D_LOCN.LOCN_KEY
    AND
    PTL_EDW.D_VEHICLE.VEH_KEY =
    PTL_EDW.F_RO_DETL.VEH_KEY
    AND
    PTL_EDW_D_RO_LOCN.LOCN_KEY =
    PTL_EDW.F_RO_DETL.RO_LOCN_KEY
    AND
    PTL_EDW.F_RO_DETL.CHRG_LOCN_KEY=
    PTL_EDW_D_CHRG_LOCN.LOCN_KEY
    AND
    CURRENT_VEH_LOCN.LOCN_KEY =
    PTL_EDW.F_VEH_LOCN.LOCN_KEY
    AND
    CURRENT_VEH.SCD_FLG ='A'
    AND
    CURRENT_VEH.CONTR_GRP ='P'
    AND
    CURRENT_VEH.CORP_CD =
    PTL_EDW.D_VEHICLE.CORP_CD
    AND CURRENT_VEH.UNIT_NUM =
    PTL_EDW.D_VEHICLE.UNIT_NUM
    AND
    CURRENT_VEH.VEH_KEY =
    PTL_EDW.F_VEH_LOCN.VEH_KEY
    AND
    PTL_HOLD.R_COMP_CODES.COMP_CD =
    PTL_EDW.F_RO_DETL.COMP_CD
    AND
    'Accounting Month' = 'Accounting Month'
    AND
    '2500' = 'NO-MIN'
    OR EXISTS
    SELECT
    RO_TOTAL_COST.RO_LOCN_KEY,
    RO_TOTAL_COST.ORIGINAL_RO_NUM
    FROM
    PTL_EDW.F_RO_DETL RO_TOTAL_COST
    WHERE
    'I' = 'I'
    /* what's the point? A literal always equals itself. /*
    OR
    'I' = 'E'
    /* again, what's the point? This will never be true */
    AND RO_TOTAL_COST.RO_TYP 'W'
    AND RO_TOTAL_COST.RO_LOCN_KEY =
    PTL_EDW.F_RO_DETL.RO_LOCN_KEY
    AND RO_TOTAL_COST.ORIGINAL_RO_NUM =
    PTL_EDW.F_RO_DETL.ORIGINAL_RO_NUM
    AND RO_TOTAL_COST.PARTITION_KEY BETWEEN
    to_number(TO_CHAR(to_date('2011-JAN-01','YYYY-MON-DD'),'yyyymm')) AND
    to_number(TO_CHAR(to_date('2012-SEP-24','YYYY-MON-DD'),'yyyymm'))
    /* what is the data type of PARTITION_KEY? This manipulation strongly suggests that it should be DATE and isn't.
    GROUP BY
    RO_TOTAL_COST.RO_LOCN_KEY,
    RO_TOTAL_COST.ORIGINAL_RO_NUM
    HAVING
    SUM(RO_TOTAL_COST.RO_COST) >= TO_NUMBER(TRANSLATE('2500','NO-MIN',' '))
    AND PTL_EDW_D_CHRG_LOCN.DIST_NUM_SUFX IN (
    '014810')
    AND
    PTL_EDW.F_RO_DETL.PARTITION_KEY BETWEEN
    to_number(TO_CHAR(to_date('2011-JAN-01',
    'YYYY-MON-DD'),'yyyymm')) AND to_number(
    TO_CHAR(to_date('2012-SEP-24',
    'YYYY-MON-DD'),'yyyymm'))
    AND
    'I' = 'I'
    OR
    'I' = 'E'
    AND
    PTL_EDW.F_RO_DETL.RO_TYP
    'W'
    AND
    EXISTS
    SELECT
    FROM
    PTL_HOLD.USER_GEO
    WHERE
    USERID ='600125729'
    AND PTL_HOLD.USER_GEO.GEO IN (
    CURRENT_VEH_LOCN.CORP_CD,
    CURRENT_VEH_LOCN.REGN_NUM,
    CURRENT_VEH_LOCN.AREA_NUM,
    CURRENT_VEH_LOCN.RDIST_NUM,
    CURRENT_VEH_LOCN.DIST_NUM)

  • Using s SQL server as a data source for Project Siena (An AX SQL database more specificaly)?

    I cant seem to find this information on the internet yet so I figured I would ask my question here.
    I would like to pull data from a Dynamics AX sql database to use in a project siena app. I have heard that this is something that is planned for a future release of Siena but is there any way this can be done currently?
    Thank you

    Hi Philip,
    It's not supported in the current version. The following thread from Vijay outlines some of the features targeted for the next release:
    http://social.technet.microsoft.com/Forums/en-US/405aed19-21b8-4a36-bf45-b1d962567c3b/some-functionality-in-the-next-siena-refresh?forum=projectsiena. As you can see, it will include read/write over web services. So, if your data is exposed using services,
    you should be able to meet your requirements.
    Thanks
    Robin

Maybe you are looking for