Need changes in sql

Hi,
I need to create an SSRS report 'Incomplete Statements with Subpayments'
so the goal of this report is to return any statements that hasn't be marked paid but have at least one subpayment

Hi Visakh,
for this above query i get only invoice table records only but i didnt get ProviderInvoicePaymentDetails table records.I want records of invoice and ProviderInvoicePaymentDetails tables
Just add a join to ProvviderInvoicePaymentDetails table for that
select *
from invoice i
INNER JOIN ProviderInvoicePaymentDetails p
ON p.invoiceid = i.id
WHERE i.ProviderPaymentCompleted = 0
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

Similar Messages

  • Help! Need to generate SQL script file in every build of every changes in database project on TFS

    Hi everyone,
                I want to accomplish a task in TFS that I need to auto generate the database changes as SQL script file in drop folder for every build.
    For ex.: If I add a table in a database and then check in the changes, I need to get that create table script in the drop folder as .sql file extension
    I want to automate the build too for every check in. Help me out and guide me a step by step procedure because since I am new to TFS build in visual studio.
    Thanks

    Check out SSDT:
    https://msdn.microsoft.com/en-us/data/tools.aspx
    It can generate a DACPAC which can be used to update a SQL Database through the commandline. To ensure that the .sql file executed is compatible with the target database schema it contains a compiled version of teh schema and will generate the change script
    on-the-fly.
    If you want, you call SqlPackage,exe to generate a SQL script if you want to inspect it before executing.
    https://msdn.microsoft.com/en-us/library/hh550080%28v=vs.103%29.aspx
    My blog: blog.jessehouwing.nl

  • Need to adjust SQL query for left outer join in Crystal Reports 2008.

    I need to change this SQL 2005 query.....
    SELECT     omnicell_anl.DeviceIDsLastMetricTable.member_id, omnicell_anl.DeviceIDsLastMetricTable.[Device Name],
                          omnicell_anl.DeviceIDsLastMetricTable.Account, omnicell_anl.labeledLastMetrics.PROPERTY_NAME,
                          omnicell_anl.labeledLastMetrics.latest_monitor_value
    FROM         omnicell_anl.DeviceIDsLastMetricTable LEFT OUTER JOIN
                          omnicell_anl.labeledLastMetrics ON omnicell_anl.DeviceIDsLastMetricTable.member_id = omnicell_anl.labeledLastMetrics.member_id
    WHERE
        omnicell_anl.labeledLastMetrics.PROPERTY_NAME = ?MyProperty
    To this query in Crystal Reports Report Writer:
    SELECT     omnicell_anl.DeviceIDsLastMetricTable.member_id, omnicell_anl.DeviceIDsLastMetricTable.[Device Name],
                          omnicell_anl.DeviceIDsLastMetricTable.Account, omnicell_anl.labeledLastMetrics.PROPERTY_NAME,
                          omnicell_anl.labeledLastMetrics.latest_monitor_value
    FROM         omnicell_anl.DeviceIDsLastMetricTable LEFT OUTER JOIN
                          omnicell_anl.labeledLastMetrics ON omnicell_anl.DeviceIDsLastMetricTable.member_id = omnicell_anl.labeledLastMetrics.member_id AND
                          omnicell_anl.labeledLastMetrics.PROPERTY_NAME = ?MyProperty
    I can't seem to get the left outer join function of Crystal Reports to emulate the same SQL query in SQL 2005.  Any ideas on how I can create this same query in Crystal 2008?
    Thanks,
    Dominic
    Edited by: Dominic Carissimi on Oct 28, 2008 7:55 PM
    Edited by: Dominic Carissimi on Oct 28, 2008 7:56 PM

    If you want the list of values for command level parameter then you need to add another command like
    select PropertyField from table
    and delete the links between this command and the existing command.
    Now go to field explorer and edit the command level parameter and make it as dynamic and add the property field from newly added command.
    Hope this helps!
    Raghavendra

  • Need to run SQL in BQY

    Hi All,
    I have a client where he is using Custom SQL in the query section. The following SQL statement retrieves the results at the database side without any issues. But the same when used in the IR studio Custom SQL it is throwing errors like "invalid identifier".
    select a.contract_id, a.contract_cd, a.original_contract_eff_dt,
    bb.contract_id AS bb_contract_id,
    bb.contract_cd AS bb_contract_cd,
    bb.original_contract_eff_dt AS bb_original_contract_eff_dt
    from wlp_mart.l_contract a
    INNER JOIN wlp_mart.l_event b
    ON a.event_id = b.event_id
    LEFT OUTER JOIN wlp_mart.l_contract bb
    ON a.contract_id = bb.contract_id
    and nvl(bb.original_contract_eff_dt,sysdate) >= to_date('20070101','yyyymmdd')
    and nvl(bb.original_contract_eff_dt,sysdate) < to_date('20080501','yyyymmdd')
    and nvl(bb.contract_cancel_reason_cd,'x') != 'RB080815'
    where a.original_contract_eff_dt >= to_date('20070101','yyyymmdd')
    and a.original_contract_eff_dt < to_date('20080501','yyyymmdd')
    and b.brand_id = 'BCA'
    and a.contract_cancel_reason_cd = 'RB080815'
    and b.business_unit = 'INDIVIDUAL'
    and b.media_type in ('CARRIER ROUTE','DIRECT MAIL','DRTV','INSERT MEDIA','INTERNET ADVERTISING','INTERNET PURCHASED LEADS');
    Any help is appreciated.
    Thanks,
    Sree

    Again, I caution against relying on the Import SQL. You will not be able to modify the SQL String once it is imported.
    If you want to use the View -> CustomSQL then you will need to see what IR is setting the table Aliases as and adjust your SQL String appropriately.
    If you want to use code to change values i.e. the dates then you can work with the ObjectModel and change the SQL string in the CustomSQL via JavaScript.
    Hope this is helpful
    Wayne Van Sluys
    TopDown Consulting

  • Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field

    Hello,
    I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
    Table structures are mentioned below:
    OP:
    Name                             Null                    Type        
    OP_NBR                    NOT NULL      NUMBER(4)    (Primary Key)
    OP_DESC                                        VARCHAR2(50)
    OP_PAYLOD_XML                           CLOB       
    GM:
    Name                          Null                   Type        
    GM_NBR                  NOT NULL       NUMBER(4)    (Primary Key)
    GM_DESC                                       VARCHAR2(40)
    OP_NBR               NOT NULL          NUMBER(4)    (Foreign Key)
    GM_PAYLOD_XML                          CLOB   
    DM:
    Name                          Null                    Type        
    DM_NBR                  NOT NULL         NUMBER(4)    (Primary Key)
    DM_DESC                                         VARCHAR2(40)
    GM_NBR                  NOT NULL         NUMBER(4)    (Foreign Key)
    DM_PAYLOD_XML                            CLOB       
    DE:
    Name                          Null                    Type        
    DE_NBR                     NOT NULL           NUMBER(4)    (Primary Key)
    DE_DESC                   NOT NULL           VARCHAR2(40)
    DM_NBR                    NOT NULL           NUMBER(4)    (Foreign Key)
    DE_PAYLOD_XML                                CLOB    
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    SELECT
    j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
    i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
    h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
    g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
    FROM
    DE g, DM h, GM i, OP j
    WHERE
    h.dm_nbr = g.dm_nbr(+) and
    i.gm_nbr = h.gm_nbr(+) and
    j.op_nbr = i.op_nbr(+)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
    Current O/P:
    <resultSet>
         <Record1>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <DM_PAYLOD_XML1>
              <DE_PAYLOD_XML1>
         </Record1>
         <Record2>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML2>
              <DM_PAYLOD_XML2>
              <DE_PAYLOD_XML2>
         </Record2>
         <RecordN>
              <OP_PAYLOD_XMLN>
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XMLN>
         </RecordN>
    </resultSet>
    Now i want to change my SQL query so that i get following output structure:
    <resultSet>
         <Record>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <GM_PAYLOD_XML2> .......
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XML1>
              <DM_PAYLOD_XML2> .......
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XML1>
              <DE_PAYLOD_XML2> .......
              <DE_PAYLOD_XMLN>
         </Record>
         <Record>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML1'>
              <GM_PAYLOD_XML2'> .......
              <GM_PAYLOD_XMLN'>
              <DM_PAYLOD_XML1'>
              <DM_PAYLOD_XML2'> .......
              <DM_PAYLOD_XMLN'>
              <DE_PAYLOD_XML1'>
              <DE_PAYLOD_XML2'> .......
              <DE_PAYLOD_XMLN'>
         </Record>
    <resultSet>
    Appreciate your help in this regard!

    Hi,
    A few questions :
    How's your first query supposed to give you an XML output like you show ?
    Is there something you're not telling us?
    What's the content of, for example, <OP_PAYLOD_XML1> ?
    I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
    What's the db version BTW?

  • Does changing the SQL Server Service Account impact FILESTREAM data?

    I have a stand-alone SQL Server 2008 instance that I need to change the SQL Server service account from LocalSystem to a domain account.  However, I was wondering if there was any impact on FILESTREAM enabled databases that are hosted on the SQL Server? 
    Specifically, has anyone ever changed the SQL Server service account when using FILESTREAM ...
    Sincerely,
    Sean Fitzgerald

    I have a stand-alone SQL Server 2008 instance that I need to change the SQL Server service account from LocalSystem to a domain account.  However, I was wondering if there was any impact on FILESTREAM enabled databases that are hosted on the SQL Server? 
    Specifically, has anyone ever changed the SQL Server service account when using FILESTREAM ...
    Sincerely,
    Sean Fitzgerald
    BOL says : Only the account under which the SQL Server service account runs is granted NTFS permissions to the FILESTREAM container.So,  if you start SQL Server under different account , that account wil have access to use fliestream data (read / write)
    At the database level ,If a user has permission to the FILESTREAM column in a table, the user can open the associated files..
    Abhay Chaudhary OCP 9i, MCTS/MCITP (SQL Server 2005, 2008, 2005 BI) ms-abhay.blogspot.com/

  • Change TMS SQL usage Port

    Hi,
    We use TMS version 14.6
    I need change default ports used by SQL server (destination ports TCP 1433 ->TCP 3341)
    Please find sheet or give advise
    Thank you

    If you run the TMS Tools application (C:\Program Files (x86)\TANDBERG\TMS\TMSTools\TMSTools.exe) and go to the Configuration Tab, that lets you change the Port from the detault 1433.
    Wayne
    Please remember to rate responses and to mark your question as answered if appropriate.

  • How to Change the Default SSH Port from Terminal ? now showing default SSH Port 22 i need change it pls help me how can do

    How to Change the Default SSH Port from Terminal ?
    now showing default SSH Port 22 i need change it pls help me how can do

    How to Change the Default SSH Port from Terminal ?
    now showing default SSH Port 22 i need change it pls help me how can do

  • After changing 'MS SQL server' service's user name SDAC doesn't work properly

    I've changed 'MS SQL Server' service user name
    from .\admin (have had such already) to network_services
    and now my oracle linked servers to Oracle instance stopped to work.
    Namely, 'Cannot create an instance of OLE DB provider "OraOLEDB.Oracle" for linked server Ora_RO'.
    In event log i see next:
    The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID 
    {2206CDB0-19C1-11D1-89E0-00C04FD7A829}
     and APPID 
    {2206CDB0-19C1-11D1-89E0-00C04FD7A829}
     to the user NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.
    So, MSDAINITIALIZE Class fails to start. I cannot locate this service under dcomcnfg. Could you help me?

    The error seems to be clear what is causing the issue, check this link to fix this issue
    Here the scenario is with SharePoint instead oracle so you can make out:-
    http://www.wictorwilen.se/Post/Fix-the-SharePoint-DCOM-10016-error-on-Windows-Server-2008-R2.aspx
    http://social.technet.microsoft.com/Forums/en-US/696204d5-b07e-46db-a785-737ea57b8da2/distributed-com-error-message
    Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL
    INSQLSERVER.COM
    Mohammad Nizamuddin

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • LOVE Firefox! I have just launched a website. One designer told me it takes 7-10 days for any changes to appear. Why? I have cleared caches and cookies etc. I need to be more responsive than 7-1o days. I need changes to appear within 24hrs.

    LOVE Firefox! I have just launched a website: www.animalhealingandhumans.com. My web designer told me it takes 7-10 days for any changes to appear. Why? I have cleared caches and cookies etc. I need to be more responsive than 7-1o days. I need changes to appear within 24hrs. How can I achieve a much better response time to good feedback?

    Hello binbingogoABC,
    Shopping on BestBuy.com should be easy and fun and not fraught with the kind of trouble that you describe. I regret very much that this has been your experience.
    Using the information you provided when you signed up for Best Buy Unboxed I was able to locate your cancelled orders. I have requested more information from my back-office partners. As soon as I have additional details about your situation, I will reply again to this message. In the interim, I'm sorry that I must impose upon your patience.
    I'm very grateful that you wrote to us with your concerns.
    Sincerely,

  • Need Oracle Payroll SQL Query

    Hello,
    I need Oracle Payroll SQL Query with result:
    First_name, Last_name, Payment_amount, Pay_date, Payroll_Frequency, Employement_status
    Any Help would be greatful appreciated

    You will need the following tales.
    per_all_people_f, per_all_assignments_f,pay_run_results,pay_run_result_values
    Query would e something like :
    select papf.first_name,
             papf.last_name,
             prrv.*
    From  apps.per_all_people_f papf
             apps.per_all_assignments_f paaf
             apps.pay_run_results prr,
             apps.pay_run_result_values prrv
    Where papf.person_id = paaf.person_id
    and papf.business_group_id = paaf.business_group_id
    and papf.current_employee_flag = 'Y'
    and paaf.primary_flag ='Y'
    and paaf.assignment_type = 'E'
    and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
    and trunc(sysdate) between paaf.effective_start_date and paaf.effective_end_date 
    and prr.assignment_id = paaf.assignment_id

  • Change automatic SQL Tuning Advisor time

    Hi All,
    can anyone help me in changing "automatic SQL Tuning Advisor" job timingsm because currently it is scheduled during peak hours , i want to change it to evening 6 pm daily.Because during peak hours it is taking more cpu and taking one hour.
    Wed May 08 08:00:10 2013
    Begin automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK"
    Wed May 08 08:05:47 2013
    thanks
    Mapps

    Hello,
    Here's what you can do,
    Create a new window to the time you want it to run:
    EXEC dbms_scheduler.create_window(window_name => 'YOUR_WINDOW_NAME',
    duration => numtodsinterval(1, 'hour'),
    resource_plan => 'DEFAULT_MAINTENANCE_PLAN',
    repeat_interval => 'FREQ=DAILY;BYHOUR=18;BYMINUTE=0;BYSECOND=0');>
    The above window would be in effect from 6 pm to 7 pm.
    Then, disable automatic sql_tuning and then re-enable it to run on the window you just created:
    EXEC DBMS_AUTO_TASK_ADMIN.DISABLE(client_name => 'sql tuning advisor',
    operation => NULL,
    window_name => NULL);>
    and now set it to run to your window:
    EXEC DBMS_AUTO_TASK_ADMIN.ENABLE(client_name => 'sql tuning advisor',
    operation => NULL,
    window_name => 'YOUR_WINDOW_NAME');

  • Purchase Order - I need change subject E-mail

    Hi All,
    When I create an e-mail trough the transaction code ME23N and I try to send the e-mail trough the transaction code ME9F the e-mail arrives with a default subject (PROGRAM NAME + CURRENT DATE), I need change the subject according the necessity of the project.
    Can someone help me, please ?
    Thanks a lot !!!

    Hi,
    Check out what Dhruba has suggested below first, but if the program has been set up to do this instead try the following
    Go to transaction OMFE and look down the list to see which program has been allocated to the Output type and medium that you are using (probably NEU and 5 or 7? if you are using the standard oputput condition types).
    Then get your ABAP programmer to check and change the code of that program.
    Steve B

  • I  need change main email address in iCloud, make alias email main

    i  need change main email address in iCloud, make alias email main

    I'm afraid you can't do this. Once you've chosen the main @icloud.com address when you set up the account you can't change it (other than by creating a completely new account); and you can't make an alias the main address in the account it's in or any other account.

Maybe you are looking for