Microsoft SQL Server Metric Collection Errors

Hi
I've installed the Microsoft SQL Server plugin.
I've added a SQL server for monitoring.
It only monitors / picks up Cache Hit Ratio.
Then i'm getting the following Metric Collection Errors:
Database Oct 31, 2006 2:35:45 PM Collection Failure Missing Properties : [pro...
[b]SQL Server Process Oct 31, 2006 2:35:45 PM Collection Failure Missing Properties : [pro...
[b]Processor Oct 31, 2006 2:35:45 PM Collection Failure /u/oracle10/OracleHomes/a...
Error Log Entry Oct 31, 2006 2:31:32 PM Collection Failure Missing Properties : [pro...
[b]MSSQL DatabaseFile Oct 31, 2006 2:31:32 PM Collection Failure Missing Properties : [pro...
[b]SQL Server Role Oct 31, 2006 2:31:32 PM Collection Failure Missing Properties : [pro...
[b]MSSQL Transaction Log Oct 31, 2006 2:31:32 PM Collection Failure Missing Properties : [pro...
[b]Database Parameter Oct 31, 2006 2:29:10 PM Collection Failure Missing Properties : [pro...
User Oct 31, 2006 2:29:10 PM Collection Failure Missing Properties : [pro...
[b]Integrated Security Setting Oct 31, 2006 2:29:10 PM Collection Failure Missing Properties : [pro...
[b]MSSQL FileGroup Oct 31, 2006 2:27:10 PM Collection Failure Missing Properties : [pro...
Login Oct 31, 2006 2:25:14 PM Collection Failure Missing Properties : [pro...
[b]Registry Setting Oct 31, 2006 2:24:21 PM Collection Failure Missing Properties : [pro...
[b]SQL Server Oct 31, 2006 2:24:21 PM Collection Failure Missing Properties : [pro...
[b]Database Setting Oct 31, 2006 2:24:21 PM Collection Failure Missing Properties : [pro...
Target  <servername>.local
Type  Microsoft SQL Server
Metric  Database
Collection Timestamp  Oct 31, 2006 2:35:45 PM
Error Type  Collection Failure
Message  [b]Missing Properties : [provided_host_os]
Thnx,
Kenneth

Not sure if you got the plug-in working. If not, read on...
The error is due to failure in internal computation of the SQL Server Host related information.
Ensure that
1. All pre-requisites (specified in SQL Server plug-in Installation Guide) are satisfied
2. Provided property values for discovery of the SQL Server target are correct
- JDBC URL has correct port number
- If you are using older version of SQL Server plug-in, the name of SQL Server
instance that you provided is correct

Similar Messages

  • Microsoft SQL Server 2014 Setup error: Wait on the Database Engine recovery handle failed

    Hi,
    Having this annoying error trying to install SQL Server 2014 (RTM). I saw it's been asked several times... But each post seems a different cause and no definitive answer...
    I'm not doing an upgrade, so no "sa account" issue.
    Tried different media. Even three different distributions: trial, Standard and Enterprise.
    Tried disabling Microsoft antivirus/firewall.
    Of course tried restarting, updating, installing, uninstalling, repairing, etc., etc.
    I noticed the users folders under C:\Users weren't created. (Maybe something related to permissions?) After playing around, I managed for the users to be created and the service started. Though I couldn't log in.

    Summary for last "repair" attempt:
    Overall summary:
    Final result: Failed: see details below
    Exit code (Decimal): -2068578302
    Start time: 2014-04-27 23:54:21
    End time: 2014-04-27 23:59:48
    Requested action: Repair
    Setup completed with required actions for features.
    Troubleshooting information for those features:
    Next step for SQLEngine: Use the following information to resolve the error, and then try the setup process again.
    Next step for DQ: Use the following information to resolve the error, and then try the setup process again.
    Next step for FullText: Use the following information to resolve the error, and then try the setup process again.
    Next step for LocalDB: Use the following information to resolve the error, and then try the setup process again.
    Machine Properties:
    Machine name: CHARLY13C
    Machine processor count: 4
    OS version: Windows 8
    OS service pack:
    OS region: United States
    OS language: English (United States)
    OS architecture: x64
    Process architecture: 64 Bit
    OS clustered: No
    Product features discovered:
    Product Instance Instance ID Feature Language Edition Version Clustered Configured
    SQL Server 2012 DENALI MSSQL11.DENALI Database Engine Services 1033 Enterprise Edition 11.1.3128.0 No Yes
    SQL Server 2012 LocalDB 1033 Express Edition 11.1.3128.0 No Yes
    SQL Server 2014 HEKATON MSSQL12.HEKATON Database Engine Services 1033 Enterprise Edition 12.0.2000.8 No Yes
    SQL Server 2014 HEKATON MSSQL12.HEKATON Full-Text and Semantic Extractions for Search 1033 Enterprise Edition 12.0.2000.8 No Yes
    SQL Server 2014 HEKATON MSSQL12.HEKATON Data Quality Services 1033 Enterprise Edition 12.0.2000.8 No Yes
    SQL Server 2014 Management Tools - Basic 1033 Enterprise Evaluation Edition 12.0.2000.8 No Yes
    SQL Server 2014 Management Tools - Complete 1033 Enterprise Evaluation Edition 12.0.2000.8 No Yes
    SQL Server 2014 Client Tools Connectivity 1033 Enterprise Evaluation 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: F:\x64\setup\
    Installation edition: Enterprise
    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: C:\Program Files\Microsoft SQL Server\120\Setup Bootstrap\Log\20140427_235420\ConfigurationFile.ini
    CTLRSTARTUPTYPE: 0
    CTLRSVCACCOUNT: <empty>
    CTLRSVCPASSWORD: <empty>
    ENU: true
    FAILOVERCLUSTERGROUP: <empty>
    FAILOVERCLUSTERNETWORKNAME: <empty>
    FTSVCACCOUNT: NT Service\MSSQLFDLauncher$HEKATON
    FTSVCPASSWORD: <empty>
    HELP: false
    IACCEPTSQLSERVERLICENSETERMS: false
    INDICATEPROGRESS: false
    INSTANCENAME: HEKATON
    ISSVCACCOUNT: NT AUTHORITY\Network Service
    ISSVCPASSWORD: <empty>
    ISSVCSTARTUPTYPE: Automatic
    QUIET: false
    QUIETSIMPLE: false
    SQLSVCACCOUNT: NT Service\MSSQL$HEKATON
    SQLSVCPASSWORD: <empty>
    UIMODE: Normal
    X86: false
    Configuration file: C:\Program Files\Microsoft SQL Server\120\Setup Bootstrap\Log\20140427_235420\ConfigurationFile.ini
    Detailed results:
    Feature: Management Tools - Complete
    Status: Passed
    Feature: Client Tools Connectivity
    Status: Passed
    Feature: Management Tools - Basic
    Status: Passed
    Feature: Database Engine Services
    Status: Failed: see logs for details
    Reason for failure: An error occurred during the setup process of the feature.
    Next Step: Use the following information to resolve the error, and then try the setup process again.
    Component name: SQL Server Database Engine Services Instance Features
    Component error code: 0x84B40002
    Error description: The SQL Server feature 'SQL_Engine_Core_Inst' is not in a supported state for repair, as it was never successfully configured. Only features from successful installations can be repaired. To continue, remove the specified SQL Server feature.
    Error help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.2000.8&EvtType=0x2841E06E%401204%402&EvtType=0x2841E06E%401204%402
    Feature: Data Quality Services
    Status: Failed: see logs for details
    Reason for failure: An error occurred for a dependency of the feature causing the setup process for the feature to fail.
    Next Step: Use the following information to resolve the error, and then try the setup process again.
    Component name: SQL Server Database Engine Services Instance Features
    Component error code: 0x84B40002
    Error description: The SQL Server feature 'SQL_Engine_Core_Inst' is not in a supported state for repair, as it was never successfully configured. Only features from successful installations can be repaired. To continue, remove the specified SQL Server feature.
    Error help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.2000.8&EvtType=0x2841E06E%401204%402&EvtType=0x2841E06E%401204%402
    Feature: Full-Text and Semantic Extractions for Search
    Status: Failed: see logs for details
    Reason for failure: An error occurred for a dependency of the feature causing the setup process for the feature to fail.
    Next Step: Use the following information to resolve the error, and then try the setup process again.
    Component name: SQL Server Database Engine Services Instance Features
    Component error code: 0x84B40002
    Error description: The SQL Server feature 'SQL_Engine_Core_Inst' is not in a supported state for repair, as it was never successfully configured. Only features from successful installations can be repaired. To continue, remove the specified SQL Server feature.
    Error help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.2000.8&EvtType=0x2841E06E%401204%402&EvtType=0x2841E06E%401204%402
    Feature: SQL Browser
    Status: Passed
    Feature: SQL Writer
    Status: Passed
    Feature: LocalDB
    Status: Failed: see logs for details
    Reason for failure: An error occurred during the setup process of the feature.
    Next Step: Use the following information to resolve the error, and then try the setup process again.
    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\20140427_235420\SystemConfigurationCheck_Report.htm

  • Problem of Teststand3.1 database and microsoft SQL Server 2000 personal edition

    I have a problem when using teststand database function with Microsoft sql server 2000. the error(seen in attached screenshot3.jpg) is:
    "An error occurred calling 'LogResults' in 'ITSDBLog' of 'DBLog 1.0 Type Library'
    An error occurred executing a statement.
    Schema: Generic Recordset (NI).
    Statement: UUT_RESULT.
    [Microsoft][ODBC SQL Server Driver][SQL Server]unable to insert NULL value to column "ID", table "test.dbo.UUT_RESULT";This column is not alowed to be blank. INSERT Failed. Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
    [Microsoft][ODBC SQL Server Driver][SQL Server]terminated.
    Source: TSDBLog"
     Here I listed my proceess.
    1, Configure in SQL Sever, please see attached screenshot0.jpg
       a, Open SQL
       b, build a new database with the name of test
       c, import the data from "C:\Program Files\National Instruments\TestStand 3.1\Components\NI\Models\TestStandModels\Database\TestStand Results.mdb"
    2, Configure Microsoft SQL sever: please see attached screenshot1.jpg
       a, Open windows Control Panel and select "Data Sources (ODBC). Under system DSN tab, add a SQL server data source
    3, Configure teststand database option, see attached screenshot2.jpg
       a, configure logging option, enable
       b, configure datalink
       c, select schemas of "Generic recordset (NI)
       d, No change on the tabs of "statements" and "Columns/Parameters"
    4, run an seqence file with the proess model of SequentialModel.Seq.
    Attachments:
    Screenshot.zip ‏425 KB

    Thanks Scott,
      The database function is OK now after I changed imported tables in SQL Sever.
      Actually, I once tried anothor method that you refered by using the scripts
    located at: <TestStand>\Components\NI\Models\TestStandModels\Database\SQL Server Create Generic Recordset Result Tables.sql. Attached is the error screenshots, please help me on this.
    Thanks
    Jacky
    Attachments:
    Error.jpg ‏59 KB

  • Metric collection Error MS SQL 2005 Backup

    Hi ,
    become on all "german !!! ' ms sql 2005 Server a collection error for the backup. I have install the newest ms sql plug-in .I have Grid Control 10.2.0.5
    the german error Message is :
    WARN collector: <nmecmc.c> Error exit. Error message: Error Querying:Bei der Konvertierung eines char-Datentyps in einen datetime-Datentyp liegt der datetime-Wert außerhalb des gültigen Bereichs.
    com.microsoft.sqlserver.jdbc.SQLServerException: Bei der Konvertierung eines char-Datentyps in einen datetime-Datentyp liegt der datetime-Wert außerhalb des gültigen Bereichs.
         at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(Unknown Source)
         at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(Unknown Source)
         at oracle.sysman.mpi.jdbc.microsoft_sqlserver_database.SQLServerJDBCQuery.executeQuery(SQLServerJDBCQuery.java:263)
         at oracle.sysman.mpi.jdbc.microsoft_sqlserver_database.SQLServerJDBCQuery.main(SQLServerJDBCQuery.java:1152)
    this mean that he have problems to convert char to datetime . But why ?
    On my English Server i habe no Problems with this collection.
    And NO , i can't only install English MS SQL Server . This is a Company Policy .
    Where the error of the collection ?
    Thx

    and one more:
    Cant find the key : SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Replication\\IsInstalled D:\OracleHomes\agent10g/sysman/admin/scripts/emx/microsoft_sqlserver_database\execmethod_32bit is_remote_login=0 namespace=root\default class=StdRegProv "sSubKeyName=SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Replication" sValueName=IsInstalled method=GetDWORDValue noprint=0 em_result=0 SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Replication IsInstalled

  • [Error] Microsoft SQL Server 2008 Setup. Error reading from file msdbdata.mdf

    Hi all
    I'm trying to install SQL 2008 Express on my Computer: Hp compact DX7300 Slim tower.
    and get this error:
    TITLE: Microsoft SQL Server 2008 Setup
    The following error has occurred:Error reading from file d:\8268cd7b247d294de359c9\x86\setup\sql_engine_core_inst_msi\PFiles\SqlServr\MSSQL.X\MSSQL\Binn\Template\msdbdata.mdf.  Verify that the file exists and that you can access it.
    Click 'Retry' to retry the failed action, or click 'Cancel' to cancel this action and continue setup.
    For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.0.1823.0&EvtType=0xF45F6601%25401201%25401
    Log file
    Overall summary:
      Final result:                  SQL Server installation failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
      Exit code (Decimal):           -2068643839
      Exit facility code:            1203
      Exit error code:               1
      Exit message:                  SQL Server installation failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
      Start time:                    2014-12-09 23:22:03
      End time:                      2014-12-09 23:40:28
      Requested action:              Install
      Log with failure:              C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20141209_232121\sql_engine_core_inst_Cpu32_1.log
      Exception help link:           http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.0.1823.0
    Machine Properties:
      Machine name:                  VISTA-PC
      Machine processor count:       2
      OS version:                    Windows Vista
      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 
    Package properties:
      Description:                   SQL Server Database Services 2008
      SQLProductFamilyCode:          {628F8F38-600E-493D-9946-F4178F20A8A9}
      ProductName:                   SQL2008
      Type:                          RTM
      Version:                       10
      SPLevel:                       0
      Installation location:         d:\8268cd7b247d294de359c9\x86\setup\
      Installation edition:          EXPRESS
    User Input Settings:
      ACTION:                        Install
      ADDCURRENTUSERASSQLADMIN:      False
      AGTSVCACCOUNT:                 NT AUTHORITY\NETWORK SERVICE
      AGTSVCPASSWORD:                *****
      AGTSVCSTARTUPTYPE:             Disabled
      ASBACKUPDIR:                   Backup
      ASCOLLATION:                   Latin1_General_CI_AS
      ASCONFIGDIR:                   Config
      ASDATADIR:                     Data
      ASDOMAINGROUP:                 <empty>
      ASLOGDIR:                      Log
      ASPROVIDERMSOLAP:              1
      ASSVCACCOUNT:                  <empty>
      ASSVCPASSWORD:                 *****
      ASSVCSTARTUPTYPE:              Automatic
      ASSYSADMINACCOUNTS:            <empty>
      ASTEMPDIR:                     Temp
      BROWSERSVCSTARTUPTYPE:         Disabled
      CONFIGURATIONFILE:             C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20141209_232121\ConfigurationFile.ini
      ENABLERANU:                    True
      ERRORREPORTING:                False
      FEATURES:                      SQLENGINE,REPLICATION
      FILESTREAMLEVEL:               0
      FILESTREAMSHARENAME:           <empty>
      FTSVCACCOUNT:                  <empty>
      FTSVCPASSWORD:                 *****
      HELP:                          False
      INDICATEPROGRESS:              False
      INSTALLSHAREDDIR:              C:\Program Files\Microsoft SQL Server\
      INSTALLSHAREDWOWDIR:           C:\Program Files\Microsoft SQL Server\
      INSTALLSQLDATADIR:             <empty>
      INSTANCEDIR:                   C:\Program Files\Microsoft SQL Server\
      INSTANCEID:                    SQLExpress
      INSTANCENAME:                  SQLEXPRESS
      ISSVCACCOUNT:                  NT AUTHORITY\NetworkService
      ISSVCPASSWORD:                 *****
      ISSVCSTARTUPTYPE:              Automatic
      MEDIASOURCE:                   d:\8268cd7b247d294de359c9\
      NPENABLED:                     0
      PID:                           *****
      QUIET:                         False
      QUIETSIMPLE:                   False
      RSINSTALLMODE:                 FilesOnlyMode
      RSSVCACCOUNT:                  <empty>
      RSSVCPASSWORD:                 *****
      RSSVCSTARTUPTYPE:              Automatic
      SAPWD:                         *****
      SECURITYMODE:                  <empty>
      SQLBACKUPDIR:                  <empty>
      SQLCOLLATION:                  SQL_Latin1_General_CP1_CI_AS
      SQLSVCACCOUNT:                 NT AUTHORITY\NETWORK SERVICE
      SQLSVCPASSWORD:                *****
      SQLSVCSTARTUPTYPE:             Automatic
      SQLSYSADMINACCOUNTS:           VISTA-PC\VISTA
      SQLTEMPDBDIR:                  <empty>
      SQLTEMPDBLOGDIR:               <empty>
      SQLUSERDBDIR:                  <empty>
      SQLUSERDBLOGDIR:               <empty>
      SQMREPORTING:                  False
      TCPENABLED:                    0
      X86:                           False
      Configuration file:            C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20141209_232121\ConfigurationFile.ini
    Detailed results:
      Feature:                       Database Engine Services
      Status:                        Failed: see logs for details
      MSI status:                    Passed
      Configuration status:          Passed
      Feature:                       SQL Server Replication
      Status:                        Failed: see logs for details
      MSI status:                    Passed
      Configuration status:          Passed
    Rules with failures:
    Global rules:
    Scenario specific rules:
    Rules report file:               C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20141209_232121\SystemConfigurationCheck_Report.htm
    I will very appriciate if someone can help me solve it. I was trying to set Full control for my account in Properties/Security of root folder and try again but error is still.
    Many thanks

    Hi Foreverduy,
    Before you run SQL Server 2008 express setup, make sure that you have installed Windows installer 4.5 and.NET Framework 3.5 SP1 manually. For more information about the process, please refer to the article:
    http://msdn.microsoft.com/en-us/library/ms143506(v=sql.100).aspx. Moreover, please turn off all the third-party softwares which could prohibit the installation process.
    According to your error message, the issue could be due to that your account has no rights to install SQL Server, or the corruption on the media.
    Firstly, please ensure that your account has admin rights. Also make sure that you right-click the setup.exe and choose “Run as administrator” to complete the installation.
    Secondly, please check if "msdbdata.mdf" file exists at d:\8268cd7b247d294de359c9\x86\setup\sql_engine_core_inst_msi\PFiles\SqlServr\MSSQL.X\MSSQL\Binn\Template. If it exists, please make sure that your account has read permission to the extracted
    folder.
    However, if the file doesn't exist in the extraction, the media could be corrupt. Please download the
    media
    again and check if the issue still occurs.
    Regards,
    Michelle Li

  • Error in query: [Microsoft][SQL Server Native Client 10.0][SQL Server]Must specify table to select from. '' (SWEI)

    Hi All
    below query giving me error in query generator but working well in Sql server.
    error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Must specify table to select from. '' (SWEI)
    Select
    T1.U_grp01 As 'BA',T3.DocDate As 'Posting Date',Month(T3.DocDate) As 'PostMonth',Year(T3.DocDate) As 'PostYear',
    'AR Invoice' As 'Type',T3.DocNum As 'Doc No',T3.CardCode As 'Cust. Code',T3.CardName As 'Cust. Name',T5.SlpName As 'Sale Emp. Name',
    T4.IndustryC As 'Channel Type',T6.CityB As 'BillToCity',T7.Name As 'BillToState',T6.CityS As 'ShipToCity',T8.Name As 'ShipToState',
    T4.U_Une_Zone As 'Zone',
    T2.ItmsGrpNam As 'L1',T0.LineNum As 'Row No',T0.ItemCode As 'ItemCode',T0.Dscription As 'Item Name',t0.whscode,
    T0.Quantity As 'Quantity',T0.StockPrice As 'COGS Price',IsNull(Sum(T0.Quantity * T0.StockPrice),0) As 'COGS Value',T0.VatSum As 'Tax Amount',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then T0.PriceBefDi Else (T0.PriceBefDi * T0.Rate) End) Else T0.Price End) ,0) As 'Sales Price',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then T0.INMPrice Else (T0.INMPrice * T0.Rate) End) Else T0.Price End) ,0) As 'Sales Price',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then Sum(T0.Quantity * T0.INMPrice) Else Sum(T0.Quantity * T0.INMPrice * T0.Rate) End) Else T0.LineTotal End) ,0) As 'Sales Value',t9.linetotal as 'Freight',
    T3.DocType As 'DocType',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE INV4.StaType = -90
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'BED',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE INV4.StaType = -60
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'Cess',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE INV4.StaType = 9
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'HeCess',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE (INV4.StaType = 1 or inv4.staType = 8)
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'VAT',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE INV4.StaType = 8
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'CST'
    From INV1 T0
    Left Join OITM T1 On T1.ItemCode=T0.ItemCode
    Left Join OITB T2 On T2.ItmsGrpCod=T1.ItmsGrpCod
    Left Join OINV T3 On T3.DocEntry=T0.DocEntry
    Left Join OCRD T4 On T4.CardCode=T3.CardCode
    Left Join OSLP T5 On T5.SlpCode=T4.SlpCode
    Left Join INV12 T6 On T6.DocEntry=T0.DocEntry
    Left Join OCST T7 On T7.Code=T6.StateB and T7.Country='IN'
    Left Join OCST T8 On T8.Code=T6.StateS and T8.Country='IN'
    left join inv3 t9 on t9.docentry = t3.docentry
    WHERE T3.[DocDate] >= [%0] and T3.[DocDate] <= [%1] and t3.U_UNE_GCAT = '2'
    Group By T1.U_grp01,T3.DocEntry,T3.DocNum,T3.DocDate,T0.LineNum,T3.CardCode,T3.CardName,T5.SlpName,T4.IndustryC,T4.U_Une_Zone,
    T6.CityB,T7.Name,T6.CityS,T8.Name,T0.VatSum,T0.Currency,T0.Rate,T3.DocType,T0.Price,T0.LineTotal,
    T2.ItmsGrpNam,T0.ItemCode,T0.Dscription,T0.StockPrice,T0.INMPrice,T0.PriceBefDi,T0.Quantity,t9.linetotal,t0.WhsCode
    Union All
    Select
    T1.U_grp01 As 'BA',T3.DocDate As 'Posting Date',Month(T3.DocDate) As 'PostMonth',Year(T3.DocDate) As 'PostYear',
    'AR Invoice' As 'Type',T3.DocNum As 'Doc No',T3.CardCode As 'Cust. Code',T3.CardName As 'Cust. Name',T5.SlpName As 'Sale Emp. Name',
    T4.IndustryC As 'Channel Type',T6.CityB As 'BillToCity',T7.Name As 'BillToState',T6.CityS As 'ShipToCity',T8.Name As 'ShipToState',
    T4.U_Une_Zone As 'Zone',
    T2.ItmsGrpNam As 'L1',T0.LineNum As 'Row No',T0.ItemCode As 'ItemCode',T0.Dscription As 'Item Name',t0.whscode,
    T0.Quantity As 'Quantity',T0.StockPrice As 'COGS Price',IsNull(Sum(T0.Quantity * T0.StockPrice),0) As 'COGS Value',T0.VatSum As 'Tax Amount',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then T0.PriceBefDi Else (T0.PriceBefDi * T0.Rate) End) Else T0.Price End) ,0) As 'Sales Price',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then T0.INMPrice Else (T0.INMPrice * T0.Rate) End) Else T0.Price End) ,0) As 'Sales Price',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then Sum(T0.Quantity * T0.INMPrice) Else Sum(T0.Quantity * T0.INMPrice * T0.Rate) End) Else T0.LineTotal End) ,0) As 'Sales Value',t9.linetotal as 'Freight',
    T3.DocType As 'DocType',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE rin4.StaType = -90
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'BED',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE rin4.StaType = -60
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'Cess',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE rin4.StaType = 9
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'HeCess',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE (rin4.StaType = 1 or rin4.staType = 8)
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'VAT',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE rin4.StaType = 8
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'CST'
    From rin1 T0
    Left Join OITM T1 On T1.ItemCode=T0.ItemCode
    Left Join OITB T2 On T2.ItmsGrpCod=T1.ItmsGrpCod
    Left Join Orin T3 On T3.DocEntry=T0.DocEntry
    Left Join OCRD T4 On T4.CardCode=T3.CardCode
    Left Join OSLP T5 On T5.SlpCode=T4.SlpCode
    Left Join rin12 T6 On T6.DocEntry=T0.DocEntry
    Left Join OCST T7 On T7.Code=T6.StateB and T7.Country='IN'
    Left Join OCST T8 On T8.Code=T6.StateS and T8.Country='IN'
    left join rin3 t9 on t9.docentry = t3.docentry
    WHERE T3.[DocDate] >= [%0] and T3.[DocDate] <= [%1] and t3.U_UNE_GCAT = '2'
    Group By T1.U_grp01,T3.DocEntry,T3.DocNum,T3.DocDate,T0.LineNum,T3.CardCode,T3.CardName,T5.SlpName,T4.IndustryC,T4.U_Une_Zone,
    T6.CityB,T7.Name,T6.CityS,T8.Name,T0.VatSum,T0.Currency,T0.Rate,T3.DocType,T0.Price,T0.LineTotal,
    T2.ItmsGrpNam,T0.ItemCode,T0.Dscription,T0.StockPrice,T0.INMPrice,T0.PriceBefDi,T0.Quantity,t9.linetotal,t0.WhsCode
    Thanks in Advance

    Hi deepak..
    try this
    /* SELECT FROM OSRT P1 */
    DECLARE @FROM AS DATE
    /* WHERE */
    SET @FROM = /* P1.FromDate */ '[%1]'
    /* SELECT FROM OSRT P2 */
    DECLARE @TO AS DATE
    /* WHERE */
    SET @TO = /* P2.ToDate */ '[%2]';
    SELECT T1.U_grp01 AS 'BA',
           T3.DocDate AS 'Posting Date',
           MONTH(T3.DocDate) AS 'PostMonth',
           YEAR(T3.DocDate) AS 'PostYear',
           'AR Invoice' AS 'Type',
           T3.DocNum AS 'Doc No',
           T3.CardCode AS 'Cust. Code',
           T3.CardName AS 'Cust. Name',
           T5.SlpName AS 'Sale Emp. Name',
           T4.IndustryC AS 'Channel Type',
           T6.CityB AS 'BillToCity',
           T7.Name AS 'BillToState',
           T6.CityS AS 'ShipToCity',
           T8.Name AS 'ShipToState',
           T4.U_Une_Zone AS 'Zone',
           T2.ItmsGrpNam AS 'L1',
           T0.LineNum AS 'Row No',
           T0.ItemCode AS 'ItemCode',
           T0.Dscription AS 'Item Name',
           t0.whscode,
           T0.Quantity AS 'Quantity',
           T0.StockPrice AS 'COGS Price',
           ISNULL(SUM(T0.Quantity * T0.StockPrice), 0) AS 'COGS Value',
           T0.VatSum AS 'Tax Amount',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN T0.PriceBefDi
                                      ELSE (T0.PriceBefDi * T0.Rate)
                                 END
                        ELSE T0.Price
                   END
               0
           ) AS 'Sales Price',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN T0.INMPrice
                                      ELSE (T0.INMPrice * T0.Rate)
                                 END
                        ELSE T0.Price
                   END
               0
           ) AS 'Sales Price',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN SUM(T0.Quantity * T0.INMPrice)
                                      ELSE SUM(T0.Quantity * T0.INMPrice * T0.Rate)
                                 END
                        ELSE T0.LineTotal
                   END
               0
           ) AS 'Sales Value',
           t9.linetotal AS 'Freight',
           T3.DocType AS 'DocType',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  INV4.StaType = -90
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'BED',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  INV4.StaType = -60
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'Cess',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  INV4.StaType = 9
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'HeCess',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  (INV4.StaType = 1 OR inv4.staType = 8)
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'VAT',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  INV4.StaType = 8
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'CST'
    FROM   INV1 T0
           LEFT JOIN OITM T1
                ON  T1.ItemCode = T0.ItemCode
           LEFT JOIN OITB T2
                ON  T2.ItmsGrpCod = T1.ItmsGrpCod
           LEFT JOIN OINV T3
                ON  T3.DocEntry = T0.DocEntry
           LEFT JOIN OCRD T4
                ON  T4.CardCode = T3.CardCode
           LEFT JOIN OSLP T5
                ON  T5.SlpCode = T4.SlpCode
           LEFT JOIN INV12 T6
                ON  T6.DocEntry = T0.DocEntry
           LEFT JOIN OCST T7
                ON  T7.Code = T6.StateB
                AND T7.Country = 'IN'
           LEFT JOIN OCST T8
                ON  T8.Code = T6.StateS
                AND T8.Country = 'IN'
           LEFT JOIN inv3 t9
                ON  t9.docentry = t3.docentry
    WHERE  T3.[DocDate] >= @FROM
           AND T3.[DocDate] <= @TO
           AND t3.U_UNE_GCAT = '2'
    GROUP BY
           T1.U_grp01,
           T3.DocEntry,
           T3.DocNum,
           T3.DocDate,
           T0.LineNum,
           T3.CardCode,
           T3.CardName,
           T5.SlpName,
           T4.IndustryC,
           T4.U_Une_Zone,
           T6.CityB,
           T7.Name,
           T6.CityS,
           T8.Name,
           T0.VatSum,
           T0.Currency,
           T0.Rate,
           T3.DocType,
           T0.Price,
           T0.LineTotal,
           T2.ItmsGrpNam,
           T0.ItemCode,
           T0.Dscription,
           T0.StockPrice,
           T0.INMPrice,
           T0.PriceBefDi,
           T0.Quantity,
           t9.linetotal,
           t0.WhsCode
    UNION ALL
    SELECT T1.U_grp01 AS 'BA',
           T3.DocDate AS 'Posting Date',
           MONTH(T3.DocDate) AS 'PostMonth',
           YEAR(T3.DocDate) AS 'PostYear',
           'AR Invoice' AS 'Type',
           T3.DocNum AS 'Doc No',
           T3.CardCode AS 'Cust. Code',
           T3.CardName AS 'Cust. Name',
           T5.SlpName AS 'Sale Emp. Name',
           T4.IndustryC AS 'Channel Type',
           T6.CityB AS 'BillToCity',
           T7.Name AS 'BillToState',
           T6.CityS AS 'ShipToCity',
           T8.Name AS 'ShipToState',
           T4.U_Une_Zone AS 'Zone',
           T2.ItmsGrpNam AS 'L1',
           T0.LineNum AS 'Row No',
           T0.ItemCode AS 'ItemCode',
           T0.Dscription AS 'Item Name',
           t0.whscode,
           T0.Quantity AS 'Quantity',
           T0.StockPrice AS 'COGS Price',
           ISNULL(SUM(T0.Quantity * T0.StockPrice), 0) AS 'COGS Value',
           T0.VatSum AS 'Tax Amount',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN T0.PriceBefDi
                                      ELSE (T0.PriceBefDi * T0.Rate)
                                 END
                        ELSE T0.Price
                   END
               0
           ) AS 'Sales Price',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN T0.INMPrice
                                      ELSE (T0.INMPrice * T0.Rate)
                                 END
                        ELSE T0.Price
                   END
               0
           ) AS 'Sales Price',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN SUM(T0.Quantity * T0.INMPrice)
                                      ELSE SUM(T0.Quantity * T0.INMPrice * T0.Rate)
                                 END
                        ELSE T0.LineTotal
                   END
               0
           ) AS 'Sales Value',
           t9.linetotal AS 'Freight',
           T3.DocType AS 'DocType',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  rin4.StaType = -90
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'BED',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  rin4.StaType = -60
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'Cess',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  rin4.StaType = 9
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'HeCess',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  (rin4.StaType = 1 OR rin4.staType = 8)
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'VAT',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  rin4.StaType = 8
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'CST'
    FROM   rin1 T0
           LEFT JOIN OITM T1
                ON  T1.ItemCode = T0.ItemCode
           LEFT JOIN OITB T2
                ON  T2.ItmsGrpCod = T1.ItmsGrpCod
           LEFT JOIN [dbo].[Orin] T3
                ON  T3.DocEntry = T0.DocEntry
           LEFT JOIN OCRD T4
                ON  T4.CardCode = T3.CardCode
           LEFT JOIN OSLP T5
                ON  T5.SlpCode = T4.SlpCode
           LEFT JOIN rin12 T6
                ON  T6.DocEntry = T0.DocEntry
           LEFT JOIN OCST T7
                ON  T7.Code = T6.StateB
                AND T7.Country = 'IN'
           LEFT JOIN OCST T8
                ON  T8.Code = T6.StateS
                AND T8.Country = 'IN'
           LEFT JOIN rin3 t9
                ON  t9.docentry = t3.docentry
    WHERE  T3.[DocDate] >= @FROM
           AND T3.[DocDate] <= @TO
           AND t3.U_UNE_GCAT = '2'
    GROUP BY
           T1.U_grp01,
           T3.DocEntry,
           T3.DocNum,
           T3.DocDate,
           T0.LineNum,
           T3.CardCode,
           T3.CardName,
           T5.SlpName,
           T4.IndustryC,
           T4.U_Une_Zone,
           T6.CityB,
           T7.Name,
           T6.CityS,
           T8.Name,
           T0.VatSum,
           T0.Currency,
           T0.Rate,
           T3.DocType,
           T0.Price,
           T0.LineTotal,
           T2.ItmsGrpNam,
           T0.ItemCode,
           T0.Dscription,
           T0.StockPrice,
           T0.INMPrice,
           T0.PriceBefDi,
           T0.Quantity,
           t9.linetotal,
           t0.WhsCode
    rgds
    Kennedy

  • Unable to open the physical file "D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\abc.mdf". Operating system error 2: "2(The system cannot find the file specified.)".

    hi,
    am running the below command for moving sql serevr mdf and ldf files  from one  drive to another : c  drive to d drive:
    but am getting the below error
    SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\abc.mdf". Operating system error 2: "2(The system cannot find the file specified.)".
    use master
    DECLARE @DBName nvarchar(50)
    SET @DBName = 'CMP_143'
    DECLARE @RC int
    EXEC @RC = sp_detach_db @DBName
    DECLARE @NewPath nvarchar(1000)
    --SET @NewPath = 'E:\Data\Microsoft SQL Server\Data\';
    SET @NewPath = 'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\';
    DECLARE @OldPath nvarchar(1000)
    SET @OldPath = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\';
    DECLARE @DBFileName nvarchar(100)
    SET @DBFileName = @DBName + '.mdf';
    DECLARE @LogFileName nvarchar(100)
    SET @LogFileName = @DBName + '_log.ldf';
    DECLARE @SRCData nvarchar(1000)
    SET @SRCData = @OldPath + @DBFileName;
    DECLARE @SRCLog nvarchar(1000)
    SET @SRCLog = @OldPath + @LogFileName;
    DECLARE @DESTData nvarchar(1000)
    SET @DESTData = @NewPath + @DBFileName;
    DECLARE @DESTLog nvarchar(1000)
    SET @DESTLog = @NewPath + @LogFileName;
    DECLARE @FILEPATH nvarchar(1000);
    DECLARE @LOGPATH nvarchar(1000);
    SET @FILEPATH = N'xcopy /Y "' + @SRCData + N'" "' + @NewPath + '"';
    SET @LOGPATH = N'xcopy /Y "' + @SRCLog + N'" "' + @NewPath + '"';
    exec xp_cmdshell @FILEPATH;
    exec xp_cmdshell @LOGPATH;
    EXEC @RC = sp_attach_db @DBName, @DESTData, @DESTLog
    go
    can anyone pls help how to set the db offline. currently  i  stopped the sql server services from services.msc and started the  sql server agent.
    should i stop both services for moving from one drive to another?
    note: I tried teh below solution but this didint work:
    ALTER DATABASE <DBName> SET OFFLINE WITH ROLLBACK IMMEDIATE
    Update:
    now am getting the message :
    Msg 15010, Level 16, State 1, Procedure sp_detach_db, Line 40
    The database 'CMP_143' does not exist. Supply a valid database name. To see available databases, use sys.databases.
    (3 row(s) affected)
    (3 row(s) affected)
    Msg 5120, Level 16, State 101, Line 1
    Unable to open the physical file "D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\CMP_143.mdf". Operating system error 2: "2(The system cannot find the file specified.)".

    First you should have checked the database mdf/ldf name and location by using the command
    Use CMP_143
    Go
    Sp_helpfile
    Looks like your database CMP_143 was successfully detached but mdf/ldf location or name was different that is why it did not get copied to target location.
    Database is already detached that’s why db offline failed
    Msg 15010, Level 16, State 1, Procedure sp_detach_db, Line 40
    The database 'CMP_143' does not exist. Supply a valid database name. To see available databases, use sys.databases.
    EXEC @RC = sp_attach_db @DBName, @DESTData, @DESTLog
    Attached step is failing as there is no mdf file
    Msg 5120, Level 16, State 101, Line 1
    Unable to open the physical file "D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\CMP_143.mdf". Operating system error 2: "2(The system cannot find the file specified.)"
    Solution:
    Search for the physical files(mdf/ldf) in the OS and copy to target location and the re-run sp_attach_db with right location and name of mdf/ldf.

  • SharePoint 2010 with SQL Reporting Services 2012 "Installation Error: Could not find SOFTWARE\Microsoft\Microsoft SQL Server\110 registry key"

    i have a small sharepoint farm "2 servers" (WFE) and SQL Server 2012 ,
    i installed rsSharePoint for reporting services , as a read the Reporting services is Application Service  with SQL 2012 not as SQL 2008 R2 with SharePoint integrated mode, so after installation when am trying to configure the  SQL Server
    Reporting Services Application services i got the below error :
    "Installation Error: Could not find SOFTWARE\Microsoft\Microsoft SQL Server\110 registry key"
    any kind of help would be much appreciated .

    I'm having the same issue, but to me it seems like the instructions I've seen are all over the place.  I already have SP 2013 and SQL 2012 SP 1 installed.  I already added the features for Reporting Services - Sharepoint and Reporting Services
    Add-in for SharePoint Products.  I didn't see the Reporting Service service in CA, so I ran the powershell scripts to add SPRSService and SPRSServiceProxy. 
    My initial quest, was to get the BI features enabled, which took me on the journey of adding the Report Services, then I got the error.
    Then when I read this about installing the BI features
    http://blogs.msdn.com/b/querysimon/archive/2012/11/26/installing-the-bi-features-of-sharepoint-2013.aspx, which I already had SQL and SP installed.  Do I have to rerun and selct the SQL Server PowerPoint for SharePoint option?  I have the PowerPoint
    Configuration Tool on my SQL server, I run it and I get PowerPivot for SP 2013 Configuranoi is missing prerequisits:  SP 2013 EE is required.  Which I have EE.
    Is Reporting Services different or in addition to the BI Feature (PowerPivot)? 
    Have I missed a step?
    Thanks for you help.
    Kim
    Kim.Williams

  • SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)

    SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)
    SELECT    
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO AS T0 LEFT OUTER JOIN
                          VPM2 AS T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
         OVPM AS T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1 AS T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate>='[%0]' and T0.DocDate<='[%1]'

    Hi,
    Try this:
    SELECT   
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO  T0 LEFT OUTER JOIN
                          VPM2  T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry
    LEFT OUTER JOIN
         OVPM  T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1  T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate >= '[%0]' and T0.DocDate <='[%1]'
    group by T0.DocStatus,T0.DocDate ,
    T0.DocNum ,
    T0.NumAtCard,
    T0.TransId ,
    T0.Comments ,
    T0.CardCode,
    T0.CardName ,
    T0.WTSum ,
    T3.DueDate ,
    T3.CheckSum
    Thanks & Regards,
    Nagarajan

  • VMware SQL 2008R2 bcp error - SQLState = 08001, NativeError = 0 Error = [Microsoft][SQL Server Client 10.0] Client unable to establish connection due to prelogin failure

    Can someone help me resolve this error?   Thanks  
    Windows Server 2008 R2  Standard SP1 64-bit -  SQL Server 2008R2 Standard 64-bit 
    VMware vCenter Server Version 5.1.0
    SQLState = 08001, NativeError = 0
    Error = [Microsoft][SQL Server Native Client 10.0]Client unable to establish connection due to prelogin failure
    bcp program: 
    bcp SYM.dbo.ACCOUNT in "D:\Data\SQLExtract\EXTRACT.ACCOUNT" -f"D:\Data\SQLCommands\FMT.ACCOUNT" -S DEV-DATA\TEST\ -T -oSYMLOAD.LOG Type SYMLOAD.LOG >> SYMLOAD.LOG.CUMULATIVE
    The bcp program executes successfully on a local instance of SQL Server.

    The error has nothing to do with BCP as such, but it is a connection problem. That is, for some reason you cannot connect to your instance from the VM. I would exect that you face a similar problem if you tried SSMS.
    It could be a firewall issue, but prelogin suggests that you reach the instance. But possibly you don't come far enough for the login failure to be recorded. Possibly the instance is not configured to audit login failures.
    The message you would see would be similar to
    2010-08-18 14:11:30.91 Logon       Error: 17809, Severity: 20, State: 3
    Possibly followed by a a line that details the message. The error number may be different.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Error Message from Microsoft SQL Server Management Studio

    I have problem editing the views that I created.  I never have this problem before and I don't know if
    I have touched something on the pane that alters my viewing on Microsoft SQL Server Management Studio.  For example, if I want to edit the top 200 rows of my view called dbo.sl_admission_reg9, it will give me this error:
    Invalid prefix of suffix characters (MS Viual Database Tools).
    Please help.
    Thank you very much.
    Sally

    Are you trying to edit the top 200 rows of a SQL Server 2012 database using the 2008 R2 SQL Server Management
    Stud? If so you just need to upgrade SQL Server Management Studio to 2012 or edit the rows using a SQL query.
    [Personal Site] [Blog] [Facebook]

  • Java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Unspecified error

    Hi All,
    I am getting the following error when i am running swing program. I have a large volume of data. My resultset is running upto 2 hours. after 2 hours process is stoped and i got the following error on console.I am using Swing and MS SQL Server 2000.
    Exception :java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Unspecified error occurred on SQL Server. Connection may have been terminated by the server.
    Exception :java.sql.SQLException: General error
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'F'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:464)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:169)
    Exception :java.sql.SQLException: General error
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:469)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:169)
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'F'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'F'
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:474)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:169)
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'T'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:419)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:424)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'T'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    java.lang.Exception: Invalid handle [null] Database error code:0
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'T'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:429)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:434)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'F'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closedjava.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:439)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'F'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:444)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'F'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'T'
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:449)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'T'
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:454)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'T'
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:459)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'T' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'F'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:464)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:469)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'F'
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 4 : select count(*) from tblTransaction where AuditID = 10001720 and     ExcludedFromAudit = 'F' and     SystemPricedFare = 'F'
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.batchTransactions(GenerateAuditBatches.java:966)
         at com.select.auditlink.GenerateAuditBatches.batchAudit(GenerateAuditBatches.java:474)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:172)
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    GenerateAuditBatches.java sql 5 transactions : select tblTransaction.BatchID,          tblTransaction.TransactionNumber,          tblTransaction.PrimeDocumentNumber,          tblTransaction.AgentIATACode,          tblTransaction.NetRemitInd,          tblTransaction.ITBTFare,          tblTransaction.TourCode,          tblTransaction.FareBasis,          tblTransaction.TransactionCode,          tblTransaction.TransactionCategory,          tblTransaction.InternationalOrDomestic,          tblTransaction.NumberOfSectors,          tblTransaction.TransactionStatus,          tblTransaction.TransactionStatusUserID,          tblTransactionCRSCheck.FareCorrect,          tblTransactionCRSCheck.TaxCorrect,          tblTransactionCRSCheck.CommissionCorrect,          tblTransactionCRSCheck.ContractRulesCorrect,          tblTransactionCRSCheck.ContractID from tblTransaction left join tblTransactionCRSCheck on     tblTransactionCRSCheck.AuditID = tblTransaction.AuditID and     tblTransactionCRSCheck.TransactionNumber = tblTransaction.TransactionNumber where tblTransaction.AuditID = 10001720 and     tblTransaction.ExcludedFromAudit = 'F' and     tblTransaction.SystemPricedFare = 'F' order by tblTransaction.FareBasis
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 1 : update tblAudit set     NumberOfBatches = 1078 where AuditID = 10001720
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 12 query2 : select BatchID from     tblAuditBatch where AuditID = 10001720
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.lang.Exception: Invalid handle [null] Database error code:0
    java.lang.Exception: Invalid handle [null] Database error code:0
         at com.select.auditlink.GenerateAuditBatches.updateAuditBatches(GenerateAuditBatches.java:1427)
         at com.select.auditlink.GenerateAuditBatches.run(GenerateAuditBatches.java:217)
    GenerateAuditBatches.java sql 2 : update tblAudit set     NumberOfAuditedBatches = (     select     count(*)     from     tblAuditBatch     where     AuditID = 10001720     and          NumberOfAuditedTransactions = NumberOfTransactions) where     AuditID = 10001720
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    GenerateAuditBatches.java sql 3 : update tblAudit set     NumberOfAuditedTransactions = (     select     count(*)     from     tblTransaction     where     AuditID = 10001720     and          Audited = 'T') where     AuditID = 10001720
    Exception :java.sql.SQLException: Invalid handle
    Exception :java.sql.SQLException: Connection is closed
    Exception :java.sql.SQLException: Connection is closed
    Please give me suitable solution of this issue.
    Thanks
    Rajnish
    Message was edited by:
    rajnishsunjava

    java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]File must be opened exclusively.
    In the Visual Foxpro table, I saw no READ ONLY settings.And also, there are
    no delete permission grants and there is no user database sesssion concept.
    The ODBC DSN for MYTABLE is setup as:
    - Free Tables (not database)
    - Null (checked)
    - Deleted (checked)If you're using Visual Foxpro database(.DBC), you should see "Exclusive" option too. You can try check it, but I don't know whether your issue will disappear.

  • Error: [Microsoft][ODBC SQL Server Driver]Protocol error in TDS stream

    hello,
    our application vendors are receving the below errors while running their data load job.I spoke to our networking team member and he said everything looks good on the networking side .Can someone please help me with the below errors.we are using
    Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64) Enterprise
    Edition: Core-based Licensing (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1).
    Windows OS:windows server 2008 R2 sp1
    7280
    6920
     DBS-070401
    6/5/2014 1:17:24 PM
    |Data flow DIM_CONTRACT_SWAM_INIT_LOAD_DF|Loader Key_Generation_DIM_CONTRACT
    7280
    6920
     DBS-070401
    6/5/2014 1:17:24 PM
    ODBC data source <HPWDBOE001> error message for operation <SQLExecute>: <[Microsoft][ODBC SQL Server
    7280
    6920
     DBS-070401
    6/5/2014 1:17:24 PM
    Driver][DBNETLIB]ConnectionWrite (send()).
    7280
    6920
     DBS-070401
    6/5/2014 1:17:24 PM
    [Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.>.
    6760
    6164
     DBS-070401
    6/5/2014 1:17:24 PM
    |Data flow DIM_EMPLOYER_GROUP_SWAM_INIT_LOAD_DF|Reader TCRdr_9
    6760
    6164
     DBS-070401
    6/5/2014 1:17:24 PM
    ODBC data source <serverName> error message for operation <SQLExecute>: <[Microsoft][ODBC SQL Server Driver]Protocol error in
    6760
    6164
     DBS-070401
    6/5/2014 1:17:24 PM
    TDS stream
    6760
    6164
     DBS-070401
    6/5/2014 1:17:24 PM
    [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (recv()).
    6760
    6164
     DBS-070401
    6/5/2014 1:17:24 PM
    [Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.>.
    I googled and found the below link the below link which asked me to enable named pipes.I enabled
    namped pipes in the sql server Network configuration.I havent yet restarted the sql services as this is a prod box.I will do it later in the evening today.
     http://social.msdn.microsoft.com/Forums/sqlserver/en-US/69149a71-3c15-4c95-9f95-a30db458abeb/sql-server-2005-communcations-errors-through-odbc?forum=sqldataaccess 
    Can someone help me with these errors.
    Thanks
    lucky

    Thank you Erland.
    I dont see any crash dumps in sql server.I checked the tcp chimney and its set to automatic.I am not knowing what to look at to resolve this issue.
    if its the issue with the client API can i ask our vendor to check the client? 
    Our networking member gave the following report:
    No problems on vlan 14 or your port   the top is from the switch to your server then bottom is from my pc to your server
    SP_DC_CORE_VSS# ping 10.10.12.228
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 10.10.12.228, timeout is 2 seconds:
    Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
    SP_DC_CORE_VSS#
    lucky

  • The SELECT permissions was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'.(Microsoft SQL Server, Error:229

    I have a SQL Server connected intro a Windows Server 2003 Domain Active Directory, the server holds a default instance with a single Database, the SQL Server is 2005 Std Edition, and is using mix mode Authentification, then I able to create SQL Native Users
    and Invoque Windows Domain Users also.
    The Goal of this project is remove the sysadmin Server role for all the Windows Domain Users, to give then a more granular secure model but at the moment is this only way to connect at the Data Base Server.
    I already create Native SQL Servers users without any problem!, they respect Securable Setting, Server Roles, User Mapping, everything...Just when I create a Login Profile form a Domain Users and apply the same setting, I get this error...
    The SELECT permissions was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'.(Microsoft SQL Server, Error:229)
    But if the user have sysadmin Server Rol he can sing over the server without any issue, I review the .sys view extended_properties and "Public" is the only Database Role placed.
    Any Idea if I need change any Setting in the Secure in SQL Master DataBase? or which is the issue witjh this matter?
    Thank in advance for your help!

    Since there are so many possibilities for what might be wrong.  Here's another possibility to look at.  I ran into something where I had set up my own roles on a database.  (For instance, "Administrator", "Manager", "DataEntry",
    "Customer", each with their own kinds of limitations)  The only ones who could use it were "Manager" role or above--because they were also set up as sysadmin because they were adding users to the database (and they were highly trusted). 
    Also, the users that were being added were Windows Domain users--using their domain credentials.  (Everyone with access to the database had to be on our domain, but not everyone on the domain had access to the database--and only a few of them had access
    to change it.)
    Anyway, this working system suddenly stopped working and I was getting error messages similar to the above.  What I ended up doing that solved it was to go through all the permissions for the "public" role in that database and add those permissions
    to all of the roles that I had created.  I know that everyone is supposed to be in the "public" role even though you can't add them (or rather, you can "add" them, but they won't "stay added").
    So, in "SQL Server Management Studio", I went into my application's database, in other words (my localized names are obscured within <> brackets): "<Computername> (SQL Server <version> - sa)"\Databases\<MyAppDB>\Security\Roles\Database
    Roles\public".  Right-click on "public" and select "Properties".  In the "Database Role Properties - public" dialog, select the "Securables" page.  Go through the list and for each element in the
    list, come up with an SQL "Grant" statement to grant exactly that permission to another role.  So, for instance, there is a scalar function "[dbo].[fn_diagramobjects]" on which the "public" role has "Execute" privilege. 
    So, I added the following line:   
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @RoleName + '];' )
    Once I had done this for all the elements in the "Securables" list, I wrapped that up in a while loop on a cursor selecting through all the roles in my roles table.  This explicitly granted all the permissions of the "public" role to
    my database roles.  At that point, all my users were working again (even after I removed their "sysadmin" access--done as a temporary measure while I figured out what happened.)
    I'm sure there's a better (more elegant) way to do this by doing some kind of a query on the database objects and selecting on the public role, but after about half and hour of investigating, I wasn't figuring it out, so I just did it the brute-force method. 
    In case it helps someone else, here's my code.
    CREATE PROCEDURE [dbo].[GrantAccess]
    AS
    DECLARE @AppRoleName AS sysname
    DECLARE AppRoleCursor CURSOR LOCAL SCROLL_LOCKS FOR
    SELECT AppRoleName FROM [dbo].[RoleList];
    OPEN AppRoleCursor
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    WHILE @@FETCH_STATUS = 0
    BEGIN
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_alterdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_creatediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_dropdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagramdefinition] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagrams] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_renamediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[allocation_units] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assemblies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_references] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[asymmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[certificates] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[change_tracking_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[check_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[computed_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_endpoints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_priorities] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[crypt_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specification_details] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_permissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principal_aliases] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principals] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_role_members] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[default_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[destination_data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[event_notifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[filegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_key_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_catalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_catalog_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_fragments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stoplists] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stopwords] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[function_order_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[identity_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[internal_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_encryptions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[message_type_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[module_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedure_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_functions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_range_values] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_schemes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partitions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[plan_guides] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[remote_service_bindings] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[routes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[schemas] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_message_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contracts] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_message_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queue_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queues] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[services] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_index_tessellations] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_dependencies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[symmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[synonyms] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscolumns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscomments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysconstraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysdepends] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfilegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfiles] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysforeignkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfulltextcatalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysmembers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syspermissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysprotects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysreferences] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[systypes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysusers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[table_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[transmission_queue] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[trigger_events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[triggers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[type_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_attributes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_collections] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_component_placements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_components] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_elements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_facets] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_model_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcard_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcards] TO [' + @AppRoleName + '];' )
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    END
    CLOSE AppRoleCursor
    RETURN 0
    GO
    Once that is in the system, I just needed to "Exec GrantAccess" to make it work.  (Of course, I have a table [RoleList] which contains a "AppRoleName" field that contains the names of the database roles.)
    So, the mystery remains: why did all my users lose their "public" role and why could I not give it back to them?  Was this part of an update to SQL Server 2008 R2?  Was it because I ran another script to delete each user and add them back
    so to refresh their connection with the domain?  Well, this solves the issue for now.
    One last warning: you probably should check the "public" role on your system before running this to make sure there isn't something missing or wrong, here.  It's always possible something is different about your system.
    Hope this helps someone else.

  • The SELECT permission was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)

    I have created a user and given him the owner rights for the database.  Though I can LogIn as the user, I cannot access the databases.  I am having the error mesage:
    Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
    For help, click:
    http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    The SELECT permission was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)
    For help, click:
    http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600&EvtSrc=MSSQLServer&EvtID=229&LinkId=20476
    Sha_woop

    Since there are so many possibilities for what might be wrong.  Here's another possibility to look at.  I ran into something where I had set up my own roles on a database.  (For instance, "Administrator", "Manager", "DataEntry", "Customer",
    each with their own kinds of limitations)  The only ones who could use it were "Manager" role or above--because they were also set up as sysadmin because they were adding users to the database (and they were highly trusted).  Also, the users that
    were being added were Windows Domain users--using their domain credentials.  (Everyone with access to the database had to be on our domain, but not everyone on the domain had access to the database--and only a few of them had access to change it.)
    Anyway, this working system suddenly stopped working and I was getting error messages similar to the above.  What I ended up doing that solved it was to go through all the permissions for the "public" role in that database and add those permissions to
    all of the roles that I had created.  I know that everyone is supposed to be in the "public" role even though you can't add them (or rather, you can "add" them, but they won't "stay added").
    So, in "SQL Server Management Studio", I went into my application's database, in other words (my localized names are obscured within <> brackets): "<Computername> (SQL Server <version> - sa)"\Databases\<MyAppDB>\Security\Roles\Database
    Roles\public".  Right-click on "public" and select "Properties".  In the "Database Role Properties - public" dialog, select the "Securables" page.  Go through the list and for each element in the list, come up with an SQL "Grant" statement to
    grant exactly that permission to another role.  So, for instance, there is a scalar function "[dbo].[fn_diagramobjects]" on which the "public" role has "Execute" privilege.  So, I added the following line:
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @RoleName + '];' )
    Once I had done this for all the elements in the "Securables" list, I wrapped that up in a while loop on a cursor selecting through all the roles in my roles table.  This explicitly granted all the permissions of the "public" role to my database roles. 
    At that point, all my users were working again (even after I removed their "sysadmin" access--done as a temporary measure while I figured out what happened.)
    I'm sure there's a better (more elegant) way to do this by doing some kind of a query on the database objects and selecting on the public role, but after about half and hour of investigating, I wasn't figuring it out, so I just did it the brute-force method. 
    In case it helps someone else, here's my code.
    CREATE PROCEDURE [dbo].[GrantAccess]
    AS
    DECLARE @AppRoleName AS sysname
    DECLARE AppRoleCursor CURSOR LOCAL SCROLL_LOCKS FOR
    SELECT AppRoleName FROM [dbo].[RoleList];
    OPEN AppRoleCursor
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    WHILE @@FETCH_STATUS = 0
    BEGIN
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_alterdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_creatediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_dropdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagramdefinition] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagrams] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_renamediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[allocation_units] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assemblies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_references] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[asymmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[certificates] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[change_tracking_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[check_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[computed_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_endpoints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_priorities] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[crypt_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specification_details] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_permissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principal_aliases] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principals] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_role_members] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[default_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[destination_data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[event_notifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[filegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_key_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_catalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_catalog_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_fragments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stoplists] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stopwords] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[function_order_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[identity_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[internal_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_encryptions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[message_type_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[module_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedure_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_functions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_range_values] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_schemes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partitions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[plan_guides] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[remote_service_bindings] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[routes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[schemas] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_message_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contracts] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_message_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queue_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queues] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[services] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_index_tessellations] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_dependencies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[symmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[synonyms] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscolumns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscomments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysconstraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysdepends] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfilegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfiles] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysforeignkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfulltextcatalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysmembers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syspermissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysprotects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysreferences] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[systypes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysusers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[table_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[transmission_queue] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[trigger_events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[triggers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[type_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_attributes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_collections] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_component_placements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_components] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_elements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_facets] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_model_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcard_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcards] TO [' + @AppRoleName + '];' )
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    END
    CLOSE AppRoleCursor
    RETURN 0
    GO
    Once that is in the system, I just needed to "Exec GrantAccess" to make it work.  (Of course, I have a table [RoleList] which contains a "AppRoleName" field that contains the names of the database roles.)
    So, the mystery remains: why did all my users lose their "public" role and why could I not give it back to them?  Was this part of an update to SQL Server 2008 R2?  Was it because I ran another script to delete each user and add them back so to refresh
    their connection with the domain?  Well, this solves the issue for now.
    One last warning: you probably should check the "public" role on your system before running this to make sure there isn't something missing or wrong, here.  It's always possible something is different about your system.
    Hope this helps someone else.

Maybe you are looking for

  • Why I was about to quit ... and why I didn't

    Hi all, I have been using Arch for 8 months now. I recently no more felt has enthusiastic has I was before, for mainly two reasons : - Some updates broke some functionalities. - I felt like other distro's Gnome packaging was more eye candy than Arch'

  • How can I change the name of my ipod touch?

    I want to change the name of my ipod touch so that it shows up in itunes as a different name than it currently does. How do I do this or is it not possible?

  • How do you recover a book from iPhoto after it crashed

    After working on a book every night for 6 months iPhoto suddenly told me today that the theme was no longer available and to change to another and the pictures would transfer and I could continue. I duplicated the book then did as instructed. Both bo

  • Bringing mitigating controls from PC to AC in GRC 10.0

    Hi , I am going through remediation process in GRC 10.0, However there are no mitigation controls setup in AC. my client is asking me to copy all the mitigating controls from PC to AC. Is this possible ? if yes, What will be the process ? Thank you.

  • Including iPhoto's in a Word document

    I have a couple of pictures in iPhoto 5.0.4 (263) which I would like to include in a Word X (Service Release 1) document. I've tried Insert > Picture > From file ... but o no avail. I've tried both from my iPhotos in my User > Pictures > etc folder a