SQL Server SUM of Multiple rows with where and group by

I have a table Transaction that looks something like the following :
TransactionID          
Currency        
Credit             
Debit
1                                USD                   
500               0
2                                Afcu                    
6000             0
3                                INR                     
0                   200
4                                Pfc                      
7000             0
5                                AUD                     
0                  200
6                                INR                     
7000              0
7                                USD                    
1000              0
I write query like this
select SUM(credit)-SUM(Debit)as [Balance] ,Source from Transaction group by Source
and it came like
Balance
Source           
1500                        USD
6000                        Afcu
6800                        INR
7000                        Pfc
-200                         AUD
But I also want to add  Afcu , Pfc with
USD and  want output like
Balance
Source           
14500                        USD
6800                          INR
-200                           AUD
Any Idea?

Here is how you can do it, but you 
DECLARE @TransTable TABLE
(TransactionID INT IDENTITY(1,1),
Currency varchar(10),
Credit DECIMAL,
Debit DECIMAL)
INSERT INTO @TransTable VALUES
('USD',500,0),('Afcu',6000,0),('INR',0,200),('Pfc',7000,0),('AUD',0,200),
('INR',7000,0),('USD',1000,0)
SELECT Currency, SUM(credit)-SUM(Debit)as [Balance]
FROM @TransTable
WHERE Currency NOT IN ('Afcu', 'pfc','USD')
GROUP BY Currency
UNION
SELECT 'USD', SUM(credit)-SUM(Debit)as [Balance]
FROM @TransTable
WHERE Currency IN ('Afcu', 'pfc','USD')
SQL fiddler example
Output:
Hope this will help
Glad to help! Please remember to accept the answer if you found it helpful. It will be useful for future readers having same issue.
My Profile on Microsoft ASP.NET forum

Similar Messages

  • SQL Server Express 2014 Installation Completes with Failures and Repair Does Nothing to Help

    I am attempting to install SQL Server Express 2014 on a development machine and as usual old versions of SQL and the remnants of them are a plague to the installation.
    I have used to Revo Uninstaller to scrub the old installations and with my first attempt after some additional work on the registry I was able to get an instance to install and remarkably I was able to connect to the instance. However, I removed an application
    reference to SQL Server 2008 after the SQL Express 2014 installation (through Control Panel > Programs > Programs and Features) and it stopped working immediately.
    So I removed (uninstalled using Revo Uninstaller) every reference to any SQL Server application as well as removed all of the registry references (using Revo) and I can now install SQL Server Express 2014 with 
    "Feature" failures [Reporting Services, Database Engine Services, Full-Text and Semantic Extractions for Search and SQL
    Server Replication]  and of course it doesn't work.
    Now when I attempt "Repair" the installation the process ends normally (no errors) and reports  "Success" however SQL still has no instance and the services are not running nor are they visible when I open the "SQL Server Configuration
    Manager".
    This is the "Repair" log:
    Overall summary:
    Final result: Passed
    Exit code (Decimal): 0
    Start time: 2014-12-21 17:21:37
    End time: 2014-12-21 17:29:10
    Requested action: Repair
    Machine Properties:
    Machine name: EDWARD-PC2
    Machine processor count: 4
    OS version: Windows 7
    OS service pack: Service Pack 1
    OS region: United States
    OS language: English (United States)
    OS architecture: x86
    Process architecture: 32 Bit
    OS clustered: No
    Product features discovered:
    Product Instance Instance ID Feature Language Edition Version Clustered Configured
    SQL Server 2014 Management Tools - Basic 1033 Express Edition 12.0.2000.8 No Yes
    SQL Server 2014 Management Tools - Complete 1033 Express Edition 12.0.2000.8 No Yes
    SQL Server 2014 Client Tools Connectivity 1033 Express Edition 12.0.2000.8 No Yes
    SQL Server 2014 Client Tools Backwards Compatibility 1033 Express Edition 12.0.2000.8 No Yes
    SQL Server 2014 Client Tools SDK 1033 Express Edition 12.0.2000.8 No Yes
    SQL Server 2014 LocalDB 1033 Express Edition 12.0.2000.8 No Yes
    Package properties:
    Description: Microsoft SQL Server 2014
    ProductName: SQL Server 2014
    Type: RTM
    Version: 12
    SPLevel: 0
    Installation location: C:\Users\Edward\Downloads\SQLEXPRADV_x86_ENU\x86\setup\
    Installation edition:
    User Input Settings:
    ACTION: Repair
    AGTDOMAINGROUP: <empty>
    AGTSVCACCOUNT: <empty>
    AGTSVCPASSWORD: <empty>
    AGTSVCSTARTUPTYPE: Manual
    ASCONFIGDIR: Config
    ASSVCACCOUNT: <empty>
    ASSVCPASSWORD: <empty>
    CLTSTARTUPTYPE: 0
    CLTSVCACCOUNT: <empty>
    CLTSVCPASSWORD: <empty>
    CONFIGURATIONFILE:
    CTLRSTARTUPTYPE: 0
    CTLRSVCACCOUNT: <empty>
    CTLRSVCPASSWORD: <empty>
    ENU: true
    FAILOVERCLUSTERGROUP: <empty>
    FAILOVERCLUSTERNETWORKNAME: <empty>
    FTSVCACCOUNT: <empty>
    FTSVCPASSWORD: <empty>
    HELP: false
    IACCEPTSQLSERVERLICENSETERMS: false
    INDICATEPROGRESS: false
    INSTANCENAME: <empty>
    ISSVCACCOUNT: NT AUTHORITY\Network Service
    ISSVCPASSWORD: <empty>
    ISSVCSTARTUPTYPE: Automatic
    QUIET: false
    QUIETSIMPLE: false
    SQLSVCACCOUNT: <empty>
    SQLSVCPASSWORD: <empty>
    UIMODE: AutoAdvance
    X86: false
    Configuration file: C:\Program Files\Microsoft SQL Server\120\Setup Bootstrap\Log\20141221_172135\ConfigurationFile.ini
    Detailed results:
    Feature: Management Tools - Complete
    Status: Passed
    Feature: Client Tools Connectivity
    Status: Passed
    Feature: Client Tools SDK
    Status: Passed
    Feature: Client Tools Backwards Compatibility
    Status: Passed
    Feature: Management Tools - Basic
    Status: Passed
    Feature: SQL Browser
    Status: Passed
    Feature: Documentation Components
    Status: Passed
    Feature: SQL Writer
    Status: Passed
    Feature: LocalDB
    Status: Passed
    Feature: SQL Client Connectivity
    Status: Passed
    Feature: SQL Client Connectivity SDK
    Status: Passed
    Feature: Setup Support Files
    Status: Passed
    Rules with failures:
    Global rules:
    There are no scenario-specific rules.
    Rules report file: C:\Program Files\Microsoft SQL Server\120\Setup Bootstrap\Log\20141221_172135\SystemConfigurationCheck_Report.htm
    However this is what the "SQL Sever Configuration Manager" look like:
    Why does this appear to not be working properly? I can not connect the the "local" instance and I would guess that the service either does not exist or is not running.
    Edward Walker

    Hello,
    To my knowledge, Revo is not a supported way to uninstall SQL Server.
    Please try to uninstall all you can using Control Panel -> Programs and Features, then perform a manual uninstall to
    remove remnants. Try the following procedure:
    1. Uninstall all SQL Server 2012 components you can using Control Panel -> Programs and Features
    2. Backup the registry.
    3. Delete the following keys in regedit:
    --HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
    --HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer
    4. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall and delete all the sub-keys referencing
    SQL Server.
    5. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services and delete all the keys referencing SQL Server.
    6. Rename all the SQL Server folders in the computer like C:\Program Files\Microsoft SQL Server and subfolders.
    After performing above procedure, try to reinstall SQL Server again.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Web dynpro screen with multiple rows with columns that can be edited

    Web dynpro screen with multiple rows with columns that can be edited individually:
    Hi
    I am busy creating a screen in web dynpro for ABAP which we would like to make available via Portal ESS (Portal 7).
    I need to add 'n type of table (or almost something like Excel) or something in which someone can type a few paycode numbers (there should be lets say 10 blank rows in which info can be typed in and if I click on a button or so, more rows must be added if necessary.  Then in the other colums stuff like amounts must be entered which one should also be able to edit then and there.
    Can anyone assist in what I can use for this?  There does not seem to be some existing element that I can use.
    Help will be appreciated.
    Regards
    Debbie

    Hi Debbie,
    Whiel Creating table you need to be care full that use chose INPUT FIELD as the CELL EDITOR. Just guessing that if ur table is not editable u might have choosen TextView as default cell editor type.
    check link for details on TABLE UI
    [http://help.sap.com/saphelp_erp2005/helpdata/EN/b5/ac884118aa1709e10000000a155106/frameset.htm]
    easy way is to first add UI ELEMENT TABLE to your VIEW, then right click over it & select create binding from context. After you have a pop up where you can select what columns you want what should be its cell editor etc.
    Greetings
    Prashant

  • Single Update command to update multiple rows with multiple rows

    Hi Gurus!
    Can I update table A with a result set of table b (multiple rows returns) where a.c1 = b.c1
    regards,
    SH

    As Joel mentioned this update will update all rows in a table based on another one:
    update tableA set seq_no = (select seqno from tableB where tableA.ID = tableB.ID)
    Also, any rows that don't match the select criteria will get updated to null. This could be very bad depending on what you want to do.
    To update a subset of tableA with data from tableB:
    update tableA set seq_no = (select seqno from tableB where tableA.ID = tableB.ID)
    where exists (select 1 from tableB where tableA.ID = tableB.ID)

  • What are the SQL server versions those are compatible with XI 3.0.

    Hi All,
    Please suggest,
    what are the SQL server versions those are compatible with XI 3.0.
    or with which SQL server versions XI 3.0 will interact using JDBC Adapter.

    Check in the [Product Availability Matrix |https://websmp201.sap-ag.de/~form/handler?_APP=00200682500000001303&_EVENT=DISP_NEW&00200682500000002804=01200314690900000192]in market place for more information on this
    Thanks
    SaNv...

  • Failure to install SQL Server 2012 SP1 CU8/9 with a "Failed to retrieve data for this request." error

    Hi all,
    Has anyone come across SQL Server 2012 SP1 CU8/9 failing to install with a “Failed to retrieve data for this request.” error.
    The error is too generic for a useful search on web, for me at least anyway.
    Had no problems patching a whole bunch of other servers in the same environment.
    I’m no good at reading these error logs. For some reason the primary replica is referenced in the detailed log???
    The CU8/9 patch has been run by both Domain Admins and local Admin with no luck.
    We are trying to patch a secondary failover replica. (SharePoint 2013 is installed on this server.)
    This is from the summary log:
    Overall summary:
      Final   result:                    The patch installer has failed to update the shared features. To determine   the reason for failure,
    review the log files.
      Exit code   (Decimal):             -2146233088
      Exit facility   code:            19
      Exit error   code:                 5376
      Exit   message:                    Failed to retrieve data for this request.
      Start   time:                      2014-04-10 11:51:11
      End   time:                        2014-04-10 11:51:49
      Requested   action:                Patch
      Exception help link:            
    http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3412.0&EvtType=0xB2652E58%400xDC80C325&EvtType=0xB2652E58%400xDC80C325
    Machine Properties:
      Machine   name:                    VMSPDB2
      Machine processor   count:       4
      OS version:                      Future Windows Version
      OS service   pack:                
      OS   region:                       Australia
      OS   language:                     English (United States)
      OS   architecture:                 x64
      Process   architecture:          64 Bit
      OS   clustered:                    Yes
    Product features discovered:
      Product                Instance               Instance ID                     
    Feature                                    Language              
    Edition                Version         Clustered  Configured
      SQL Server   2012        MSSQLSERVER            MSSQL11.MSSQLSERVER              Database
    Engine Services                   1033                   Enterprise Edition  
    11.1.3000.0     No           Yes      
      SQL Server   2012        MSSQLSERVER          MSSQL11.MSSQLSERVER              SQL Server  
    Replication                     1033                   Enterprise
    Edition     11.1.3000.0       No           Yes      
      SQL Server   2012        MSSQLSERVER            MSSQL11.MSSQLSERVER              Full-Text
    and Semantic Extractions for Search   1033                   Enterprise Edition   11.1.3000.0       No        
    Yes        
      SQL Server   2012        MSSQLSERVER            MSSQL11.MSSQLSERVER              Data
    Quality Services                      1033                  
    Enterprise Edition   11.1.3000.0       No           Yes      
      SQL Server   2012                                                           
    Management   Tools -   Basic                   1033                  
    Enterprise Edition   11.1.3000.0       No           Yes      
      SQL Server   2012                                                           
    Management Tools - Complete                1033                   Enterprise Edition  
    11.1.3000.0       No           Yes      
      SQL Server   2012                                                           
    Client Tools Connectivity                  1033                   Enterprise Edition  
    11.1.3000.0     No           Yes      
      SQL Server   2012                                                           
    SQL Server Data   Tools                      1033                  
    Enterprise Edition   11.1.3000.0       No           Yes      
      SQL Server   2012                                                           
    Integration   Services                       1033                  
    Enterprise Edition   11.1.3000.0       No           Yes      
    Package properties:
        Description:                     Microsoft SQL Server 2012 Service Pack 1
        ProductName:                     SQL Server 2012
        Type:                            RTM
        Version:                         11
        SPLevel:                         1
      KBArticle:                       KB2931078
        KBArticleHyperlink:             
    http://support.microsoft.com/?kbid=2931078
        PatchType:                       QFE
        AssociatedHotfixBuild:         0
        Platform:                        x64
        PatchLevel:                      11.1.3412.0
        ProductVersion:                  11.1.3000.0
        GDRReservedRange:                10.0.1000.0:10.0.1099.0;10.0.3000.0:10.0.3099.0
        PackageName:                     SQLServer2012-KB2931078-x64.exe
      Installation   location:           e:\90a192411a98d1f6dc\x64\setup\
    User Input Settings:
        ACTION:                          Patch
        ALLINSTANCES:                    false
        CLUSTERPASSIVE:                  false
        CONFIGURATIONFILE:              
      ENU:                             false
        HELP:                            false
      IACCEPTSQLSERVERLICENSETERMS:    false
        INDICATEPROGRESS:                false
        INSTANCEID:                      <empty>
        INSTANCENAME:                    <empty>
        QUIET:                           false
        QUIETSIMPLE:                     false
        SQMREPORTING:                    false
        UIMODE:                          Normal
        X86:                             false
    Rules with failures:
    Global rules:
    There are no scenario-specific rules.
    Rules report   file:                 The rule result report file is not available.
    Exception summary:
    The following is an exception stack listing   the exceptions in outermost to innermost order
    Inner exceptions are being indented
    Exception type:   Microsoft.SqlServer.Management.Sdk.Sfc.EnumeratorException
        Message:
            Failed to retrieve data for   this request.
        HResult : 0x80131500
        Data:
          HelpLink.ProdName   = Microsoft SQL Server
            HelpLink.BaseHelpUrl =
    http://go.microsoft.com/fwlink
            HelpLink.LinkId = 20476
            HelpLink.EvtType =
    0xB2652E58@0xDC80C325
          DisableWatson   = true
        Stack:
            at   Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object   connectionInfo, Request request)
            at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.ProcessDTbl(DataTable   dt, Int32 level)
            at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.CollectSqlDiscoveryData(String   machineName)
            at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.CollectDiscoveryData(String   machineName)
            at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.LoadData(IEnumerable`1   machineNames, String discoveryDocRootPath, String   clusterDiscoveryDocRootPath)
            at   Microsoft.SqlServer.Configuration.SetupExtension.RunDiscoveryAction.ExecuteAction(String   actionId)
            at   Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId,   TextWriter errorStream)
            at   Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(TextWriter   statusStream, ISequencedAction actionToRun, ServiceContainer context)
        Inner exception type:   System.ComponentModel.Win32Exception
            Message:
                    Not   all privileges or groups referenced are assigned to the caller.
            HResult : 0x80004005
            Error : 1300
              Stack:
                    at   Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege.SetPrivilege(Boolean   enable)
                      at Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege..ctor(String   privilege)
                      at Microsoft.SqlServer.Configuration.Sco.SqlRegistry.GetLocallyCachedLocalMachineSubKey(ServiceContainer   ctx, String machineName, SqlRegistryKey
    key)
                      at   Microsoft.SqlServer.Discovery.DiscoveryUtils.TryLocallyCacheRegistryKey(ServiceContainer   ctx, String machineName, SqlRegistryKey
    machineKey, String registryPath,   RegistryView regView, String regPath, RegistryAccess registryAccess,   Boolean& alreadyCached)
                      at   Microsoft.SqlServer.Discovery.DiscoveryUtils.GetLocalMachineSubKey(ServiceContainer   ctx, String machineName, RegistryView regView,
    String regPath, RegistryAccess   registryAccess)
                      at   Microsoft.SqlServer.Discovery.DiscoveryEnumObject.GetSql2kMsiInstanceListInHive(String   machineName, RegistryView regView)
                      at Microsoft.SqlServer.Discovery.DiscoveryEnumObject.LoadSql2kInstanceList(String   machineName)
                      at Microsoft.SqlServer.Discovery.Product.GetData(EnumResult erParent)
                      at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData()
                      at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData(Request req,   Object ci)
                      at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object   connectionInfo, Request request)
                      at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object   connectionInfo, Request request)
    And the tail of the detailed log:
    (01) 2014-04-10 11:51:29 Slp: Completed Action:   InitializeMsiExtension, returned True
    (01) 2014-04-10 11:51:30 Slp:   ----------------------------------------------------------------------
    (01) 2014-04-10 11:51:30 Slp: Running Action:   AddPackageModifierSourcesAction
    (01) 2014-04-10 11:51:30 Slp: Completed Action:   AddPackageModifierSourcesAction, returned True
    (01) 2014-04-10 11:51:30 Slp:   ----------------------------------------------------------------------
    (01) 2014-04-10 11:51:30 Slp: Running Action:   InitializeConfigAction
    (01) 2014-04-10 11:51:30 Slp: Completed Action:   InitializeConfigAction, returned True
    (01) 2014-04-10 11:51:30 Slp:   ----------------------------------------------------------------------
    (01) 2014-04-10 11:51:30 Slp: Running Action:   RunRemoteDiscoveryAction
    (01) 2014-04-10 11:51:31 Slp: Running discovery on local   machine
    (01) 2014-04-10 11:51:33 Slp: Discovery on local machine   is complete
    (01) 2014-04-10 11:51:33 Slp: Running discovery on remote   machine: VMSPDB1
    (01) 2014-04-10 11:51:35 Slp: Discovery on VMSPDB1 failed due to exception
    (01) 2014-04-10 11:51:36 Slp:   Microsoft.SqlServer.Management.Sdk.Sfc.EnumeratorException: Failed to   retrieve data for this request. ---> System.ComponentModel.Win32Exception:   Not all privileges or groups referenced are
    assigned to the caller.
      at   Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege.SetPrivilege(Boolean   enable)
       at   Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege..ctor(String   privilege)
       at   Microsoft.SqlServer.Configuration.Sco.SqlRegistry.GetLocallyCachedLocalMachineSubKey(ServiceContainer   ctx, String machineName, SqlRegistryKey key)
       at   Microsoft.SqlServer.Discovery.DiscoveryUtils.TryLocallyCacheRegistryKey(ServiceContainer   ctx, String machineName, SqlRegistryKey machineKey, String registryPath,   RegistryView regView, String regPath, RegistryAccess
    registryAccess,   Boolean& alreadyCached)
       at   Microsoft.SqlServer.Discovery.DiscoveryUtils.GetLocalMachineSubKey(ServiceContainer   ctx, String machineName, RegistryView regView, String regPath, RegistryAccess   registryAccess)
       at   Microsoft.SqlServer.Discovery.DiscoveryEnumObject.GetSql2kMsiInstanceListInHive(String   machineName, RegistryView regView)
       at Microsoft.SqlServer.Discovery.DiscoveryEnumObject.LoadSql2kInstanceList(String   machineName)
       at   Microsoft.SqlServer.Discovery.Product.GetData(EnumResult erParent)
       at   Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData()
       at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData(Request   req, Object ci)
       at   Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object   connectionInfo, Request request)
       at   Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object   connectionInfo, Request request)
       --- End of inner exception stack trace ---
       at   Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object   connectionInfo, Request request)
       at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.ProcessDTbl(DataTable   dt, Int32 level)
       at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.CollectSqlDiscoveryData(String   machineName)
       at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.CollectDiscoveryData(String   machineName)
       at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.LoadData(IEnumerable`1   machineNames, String discoveryDocRootPath, String   clusterDiscoveryDocRootPath)
    (01) 2014-04-10 11:51:36 Slp: Error: Action   "Microsoft.SqlServer.Configuration.SetupExtension.RunDiscoveryAction"   threw an exception during execution.
    (01) 2014-04-10 11:51:36 Slp:   Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: Failed   to retrieve data for this request. --->   Microsoft.SqlServer.Management.Sdk.Sfc.EnumeratorException: Failed to  
    retrieve data for this request. ---> System.ComponentModel.Win32Exception:   Not all privileges or groups referenced are assigned to the caller.
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege.SetPrivilege(Boolean   enable)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege..ctor(String   privilege)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Configuration.Sco.SqlRegistry.GetLocallyCachedLocalMachineSubKey(ServiceContainer   ctx, String machineName, SqlRegistryKey key)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Discovery.DiscoveryUtils.TryLocallyCacheRegistryKey(ServiceContainer   ctx, String machineName, SqlRegistryKey machineKey, String registryPath,   RegistryView
    regView, String regPath, RegistryAccess registryAccess,   Boolean& alreadyCached)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Discovery.DiscoveryUtils.GetLocalMachineSubKey(ServiceContainer   ctx, String machineName, RegistryView regView, String regPath, RegistryAccess   registryAccess)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Discovery.DiscoveryEnumObject.GetSql2kMsiInstanceListInHive(String   machineName, RegistryView regView)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Discovery.DiscoveryEnumObject.LoadSql2kInstanceList(String   machineName)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Discovery.Product.GetData(EnumResult erParent)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData()
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData(Request req,   Object ci)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object   connectionInfo, Request request)
    (01) 2014-04-10 11:51:36 Slp:    at   Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object   connectionInfo, Request request)
    (01) 2014-04-10 11:51:36 Slp:    --- End of   inner exception stack trace ---
    (01) 2014-04-10 11:51:39 Slp: Received request to add the   following file to Watson reporting:   C:\Users\HS2\AppData\Local\Temp\tmp6614.tmp
    (01)   2014-04-10 11:51:39 Slp: The following is an exception stack listing the   exceptions in outermost to innermost order
    (01)   2014-04-10 11:51:39 Slp: Inner exceptions are being indented
    (01)   2014-04-10 11:51:39 Slp:
    (01)   2014-04-10 11:51:39 Slp: Exception type:   Microsoft.SqlServer.Management.Sdk.Sfc.EnumeratorException
    (01)   2014-04-10 11:51:39 Slp:     Message:
    (01)   2014-04-10 11:51:39 Slp:           Failed to retrieve data for this request.
    (01)   2014-04-10 11:51:39 Slp:     HResult : 0x80131500
    (01) 2014-04-10 11:51:39 Slp:       Data:
    (01) 2014-04-10 11:51:39   Slp:       HelpLink.ProdName = Microsoft SQL   Server
    (01) 2014-04-10 11:51:39   Slp:       HelpLink.BaseHelpUrl =
    http://go.microsoft.com/fwlink
    (01) 2014-04-10 11:51:39   Slp:       HelpLink.LinkId = 20476
    (01) 2014-04-10 11:51:39 Slp:       Stack:
    (01) 2014-04-10 11:51:39   Slp:         at   Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object   connectionInfo, Request request)
    (01) 2014-04-10 11:51:39   Slp:         at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.ProcessDTbl(DataTable   dt, Int32 level)
    (01) 2014-04-10 11:51:39   Slp:         at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.CollectSqlDiscoveryData(String   machineName)
    (01) 2014-04-10 11:51:39   Slp:         at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.CollectDiscoveryData(String   machineName)
    (01) 2014-04-10 11:51:39   Slp:         at   Microsoft.SqlServer.Chainer.Infrastructure.SqlDiscoveryDatastoreInterface.LoadData(IEnumerable`1   machineNames, String discoveryDocRootPath,
    String   clusterDiscoveryDocRootPath)
    (01) 2014-04-10 11:51:39   Slp:         at   Microsoft.SqlServer.Configuration.SetupExtension.RunDiscoveryAction.ExecuteAction(String   actionId)
    (01) 2014-04-10 11:51:39   Slp:         at   Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId,   TextWriter errorStream)
    (01) 2014-04-10 11:51:39   Slp:         at   Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(TextWriter   statusStream, ISequencedAction actionToRun, ServiceContainer
    context)
    (01)   2014-04-10 11:51:39 Slp:     Inner exception type:   System.ComponentModel.Win32Exception
    (01)   2014-04-10 11:51:39 Slp:           Message:
    (01)   2014-04-10 11:51:39   Slp:                   Not all privileges or groups referenced are assigned to the caller.
    (01)   2014-04-10 11:51:39   Slp:                  
    (01)   2014-04-10 11:51:39 Slp:           HResult : 0x80004005
    (01)   2014-04-10 11:51:39 Slp:           Error : 1300
    (01) 2014-04-10 11:51:39   Slp:         Stack:
    (01) 2014-04-10 11:51:39   Slp:                   at   Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege.SetPrivilege(Boolean  
    enable)
    (01) 2014-04-10 11:51:39   Slp:                   at Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege..ctor(String   privilege)
    (01) 2014-04-10 11:51:39   Slp:                   at   Microsoft.SqlServer.Configuration.Sco.SqlRegistry.GetLocallyCachedLocalMachineSubKey(ServiceContainer  
    ctx, String machineName, SqlRegistryKey key)
    (01) 2014-04-10 11:51:39   Slp:                   at Microsoft.SqlServer.Discovery.DiscoveryUtils.TryLocallyCacheRegistryKey(ServiceContainer   ctx,
    String machineName, SqlRegistryKey machineKey, String registryPath,   RegistryView regView, String regPath, RegistryAccess registryAccess,   Boolean& alreadyCached)
    (01) 2014-04-10 11:51:39   Slp:                   at   Microsoft.SqlServer.Discovery.DiscoveryUtils.GetLocalMachineSubKey(ServiceContainer  
    ctx, String machineName, RegistryView regView, String regPath, RegistryAccess   registryAccess)
    (01) 2014-04-10 11:51:39   Slp:                   at   Microsoft.SqlServer.Discovery.DiscoveryEnumObject.GetSql2kMsiInstanceListInHive(String  
    machineName, RegistryView regView)
    (01) 2014-04-10 11:51:39   Slp:                   at   Microsoft.SqlServer.Discovery.DiscoveryEnumObject.LoadSql2kInstanceList(String   machineName)
    (01) 2014-04-10 11:51:39   Slp:                   at Microsoft.SqlServer.Discovery.Product.GetData(EnumResult erParent)
    (01) 2014-04-10 11:51:39   Slp:                   at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData()
    (01) 2014-04-10 11:51:39   Slp:                   at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData(Request req,   Object ci)
    (01) 2014-04-10 11:51:39   Slp:                   at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object   connectionInfo, Request request)
    (01) 2014-04-10 11:51:39 Slp:                   at   Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object   connectionInfo, Request request)
    (01) 2014-04-10 11:51:44 Slp: Watson Bucket 2
     Original Parameter Values
    (01) 2014-04-10 11:51:44 Slp: Parameter 0 : SQL Server  
    2012@RTM@KB2931078
    (01) 2014-04-10 11:51:44 Slp: Parameter 1 :   Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process
    (01) 2014-04-10 11:51:44 Slp: Parameter 2 :   Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege.SetPrivilege
    (01) 2014-04-10 11:51:44 Slp: Parameter 3 :
    Microsoft.SqlServer.Management.Sdk.Sfc.EnumeratorException@-2146233088  
    (01) 2014-04-10 11:51:44 Slp: Parameter 4 :
    System.ComponentModel.Win32Exception@-2147467259  
    (01) 2014-04-10 11:51:44 Slp: Parameter 5 :   RunRemoteDiscoveryAction
    (01) 2014-04-10 11:51:44 Slp: Parameter 8 : 1300
    (01) 2014-04-10 11:51:44 Slp:
     Final Parameter Values
    (01) 2014-04-10 11:51:44 Slp: Parameter 0 : SQL Server  
    2012@RTM@KB2931078
    (01) 2014-04-10 11:51:44 Slp: Parameter 1 : 0x6785B09D
    (01) 2014-04-10 11:51:44 Slp: Parameter 2 : 0xB2652E58
    (01) 2014-04-10 11:51:44 Slp: Parameter 3 : 0x74E34741
    (01) 2014-04-10 11:51:44 Slp: Parameter 4 : 0xDC80C325
    (01) 2014-04-10 11:51:44 Slp: Parameter 5 :   RunRemoteDiscoveryAction
    (01) 2014-04-10 11:51:44 Slp: Parameter 8 : 0xA05EFA62
    (01) 2014-04-10 11:51:45 Slp: Sco: Attempting to write   hklm registry key Microsoft SQL Server to file C:\Program Files\Microsoft SQL   Server\110\Setup   Bootstrap\Log\20140410_115053\Registry_SOFTWARE_Microsoft_Microsoft SQL  
    Server.reg_
    (01) 2014-04-10 11:51:45 Slp: The following exception   occurred while preparing registry logs during Watson failure processing: Not   all privileges or groups referenced are assigned to the caller.
    (01) 2014-04-10 11:51:45 Slp: Sco: Attempting to write   hklm registry key Uninstall to file C:\Program Files\Microsoft SQL   Server\110\Setup   Bootstrap\Log\20140410_115053\Registry_SOFTWARE_Microsoft_Windows_CurrentVersion_Uninstall.reg_
    (01) 2014-04-10 11:51:45 Slp: The following exception   occurred while preparing registry logs during Watson failure processing: Not   all privileges or groups referenced are assigned to the caller.
    (01) 2014-04-10 11:51:45 Slp: Sco: Attempting to write   hklm registry key MSSQLServer to file C:\Program Files\Microsoft SQL   Server\110\Setup Bootstrap\Log\20140410_115053\Registry_SOFTWARE_Microsoft_MSSQLServer.reg_
    (01) 2014-04-10 11:51:45 Slp: The following exception   occurred while preparing registry logs during Watson failure processing: Not   all privileges or groups referenced are assigned to the caller.
    (01) 2014-04-10 11:51:45 Slp: Sco: Attempting to write   hklm registry key Microsoft SQL Server to file C:\Program Files\Microsoft SQL   Server\110\Setup   Bootstrap\Log\20140410_115053\Registry_SOFTWARE_Wow6432Node_Microsoft_Microsoft  
    SQL Server.reg_
    (01) 2014-04-10 11:51:45 Slp: The following exception   occurred while preparing registry logs during Watson failure processing: Not   all privileges or groups referenced are assigned to the caller.
    (01) 2014-04-10 11:51:45 Slp: Sco: Attempting to write   hklm registry key Uninstall to file C:\Program Files\Microsoft SQL   Server\110\Setup   Bootstrap\Log\20140410_115053\Registry_SOFTWARE_Wow6432Node_Microsoft_Windows_CurrentVersion_Uninstall.reg_
    (01) 2014-04-10 11:51:45 Slp: The following exception   occurred while preparing registry logs during Watson failure processing: Not   all privileges or groups referenced are assigned to the caller.
    (01) 2014-04-10 11:51:45 Slp: Sco: Attempting to write   hklm registry key MSSQLServer to file C:\Program Files\Microsoft SQL   Server\110\Setup Bootstrap\Log\20140410_115053\Registry_SOFTWARE_Wow6432Node_Microsoft_MSSQLServer.reg_
    (01) 2014-04-10 11:51:45 Slp: The following exception   occurred while preparing registry logs during Watson failure processing: Not   all privileges or groups referenced are assigned to the caller.
    (01) 2014-04-10 11:51:46 Slp: Failed to retrieve data for   this request.
    (01) 2014-04-10 11:51:46 Slp: Watson bucket for exception   based failure has been created
    (01) 2014-04-10 11:51:46 Slp: Sco: Attempting to create   base registry key HKEY_LOCAL_MACHINE, machine
    (01) 2014-04-10 11:51:46 Slp: Sco: Attempting to open   registry subkey Software\Microsoft\Microsoft SQL Server\110
    (01) 2014-04-10 11:51:46 Slp: Sco: Attempting to get   registry value EnableErrorReporting
    (01) 2014-04-10 11:51:46 Slp: WER: Successfully read app   consent from registry Software\Microsoft\Microsoft SQL   Server\110\EnableErrorReporting=0.
    (01) 2014-04-10 11:51:46 Slp: WER: Application level   consent value '0' was mapped to consent status 'WerConsentDenied'
    (01) 2014-04-10 11:51:46 Slp: WER: Result of the   submission:: 'WerDisabled'
    (01) 2014-04-10 11:51:46 Slp: WER: Submitted 1 of 1   failures to the Watson data repository
    (01) 2014-04-10 11:51:46 Slp: Sco: File   'C:\Windows\system32\Cluster.exe' does not exist
    (01) 2014-04-10 11:51:46 Slp: Failed to collect cluster   logs, cannot find Cluster.exe under system directory.
    (01) 2014-04-10 11:51:46 Slp: Dumping final cluster state.
    (01) 2014-04-10 11:51:49 Slp: Completed dumping final   cluster state.
    (01) 2014-04-10 11:51:51 Slp:
    (01) 2014-04-10 11:51:51 Slp:   ----------------------------------------------------------------------
    (01) 2014-04-10 11:51:51 Slp:
    (01)   2014-04-10 11:51:51 Slp: Error result: -2146233088
    (01)   2014-04-10 11:51:51 Slp: Result facility code: 19
    (01)   2014-04-10 11:51:51 Slp: Result error code: 5376
    (01)   2014-04-10 11:51:51 Slp: SQM Service: Sqm does not have active session.

    Hello SQL Ranger,
    Thanks for posting the detailed log. I dont have exact solution for this but I can give you some hint what could be reason patch has failed below message points to fact that there is some issue with account which is used to install CU patch.Have alook at
    below log.It says that when patch was trying to get details from other node in cluster it was not able to.
    01) 2014-04-10 11:51:33 Slp: Discovery on local machine is complete
    (01) 2014-04-10 11:51:33 Slp: Running discovery on remote machine: VMSPDB1
    (01) 2014-04-10 11:51:35 Slp: Discovery on VMSPDB1 failed due to exception
    (01) 2014-04-10 11:51:36 Slp: Microsoft.SqlServer.Management.Sdk.Sfc.EnumeratorException: Failed to retrieve data for this request. ---> System.ComponentModel.Win32Exception: Not all privileges or groups referenced are assigned to the caller.
    IMO I strongly feel it is issue with the account. Microsoft has also documented about this for SQL Server 2008 .Have a look at following links
    http://support.microsoft.com/default.aspx?scid=kb;en-US;2000257
    Please also assign privilege mentioned in below link
    http://www.bradg.co.za/?p=12
    Hope this helps
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Can we create JTable with multiple rows with varying number of columns ?

    Hi All,
    I came across a very typical problem related to JTable. My requirement is that cells should be added dynamically to the JTable. I create a JTable with initial size of 1,7 (row, columns) size. Once the 7 columns are filled with data, a new row should be created. But the requirement is, the new row i.e. second row should have only one cell in it initially. The number of cells should increase dynamically as the data is entered. The table is automatically taking the size of its previous row when new row is added. I tried by using setColumnCount() to change the number of columns to '1' for the second row but the same is getting applied to the first row also.
    So can you please help me out in this regard ? Is it possible to create a JTable of uneven size i.e. multiple rows with varying number of columns in each row ?
    Thanks in Advance.

    Well a JTable is always going to paint the same number of columns for each row. Anything is possible if you want to rewrite the JTable UI to do this, but I wouldn't recommend it. (I certainly don't know how to do it).
    A simpler solution might be to override the isCellEditable(...) method of JTable and prevent editing of column 2 until data in column 1 has been entered etc., etc. You may also want to provide a custom renderer that renderers the empty column differently, maybe with a grey color instead of a white color.

  • Select or deselect multiple rows with one single selection  event

    Does anyone know how to create a JTable which can select or deselect multiple rows with one single selection event in JTable. Fore example, if the table has
    row1
    row2
    row3
    row4
    row5
    row6
    What I need is when user select row1 or row2, both row1 and row2 should be set to be selected. Then if user press CTRL and click one of row3 or row4, both of them should be selected including the previouse selected row1 and row2.
    For deselection, if row1 and row2 are selected, when users deselect one of row1 or row2, both of them should be deselected.
    Hopefully someone can give me a hint.

    Here is a partial solution using a JList. Only one line gets highlighted when the user makes a selection in the list. But, two lines are returned. There is a blank line between every two lines.
         private void addLineToList() {
              String a = f_one.getText();
              String b = f_two.getText();
              if (a.length() == 0) {
                   Utils.showInformationMessage("Item field is empty.");
                   f_one.requestFocusInWindow();
                   return;
              if (b.length() == 0) {
                   Utils.showInformationMessage("Match field is empty.");
                   f_two.requestFocusInWindow();
                   return;
              model.addElement("item: " + a);
              model.addElement("match: " + b);
              model.addElement(" ");
              int size = model.getSize();
              pairList.setSelectedIndex(size - 3);
              f_one.setText("");
              f_two.setText("");
              f_one.requestFocusInWindow();
         private void editList() {
              if (pairList.getSelectedValue().toString().equalsIgnoreCase(" ")) {
                   Toolkit.getDefaultToolkit().beep();
                   f_one.requestFocusInWindow();
                   return;
              if (!f_one.getText().equals("")) {
                   int result = JOptionPane.showConfirmDialog(this,
                   "The Item field contains text. Replace the text?",
                   "Flash Card Activity", JOptionPane.YES_NO_OPTION,
                   OptionPane.INFORMATION_MESSAGE);
                   if (result == JOptionPane.NO_OPTION) return;
              if (!f_two.getText().equals("")) {
                   int result = JOptionPane.showConfirmDialog(this,
                   "The Match field contains text. Replace the text?",
                   "Flash Card Activity", JOptionPane.YES_NO_OPTION,
                   JOptionPane.INFORMATION_MESSAGE);
                   if (result == JOptionPane.NO_OPTION) return;
              String item = "";
              String match = "";
              int index = pairList.getSelectedIndex();
              String choice = model.getElementAt(index).toString();
              if (choice.startsWith("item")) {
                   item = choice;
                   match = model.getElementAt(index + 1).toString();
                   model.remove(index);
                   model.remove(index);
                   model.remove(index);
              else {
                   item = model.getElementAt(index - 1).toString();
                   match = choice;
                   model.remove(index + 1);
                   model.remove(index);
                   model.remove(index - 1);
              int size = model.getSize();
              if (size > 2) {
                   pairList.setSelectedIndex(size - 2);
              f_one.setText(item.substring(6));
              f_two.setText(match.substring(7));
              f_one.requestFocusInWindow();
         }

  • Microsoft SQL Server 2012 Performance Dashboard compatible with windows server 2012?

    Is Microsoft SQL Server 2012 Performance Dashboard compatible with Windows Server 2012? I only see Windows Server 2008r2 as the most recent version in the System Requirements list. Thanks!

    Is Microsoft SQL Server 2012 Performance Dashboard compatible with Windows Server 2012? I only see Windows Server 2008r2 as the most recent version in the System Requirements list. Thanks!
    As per download documents supported windows versions are
    Windows 7, Windows Server 2008 R2, Windows Server 2008 Service Pack 2, Windows Vista Service Pack 2.
    I cannot see any mention of Windows server 2012 in system requirements
    See System Requirements 
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • SQL ENTERPRISE: The edition of Reporting Services that you are using requires that you use local SQL Server relational databases for report data sources and the report server database

    The error below makes absolutely no sense! I'm using Enterprise Core...yet I'm being told I can't use remote data sources:
    w3wp!library!8!03/05/2015-19:08:48:: i INFO: Catalog SQL Server Edition = EnterpriseCore
    w3wp!library!8!03/05/2015-19:08:48:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: , Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: The feature: "The edition of Reporting
    Services that you are using requires that you use local SQL Server relational databases for report data sources and the report server database." is not supported in this edition of Reporting Services.;
    Really? This totally contradicts the documentation found here:
    https://msdn.microsoft.com/en-us/library/ms157285(v=sql.110).aspx
    That article says remote connections are completely supported.
    ARGH! Why does this have to be so difficult to setup?!?

    Hi jeffoliver1000,
    According to your description, you are using Enterprise Core edition and you are prompted that you can’t use remote data sources.
    In your scenario, we neither ignore your point nor be doubt with what you say. But actually we have met the case before that even though the SQL Server engine is Enterprise but the reporting services is still standard. So I would recommend you to find the
    actual edition of reporting services you are using. You can find Reporting Services starting SKU in the Reporting Service logs ( default location: C:\Program Files\Microsoft SQL Server\<instance name>\Reporting Services\LogFiles). For more information,
    please refer to the similar thread below:
    https://social.technet.microsoft.com/Forums/en-US/f98c2f3e-1a30-4993-ab41-acbc5014f92e/data-driven-subscription-button-not-displayed?forum=sqlreportingservices
    By the way, have you installed the other SQL Server edition before?
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • It says that "there was a problem connecting to the server". What's wrong with this, and how can I deal with this problem?

    I just got my new iPad Mini2, and when I choose "sign in with your apple ID", it says that "there was a problem connecting to the server". What's wrong with this, and how can I deal with this problem?

    1. Turn router off for 30 seconds and on again
    2. Settings>General>Reset>Reset Network Settings

  • How can i select some row from multiple row in the same group of data

    I want to select some row from multiple row in the same group of data.
    ColumnA        
    Column B
    1                  OK
    1                   NG
    2                   NG
    2                          NG
    3                          OK
    3                          OK
    I want the row of group of
    ColumnA if  ColumnB contain even 'NG'
    row , select only one row which  Column B = 'NG'
    the result i want = 
    ColumnA         Column B
    1                         NG
    2                   NG
    3                          OK
    Thank you

    That's some awful explanation, but I think this is what you were driving at:
    DECLARE @forumTable TABLE (a INT, b CHAR(2))
    INSERT INTO @forumTable (a, b)
    VALUES
    (1, 'OK'),(1, 'NG'),
    (2, 'NG'),(2, 'NG'),
    (3, 'OK'),(3, 'OK')
    SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
    FROM @forumTable f
    LEFT OUTER JOIN @forumTable f2
    ON f.a = f2.a
    AND f.b <> f2.b
    GROUP BY f.a

  • MOVED: Multiple Displays with AGP and ON-Board

    This topic has been moved to AMD SocketA based board.
    Multiple Displays with AGP and ON-Board

    Glen i just wanted to test try something new.
    I want to know if there are anything i should know about my board?
    Do you think the KM4M-V is a good board to have? 

  • Passing where and group by clause to cursor

    I am working on a procedure that builds a where clause and needs a group by clause to return the correct results. I am trying to pass both the where and group by variables into the cursor.
    The variables are getting populated correctly, but when the cursor gets created, the variables are not in the cursor.
    Here is the code I'm working with. It is a part of a package, but makes no calls to other parts of the package.
    PROCEDURE createFollowUpTask_Exposure( psUppgkedjetyp IN tis.tial.uppgkedjetyp%TYPE default NULL,
    psAlarmtyp IN tis.tial.alarmtyp%TYPE default NULL,
    psSubtyp IN tis.tial.subtyp%TYPE default NULL,
    pnDays IN NUMBER default NULL,
    psKampkod IN tis.tiin.kampkod%TYPE default NULL,
    psKatnr IN tis.tiin.katnr%TYPE default NULL,
    psUtgava IN tis.tiin.utgava%TYPE default NULL,
    psKatslag IN tis.tikg.katslag%TYPE default NULL,
    psProdsyst IN tis.tikg.prodsyst%TYPE default NULL,
    psUppgtyp IN tis.tiin.uppgtyp%TYPE default NULL,
    psProdkod IN tis.tiin.prodkod%TYPE default NULL,
    psStatus IN tis.tiin.status%TYPE default NULL
    ) AS
    cTIAL tis.tial%ROWTYPE;
    vLopnr tis.tial.lopnr%TYPE;
    vSqlWhere VARCHAR2(4000);
    vGroupBy VARCHAR2(1000) := ' tiin.kampkod, tiin.abnr, tiko.fordsalj';
    cSelectCursor SYS_REFCURSOR;
    vSqlSelect VARCHAR2(4000);
    psDays VARCHAR2(50);
    cRec T_TIAL_REC;
    nCount number := 0;
    CURSOR cSqlSelect( SqlWhere IN VARCHAR2, GroupBy IN VARCHAR2) IS
    SELECT tiin.kampkod, tiin.abnr, tiko.fordsalj, MAX(tici.regdat) ALARMDATE
    FROM tis.tiin
    JOIN tis.tiko ON tiin.kampkod = tiko.kampkod AND tiin.abnr = tiko.abnr
    JOIN core.tici ON tiin.kampkod = tici.kampkod AND tiin.abnr = tici.abnr AND tici.inplnr = tiin.inplnr
    WHERE 1=1 || SqlWhere
    GROUP BY GroupBy;
    BEGIN
    -- If these parameters are null, raise error
    IF psUppgkedjetyp IS NULL and psSubtyp IS NULL THEN
    raise_application_error(-20001,
    'Either Event Chain or Starting Event must be assigned');
    END IF;
    -- Populate TIAL values
    IF psUppgkedjetyp IS NOT NULL THEN
    cTIAL.Uppgkedjetyp := psUppgkedjetyp;
    END IF;
    IF psAlarmtyp IS NOT NULL THEN
    cTIAL.Alarmtyp := psAlarmtyp;
    END IF;
    cTIAL.Handklass := 'T';
    cTIAL.Blobid := 0;
    IF pnDays IS NOT NULL THEN
    psDays := '+ '||pnDays;
    END IF;
    IF psSubtyp IS NOT NULL THEN
    cTIAL.Subtyp := psSubtyp;
    END IF;
    -- Create Where clause for cursor
    vSqlWhere := '';
    IF psKampkod IS NOT NULL THEN
    vSqlWhere := vSqlWhere||' AND tiin.kampkod = '''|| psKampkod||'''';
    END IF;
    IF psKatnr IS NOT NULL THEN
    vSqlWhere := vSqlWhere||' AND tiin.katnr = '''||psKatnr||'''';
    END IF;
    IF psUtgava IS NOT NULL THEN
    vSqlWhere := vSqlWhere||' AND tiin.utgava = '''||psUtgava||'''' ;
    END IF;
    IF psKatslag IS NOT NULL THEN
    vSqlWhere := vSqlWhere||' AND tikg.katslag = '''||psKatslag||'''';
    END IF;
    IF psProdsyst IS NOT NULL THEN
    vSqlWhere := vSqlWhere||' AND tikg.prodsyst = '''||psProdsyst||'''';
    END IF;
    IF psUppgtyp IS NOT NULL THEN
    vSqlWhere := vSqlWhere||' AND tiin.uppgtyp = '''||psUppgtyp||'''';
    END IF;
    IF psProdkod IS NOT NULL THEN
    vSqlWhere := vSqlWhere||' AND tiin.prodkod = '''||psProdkod||'''';
    END IF;
    IF psStatus IS NOT NULL THEN
    vSqlWhere := vSqlWhere||' AND tiin.status = '''||psStatus||'''';
    END IF;
    -- Loop through all records meeting input parameters and set required TIAL values.
    FOR i IN cSqlSelect(vSqlWhere, vGroupBy)
    LOOP
    --FETCH cSelectCursor INTO cRec;             
    cTIAL.Kampkod := '';
    cTIAL.Abnr := '';
    cTIAL.Sign := '';
    cTIAL.Alarmdate := '';
    cTIAL.Kampkod := i.Kampkod;
    cTIAL.Abnr := i.Abnr;
    cTIAL.Sign := i.fordsalj;
    cTIAL.Alarmdate := i.alarmdate;
    nCount := nCount + 1;
    IF vLopnr = -1 THEN
    raise_application_error(-20002,
    'Error Creating task for: '||cTIAL.Kampkod||' '||cTIAL.Abnr||' Sales Rep: '||cTIAL.Alarmdate);
    END IF;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('I created '||nCount||' records.');
    END createFollowUpTask_Exposure;
    Thanks in advance for any help.

    Hi,
    Welcome to the forum!
    Try this (not tested) as an example:
    PROCEDURE createFollowUpTask_Exposure(psUppgkedjetyp IN tis.tial.uppgkedjetyp%TYPE DEFAULT NULL,
                                          psAlarmtyp     IN tis.tial.alarmtyp%TYPE DEFAULT NULL,
                                          psSubtyp       IN tis.tial.subtyp%TYPE DEFAULT NULL,
                                          pnDays         IN NUMBER DEFAULT NULL,
                                          psKampkod      IN tis.tiin.kampkod%TYPE DEFAULT NULL,
                                          psKatnr        IN tis.tiin.katnr%TYPE DEFAULT NULL,
                                          psUtgava       IN tis.tiin.utgava%TYPE DEFAULT NULL,
                                          psKatslag      IN tis.tikg.katslag%TYPE DEFAULT NULL,
                                          psProdsyst     IN tis.tikg.prodsyst%TYPE DEFAULT NULL,
                                          psUppgtyp      IN tis.tiin.uppgtyp%TYPE DEFAULT NULL,
                                          psProdkod      IN tis.tiin.prodkod%TYPE DEFAULT NULL,
                                          psStatus       IN tis.tiin.status%TYPE DEFAULT NULL) AS
       cTIAL         tis.tial%ROWTYPE;
       vLopnr        tis.tial.lopnr%TYPE;
       vSqlWhere     VARCHAR2(4000);
       vGroupBy      VARCHAR2(1000) := ' tiin.kampkod, tiin.abnr, tiko.fordsalj';
       cSelectCursor SYS_REFCURSOR;
       vSqlSelect    VARCHAR2(4000);
       psDays        VARCHAR2(50);
       cRec          T_TIAL_REC;
       nCount        NUMBER := 0;
       FUNCTION fnc_cSqlSelect(SqlWhere IN VARCHAR2,
                               GroupBy  IN VARCHAR2) RETURN VARCHAR2 IS
       BEGIN
          RETURN 'SELECT tiin.kampkod,
                 tiin.abnr,
                 tiko.fordsalj,
                 MAX(tici.regdat) ALARMDATE
            FROM tis.tiin
            JOIN tis.tiko ON tiin.kampkod = tiko.kampkod
                         AND tiin.abnr = tiko.abnr
            JOIN core.tici ON tiin.kampkod = tici.kampkod
                          AND tiin.abnr = tici.abnr
                          AND tici.inplnr = tiin.inplnr
           WHERE 1 = 1 ' || SqlWhere || ' GROUP BY ' || GroupBy;
       END fnc_cSqlSelect;
    BEGIN
       -- If these parameters are null, raise error
       IF psUppgkedjetyp IS NULL AND psSubtyp IS NULL THEN
          raise_application_error(-20001,
                                  'Either Event Chain or Starting Event must be assigned');
       END IF;
       -- Populate TIAL values
       IF psUppgkedjetyp IS NOT NULL THEN
          cTIAL.Uppgkedjetyp := psUppgkedjetyp;
       END IF;
       IF psAlarmtyp IS NOT NULL THEN
          cTIAL.Alarmtyp := psAlarmtyp;
       END IF;
       cTIAL.Handklass := 'T';
       cTIAL.Blobid    := 0;
       IF pnDays IS NOT NULL THEN
          psDays := '+ ' || pnDays;
       END IF;
       IF psSubtyp IS NOT NULL THEN
          cTIAL.Subtyp := psSubtyp;
       END IF;
       -- Create Where clause for cursor
       vSqlWhere := '';
       IF psKampkod IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.kampkod = ''' || psKampkod || '''';
       END IF;
       IF psKatnr IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.katnr = ''' || psKatnr || '''';
       END IF;
       IF psUtgava IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.utgava = ''' || psUtgava || '''';
       END IF;
       IF psKatslag IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tikg.katslag = ''' || psKatslag || '''';
       END IF;
       IF psProdsyst IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tikg.prodsyst = ''' || psProdsyst || '''';
       END IF;
       IF psUppgtyp IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.uppgtyp = ''' || psUppgtyp || '''';
       END IF;
       IF psProdkod IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.prodkod = ''' || psProdkod || '''';
       END IF;
       IF psStatus IS NOT NULL THEN
          vSqlWhere := vSqlWhere || ' AND tiin.status = ''' || psStatus || '''';
       END IF;ç
       -- Loop through all records meeting input parameters and set required TIAL values.
       OPEN cSelectCursor FOR fnc_cSqlSelect(vSqlWhere,
                                             vGroupBy);
       LOOP
          FETCH cSelectCursor
             INTO v; -- You must define a variable 'v' to hold the data of cursor
          EXIT WHEN cSelectCursor%NOTFOUND;
          --FETCH cSelectCursor INTO cRec;
          cTIAL.Kampkod   := '';
          cTIAL.Abnr      := '';
          cTIAL.Sign      := '';
          cTIAL.Alarmdate := '';
          cTIAL.Kampkod   := i.Kampkod;
          cTIAL.Abnr      := i.Abnr;
          cTIAL.Sign      := i.fordsalj;
          cTIAL.Alarmdate := i.alarmdate;
          nCount := nCount + 1;
          IF vLopnr = -1 THEN
             raise_application_error(-20002,
                                     'Error Creating task for: ' || cTIAL.Kampkod || ' ' ||
                                     cTIAL.Abnr || ' Sales Rep: ' || cTIAL.Alarmdate);
          END IF;
       END LOOP;
       CLOSE cSelectCursor;
       DBMS_OUTPUT.PUT_LINE('I created ' || nCount || ' records.');
    END createFollowUpTask_Exposure;
    /Regards,

  • Logs are generating with owner and group as 'root'

    Hi,
    In our newly installed and configured Oracle application server(10.1.3.5), the logs are generating with owner and group as 'root'.
    Location: $ORACLE_HOME/Apache/Apache/logs
    -rw-r----- 1 root root 6700 Apr 3 02:03 access_log.1364947200
    -rw-r----- 1 root root 430 Apr 3 02:04 error_log.1364947200
    We have configured it on port 80. For this the '.apachectl' ownership and permissions are changed as below:
    -rwsr-s--- 1 root dba 1703780 Jul 21 2009 .apachectl
    Kindly let me know what are the changes to be made, for the logs to be generated with the group as 'dba' instead of 'root'.
    Thanks.
    Edited by: 985284 on Apr 3, 2013 3:14 AM
    Edited by: 985284 on Apr 3, 2013 4:22 AM

    Ok - that is quit weird then. If you want to run the HTTP Server on a privileged port, you basically change the ownership of the .apachectl executable :
    cd ORACLE_HOME/Apache/Apache/bin
    chown root .apachectl
    chmod 6750 .apachectlas per [url http://docs.oracle.com/cd/B25221_05/core.1013/b25209/ports.htm#CIHJEEJH]documentation.
    Your user and group directive should be set to :
    User oracle
    Group dbaUpon starting, the http server would start as root and then switch the effective userid of the process from root to oracle. In the process list (ps -ef | grep httpd), you should see oracle.
    Do you have the same configuration and what do you see in the process list?

Maybe you are looking for

  • Delete sales order BOM

    Is there any possibility to delete sales order bom if sales order is already deleted (archived) (need to set deletion indicator STKO-LOEKZ to X  ). If sales order exist in the system I use FMs: CSAI_BOM_READ CSAI_BOM_MAINTAIN and it works nice. Is th

  • Airplay only works whenever Apple TV is connected through wired connection

    Hello, I got a Apple TV for christmas, however i can't seem to get it working properly with airplay with my ipad mini or iphone. If i use a wired connection the airplay icon shows up on my ipad and iphone just fine, but if i use the wireless connecti

  • Lost connection to Time Capsule & flashing amber-green-amber

    I was happily watching movies from my TC via my MacBook & then I lost the connection. I switched on and off several times, but to no avail. I've read through the various Q&As and see a common reply is to connect via an ethernet cable & go into 'manua

  • Latest Flash not working at all in 3.6.16 on Mac 10.4; even reinstalled; what can I do?

    No flash is working, not Youtube, games, or the check on Adobe site. (All works fine in Safari) Completely removed *all* files for firefox, mozilla, adobe, flash; and reinstalled both programs. Still nothing works. Installed plugin Shockwave/Director

  • Need help deciding if I should get a Macbook Air?

    I should start off by saying that I currently own a 17" Macbook Pro with i5 2.53 GHz Dual Core Processor, 500GB Harddrive, and 4GB of Ram. I mostly use my macbook to go on the internet a lot, check email, and type up a Pages document and do research