Usage of NOT in SQL

Hello, will like to know whether there are any diff between the placement of NOT as both generate the same result for me.
SELECT *
FROM user_list
WHERE m_status NOT IN ('S', 'D')
SELECT *
FROM user_list
WHERE NOT m_status IN ('S', 'D')
Which should be the correct one??

Agree...
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> SET AUTOTRACE TRACEONLY EXPLAIN;
SQL> SELECT COUNT (*)
  2  FROM   emp e
  3  WHERE  e.job NOT IN ('SALESMAN', 'MANAGER');
Execution Plan
Plan hash value: 2083865914
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT   |      |     1 |     8 |     3   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE    |      |     1 |     8 |            |          |
|*  2 |   TABLE ACCESS FULL| EMP  |     9 |    72 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - filter("E"."JOB"<>'SALESMAN' AND "E"."JOB"<>'MANAGER')
SQL> SELECT COUNT (*)
  2  FROM   emp e
  3  WHERE  NOT e.job IN ('SALESMAN', 'MANAGER');
Execution Plan
Plan hash value: 2083865914
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT   |      |     1 |     8 |     3   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE    |      |     1 |     8 |            |          |
|*  2 |   TABLE ACCESS FULL| EMP  |     9 |    72 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - filter("E"."JOB"<>'SALESMAN' AND "E"."JOB"<>'MANAGER')
SQL>

Similar Messages

  • How can we find the most usage and lowest usage of table in Sql Server by T-SQL

    how can we find the most usage and lowest usage of table in Sql Server by T-SQL
    The table has time stamp column
    StartedOn datetime
    EndedOn datetime

    The Below query has been used , but the textdata column doesnot include the name of the table ServiceLog.
    SELECT
    FROM
    databasename,
    duration
    fn_trace_gettable('F:\Program
    Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\log_148.trc',
    default)
    WHERE
    DATABASENAME='ZTCFUTURE'
    AND TEXTDATA
    IS
    NOT
    NULL
    --AND TEXTDATA LIKE 'SERVICE%'
    order
    by cpu
    desc; 

  • IPhone 6 Battery Usage setting not working.

    When I go to my setting and check my Battery Usage setting it states: "Battery information will be available after using iPhone for a few minutes". I've been using it for hours and I get the same response when I go to the setting. I've turned off my phone multiple times to see if that would resolve it, but it hasn't. Is anyone else experiencing this behavior?

    Hello.
    I have the same problem. iPhone 5, iOS8.0.2, used for a few days - still no usage statistics, only "Battery information will be available after using iPhone for a few minutes".
    I tried restore iPhone (DFU) without restoring backup from iCloud/iTunes, resets, hard-resets, erase all settings, drain battery to 0% and charge to 100% overnight etc. - nothing helps.
    I wrote to the Apple about this problem.
    Here is the page that you can use to contact with Apple and report a bug - https://www.apple.com/feedback/iphone.html
    Please, give the title of "iOS8 battery usage statistics not working" (or something like that), choose the "Bug ​​report" and describe the problem. Perhaps it will make that Apple will eliminate this problem in the next version of iOS. More report - greater chance.
    Regards 

  • IPhone 6 Battery Usage function not working

    Battery Usage feature continues to read; "Battery information will be available after using iPhone for a few minutes" even though I have now had the phone and used it for one week. Using iPhone 6, 64G, IOS 8.0.0.(no iOS updates have yet been applied) 
    A few days ago I attempted some suggestions posted by others. One of those was to let the battery drain to zero then fully charge. This had no affect on the Battery Usage feature. Another suggestion that i tried was to close all open apps on phone, then shut down phone and then turn back on. This did not resolve the Battery Usage issue either.
    Is apple aware of this issue? Any help would be appreciated.

    Hello.
    I have the same problem. iPhone 5, iOS8.0.2, used for a few days - still no usage statistics, only "Battery information will be available after using iPhone for a few minutes".
    I tried restore iPhone (DFU) without restoring backup from iCloud/iTunes, resets, hard-resets, erase all settings, drain battery to 0% and charge to 100% overnight etc. - nothing helps.
    I wrote to the Apple about this problem.
    Here is the page that you can use to contact with Apple and report a bug - https://www.apple.com/feedback/iphone.html
    Please, give the title of "iOS8 battery usage statistics not working" (or something like that), choose the "Bug ​​report" and describe the problem. Perhaps it will make that Apple will eliminate this problem in the next version of iOS. More report - greater chance.
    Regards 

  • To use SQL or to not use SQL ..... That is the question

    A couple of posts lately have brought something to my attention that I wanted to discuss between the folks that view this forum because I believe it is important. I highly value the opinions of many of the members here so I think getting your insight would not only benefit me, but many other forum members as well.
    This discussion stems from two posts:
    {message:id=3786432} (Billy)
    ...The question that you need to ask yourself is why use such a technique? For rendering the data a specific way in the client? Well, rendering data is NOT a SQL function and in essence a result of ignorance of how to correctly use client-server. Rendering on the client is dealt with by the client itself. Using SQL to do it.. not only nasty (as many of these examples above are), but also far from optimal and efficient SQL. And in most cases, will not scale. Increase the data volume of the table queried and there will be a hefty performance knock as SQL is incorrectly used.
    ...>
    {message:id=3914362} (Sven W.)
    ...For the Pivot considerations. It is usually much better not to try to do this inside the database. If you think about it. The data itself can be fetch from the database very easily. To do a PIVOT is a kind of GUI/Layout representation for this data. This should be done in the GUI Layer.
    >
    I tried to respond to the thread Billy posted in, so I'll cut and paste my response here:
    Discussion
    Where do we as database developers draw the line between the correct use of SQL or not? Or between rendering on the client and just returning data?
    Now with LISTAGG, PIVOT and UNPIVOT all available to us would these be considered correct uses of SQL?
    Where does this leave the TO_CHAR function? Is this considered rendering?
    I'm fully expecting a fuzzy answer with something along the lines of "do the work where it makes the most sense" from a ease of development and maintainability perspective but I just wanted to ask.
    Hopefully this is a valuable discussion.
    Thanks!

    Let me give a simple example. You can store images in a table as a LOB. You can serve these images to a web browser client via mod_plsql.
    However, the data is static. It requires I/O (and some hefty ones for larger images). What is the biggest performance penalty we have in Oracle? I/O? What is affected by doing I/O to read these images? The buffer cache (which will age out other data in the cache).
    Where else can we store this data? The web server. At what cost to the performance of Oracle? None. Impact on web server? Heck, web servers are designed at their very core to do this!
    So where is the best place to storage static images in this specific case? Not the database, but the web server.
    Now simply extend this concept to the client - where is the best place to render data?
    Should the data be formatted for rendering (e.g. converted into HTML) in the database layer, or should it rather be done in the presentation layer?
    Now I can already hear the argument that the former is exactly what we are doing using APEX. We create dynamic HTML pages on the Oracle server side and then dish that up to the rendering layer to display.
    Two issues that need to be considered. Firstly, this is not done using SQL. This is done using a procedure language called PL/SQL - not using native SQL. PL/SQL in this case is used exactly as Java or PHP or Perl or any other "+app layer+" language would be used. It only happens that PL/SQL resides in the database too. But do not mistake it for what it really is - the application layer.
    The second issue drives home the point that even in 3 tier client server, the application layer is not the best place to do the formatting for the rendering layer. Web 2.0 aka AJAX.. Where the app layer delivers a dynamic rendering engine (as Javascript) to the rendering layer. After which rendering and formatting are done solely inside that rendering layer. And interaction between that and the app layer is requests for new/fresh data to be rendered.
    Why is AJAX becoming so popular? Key issues and concepts like performance, and a rich client interface and so on.
    This all points that the fundamental principle of using the rendering layer to do its thing and using the SQL layer to do its (separate and different) thing, still holds true.
    Yes, we may not always stick to this principle - as we do with doing the rendering (creating HTML) in PL/SQL using APEX for example.. but this is not because the principle is unsound. It is because of technology reasons (different browsers, different behaviour), lack of support for W3C standards (hello IE) and so on.
    It is only recently that these problem areas have been meaningfully addressed.. and why rendering frameworks like extJS is the (rendering layer) future of 3 tier client server.
    If the concept of using SQL to perform rendering and formatting had any substance.. then there would have been a lot of resistance to AJAX for example. The reverse is true.. as we all want to use SQL to do SQL and want the rendering layer to do its thing without us having to code in SQL to specifically support rendering and formatting. It is clunky. It slows down the SQL (every formatting function is a tiny overhead that adds up). It does not bode well for maintenance and changes to the presentation layer. And all those tiny overheads can spell doom for scalability.
    I do not see any gray lines here, or a question of "+opinion+", or "+it depends+". The architecture is clear. The fundamentals are sound.
    The real issue is how we choose to apply these. But (the "+incorrect+") application (of these fundamentals) does not invalidate the fundamentals.

  • Transact-SQL debugger not working in SQL Server 2008: "...debugger does not support SQL Server 2005 or earlier..."

    I have recently installed SQL Server 2008. When I try to execute a query against an Access database, I receive this debugging error:
    "Unable to start Transact-SQL debugger. The Transact-SQL debugger does not support SQL Server 2005 or earlier versions of SQL Server. (SQLEditors)"
    Nor will the query execute; I get a transport-level error 0. Any thoughts?

    Hi Davidmhjr,
    >>Unable to start the Transact-SQL Debugger. The Transact-SQL Debugger does not support SQL Server 2005 or earlier versions of SQL Server. (SQLEditors).
    Have you tried to restart the server once you have installed SQL Server 2008? As Naomi N mentioned please check the version of SQL Server you are using.
    If you tried to connect to SQL Server 2005 from SQL Server 2008 SSMS, you would not be able to debug and get this error, it happens because T-SQL debugger includes both server-side and client-side components. The server-side debugger components are installed
    with each instance of the SQL Server 2008 Database Engine. The client-side components are installed when you install the SQL Server 2008 client-side tools.
    So it works with SQL Server 2008 only so far. Another way is you can triy to use SQL Server 2005 SSMS to connect to SQL Server 2005.
    More information about configuration requirement to run T-SQL debugger as below, please refer:
    There are no configuration requirements to run the Transact-SQL debugger when SQL Server Management Studio is running on the same computer as the instance of the SQL Server Database Engine. However, to run the Transact-SQL debugger when SQL Server Management
    Studio is running on a different computer from the instance of the Database Engine, you must enable program and port exceptions by using the Windows Firewall Control Panel application on both computers.
    On the computer that is running the instance of the Database Engine, in Windows Firewall, specify the following information:
    •Add TCP port 135 to the exceptions list.
    •Add the program sqlservr.exe to the exceptions list. By default, sqlservr.exe is installed in C:\Program Files\Microsoft SQL Server\MSSQL10.InstanceName\MSSQL\Binn, where InstanceName is MSSQLSERVER for the default instance, and the instance name for
    any named instance.
    •If the domain policy requires network communications to be done through IPsec, you must also add UDP port 4500 and UDP port 500 to the exception list.
    On the computer that is running SQL Server Management Studio, in Windows Firewall, specify the following information:
    •Add TCP port 135 to the exceptions list.
    •Add program ssms.exe (SQL Server Management Studio) to the exceptions list. By default, ssms.exe is installed in C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE.
    Hope it is helpful.
    Regards, Amber zhang

  • How do you know what the data usage was for and why?  It shows you date and usage but not the reason.

    How can you see what data usage was for on the bill?  It only shows the date and usage but not the reason for the usage.

    You can not see this info on VZW's site. There are apps for smartphones that will break down the info though, but by site or what was downloaded

  • Set Column width in query (not using SQL*Plus)

    How can I Set Column width in query
    I understand you can set column width using
    column col1 FORMAT A5
    select col1 from table1;But this only works in SQL*Plus
    I want to be able to do this in a regular SQL query window (not in SQL*Plus), how can I do it.....
    I am using a 'SQL window' in PL/SQL Developer IDE
    and when I use this syntax it says:
    ORA-00900: Invalid SQL statement
    Any suggestions are appreciated...
    thanks,
    M.

    Did you try using RPAD or LPAD functions? They fill the unfilled part of a string with character you provide... either on right or left side depending on what function you use.
    e.g.
    SELECT RPAD('Smith', 10, ' ') Name FROM dual;http://www.adp-gmbh.ch/ora/sql/rpad.html
    Edited by: Zaafran Ahmed on Nov 10, 2010 11:50 AM

  • Db link error in PL/SQL but not in SQL

    oracle 10.2.0.4
    solaris 10
    I have a simple procedure (anonymous block) that uses a db link to update a table in another db (on same host)
    The procedure fails with the following error:
    ORA-02019: connection description for remote database not found
    I can insert records using the same db_link using the exact same line pasted from the stored proc (same line that raises the ORA-02019).
    insert into table_x@my_db_link (select * from local_table_y);
    x rows inserted
    I use the same sql*plus session to run both the stored proc and sql command;
    SQL> conn my_user/my_pwd
    connected
    SQL> @my_proc.sql
    ORA-02019: connection description for remote database not found
    SQL> insert into table_x@my_db_link (select * from local_table_y);
    x rows inserted
    QUESTION:
    Why does the db_link fail in the procedure and not the sql command line call?
    P.S.
    I converted the procedure to a store proc and it also fails with the same call.

    Perhaps if the Database link is non-public?There is a bug, #3240720, which applies when the owner of the db link is not the user who's executing the query.
    There are several bugs which demonstrate this sort of behaviour. For instance ORA-2019 can be hurled if the local PL/SQL is running against a remote Dataguard standby database (although I would hope we wouldn't be running an INSERT in that scenario).
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • SQL Server Management 6.5.1.0 and 6.5.4.0 does not discovery SQL 2008 databases on Windows 2003

    SQL Server Management 6.5.1.0 and 6.5.4.0 does not discovery SQL 2008 databases on a custom instance name or when multiple SQL instances are installed on Windows 2003.
    OS Version: Windows 2203 x64 with SP2
    Database Version: 10.3.5869.0
    The instance in this case: I01 is running on port 49168.
    SQL Server Network Configuration | Protocols for I01 | IP Addresses | IPAll | TCP Port = 49168
    The DB Engine class is discovered but not the "Tcp Port" property.
    The database discovery script then fails as it is missing the 8th parameter; The Port.
    Looking at the discovery script DiscoverSQL2008DBEngineDiscovery.vbs i see the following WMI query.
    Set oWMI = GetObject("winmgmts:\\" & computerName & "\root\Microsoft\SqlServer\" & SQL_WMI_NAMESPACE)  
    Set oQuery = oWMI.ExecQuery("SELECT * FROM ServerNetworkProtocolProperty
    Using WMI Explorer if I connect to namespace: root\Microsoft\SqlServer\ComputerManagement10
    and query "SELECT * FROM ServerNetworkProtocolProperty". There are no instances.
    What am I missing or doing wrong?
    Closely related to this article. https://gallery.technet.microsoft.com/Hotfix-Management-Pack-SQL-17cf1118#content.
    Thanks
    Gavin

    Hi,
    I would like to know is there any update about the issue. If the issue is solved, will you please share the resolution here to help others in this forum who encounter similar issue.
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Sp2-0575: Use of oracle SQL feature  not in sql 92 entry level.

    Hi,
    While logging to sqlplus I'm getting the following message
    "sp2-0575: Use of oracle SQL feature not in sql 92 entry level."
    and login is successful, but I'm not able to generate next value from the sequence .
    t says no rows selected when i request
    for nextval a
    EX: select mySeq.nextval from dual; (mySeq is sequence)
    Thanx,
    Ravi.

    What has happened is that someone has enabled the Oracle feature called as FIPS flagger.
    This is a feature that Oracle provides to you if you plan to write SQL code that should be portable
    to other RDBMS systems. IF you enable this flagger and use a feature which is not in the SQL standard,
    Oracle will complain that use of this feature will make your application Oracle dependent, and you may not
    be able to run this application against any other RDBMS.
    To disable this for your SQL*Plus session do this:
    SQL> set flagger off
    SQL>
    Once you do this it will allow you to use all SQL commands including Oracle specific extensions.

  • Why would SMO WMI not return SQL 2012 Services in the ManagedComputer.Services collection when the instances are in ServerInstances

    The following code
    var comp = new Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer();
    var bob = comp.Services;
    Only returns the 2008R2 instances on my machine not the sql 2012 instances.
    Oddly the ServerInstances includes all the instances.
    This means I can't get the StartupParameters for the instance.
    I've checked and its definitely using the sql 2012 version of SMO. All services are using the same user account (Network Service)
    Can anyone think why this would be.
    @simon_sabin -
    SQL Know How - SQL Server Consultancy and Real world training - SQLBits - Largest SQL Server Conference in Europe and its free

    2014-09-08T20:23:33.1175952+02:00 *** Test of the default constructor of ManagedComputer
    Name of the ManagedComputer : USER-PC
    - 3 ClientProtocols
    - 0 ServerAliases
    - 3 ServerInstances
    - Instance : EXPRESS_ADV_2014
    - Instance : EXPRESSADV2014
    - Instance : SQLEXPRESS
    - 12 Services
    List of the available services :
    - Service : MSSQL$EXPRESS_ADV_2014
    - DisplayName : SQL Server (EXPRESS_ADV_2014)
    - ErrorControl : Normal
    - PathName : "F:\Install_SQLServerExpress2014\MSSQL12.EXPRESS_ADV_2014\MSSQL\Binn\sqlservr.exe" -sEXPRESS_ADV_2014
    - ProcessId : 1972
    - ServiceState : Running
    - Type : SqlServer
    - StartMode : Auto
    - Service : MSSQL$EXPRESSADV2014
    - DisplayName : SQL Server (EXPRESSADV2014)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL12.EXPRESSADV2014\MSSQL\Binn\sqlservr.exe" -sEXPRESSADV2014
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : SqlServer
    - StartMode : Disabled
    - Service : MSSQL$SQLEXPRESS
    - DisplayName : SQL Server (SQLEXPRESS)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS_ADV\MSSQL\Binn\sqlservr.exe" -sSQLEXPRESS
    - ProcessId : 356
    - ServiceState : Running
    - Type : SqlServer
    - StartMode : Auto
    - Service : MSSQLFDLauncher$EXPRESS_ADV_2014
    - DisplayName : SQL Full-text Filter Daemon Launcher (EXPRESS_ADV_2014)
    - ErrorControl : Normal
    - PathName : "F:\Install_SQLServerExpress2014\MSSQL12.EXPRESS_ADV_2014\MSSQL\Binn\fdlauncher.exe" -s MSSQL12.EXPRESS_ADV_2014
    - ProcessId : 1708
    - ServiceState : Running
    - Type : 9
    - StartMode : Manual
    - Service : MSSQLFDLauncher$EXPRESSADV2014
    - DisplayName : SQL Full-text Filter Daemon Launcher (EXPRESSADV2014)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL12.EXPRESSADV2014\MSSQL\Binn\fdlauncher.exe" -s MSSQL12.EXPRESSADV2014
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : 9
    - StartMode : Manual
    - Service : MSSQLFDLauncher$SQLEXPRESS
    - DisplayName : SQL Full-text Filter Daemon Launcher (SQLEXPRESS)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS_ADV\MSSQL\Binn\fdlauncher.exe" -s MSSQL11.SQLEXPRESS_ADV
    - ProcessId : 3980
    - ServiceState : Running
    - Type : 9
    - StartMode : Manual
    - Service : ReportServer$EXPRESSADV2014
    - DisplayName : SQL Server Reporting Services (EXPRESSADV2014)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSRS12.EXPRESSADV2014\Reporting Services\ReportServer\bin\ReportingServicesService.exe"
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : ReportServer
    - StartMode : Auto
    - Service : ReportServer$SQLEXPRESS
    - DisplayName : SQL Server Reporting Services (SQLEXPRESS)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSRS11.SQLEXPRESS_ADV\Reporting Services\ReportServer\bin\ReportingServicesService.exe"
    - ProcessId : 2516
    - ServiceState : Running
    - Type : ReportServer
    - StartMode : Auto
    - Service : SQLAgent$EXPRESS_ADV_2014
    - DisplayName : SQL Server Agent (EXPRESS_ADV_2014)
    - ErrorControl : Normal
    - PathName : "F:\Install_SQLServerExpress2014\MSSQL12.EXPRESS_ADV_2014\MSSQL\Binn\SQLAGENT.EXE" -i EXPRESS_ADV_2014
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : SqlAgent
    - StartMode : Disabled
    - Service : SQLAgent$EXPRESSADV2014
    - DisplayName : SQL Server Agent (EXPRESSADV2014)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL12.EXPRESSADV2014\MSSQL\Binn\SQLAGENT.EXE" -i EXPRESSADV2014
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : SqlAgent
    - StartMode : Disabled
    - Service : SQLAgent$SQLEXPRESS
    - DisplayName : SQL Server Agent (SQLEXPRESS)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS_ADV\MSSQL\Binn\SQLAGENT.EXE" -i SQLEXPRESS
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : SqlAgent
    - StartMode : Disabled
    - Service : SQLBrowser
    - DisplayName : SQL Server Browser
    - ErrorControl : Normal
    - PathName : "C:\Program Files (x86)\Microsoft SQL Server\90\Shared\sqlbrowser.exe"
    - ProcessId : 2628
    - ServiceState : Running
    - Type : SqlBrowser
    - StartMode : Auto
    Hello Simon ,
    For SMO assemblies : the version is 11 for SQL Server 2012 , and 10 for SQL Server 2008 R2 ( and not 10.5 , so when you have SQL Server 2008 and 2008 R2 , the SMO assemblies for 2008 are replaced by the SMO assemblies for 2008 R2 ). I faced this
    problem when I installed SQL Server 2008 R2 aside a left 2008 install.
    On my current computer , I have only 2012 and 2014 instances and I have no problem.
    To check the version of the assemblies ( Microsoft.Smo.SqlWmiManagement mainly ) in your Visual Studio , click on the name of this assembly and look at the Version : it should be 11.0.0 ( for SQL Server 2012 ).
    Yesterday , I have written a little application to view the instances and services on my computer.
    using System.Collections.Specialized;
    using System.Data;
    using System.Linq;
    using System.Management;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using Microsoft.SqlServer.Management.Common;
    using Microsoft.SqlServer.Management.Dmf;
    using Microsoft.SqlServer.Management.Facets;
    using Microsoft.SqlServer.Management.Sdk.Sfc;
    using Microsoft.SqlServer.Management.Smo;
    using Microsoft.SqlServer.Management.Smo.SqlEnum;
    using Microsoft.SqlServer.Management.Smo.Wmi;
    namespace Test_ManagedComputer_SMO2014_VCS2014
    /// <summary>
    /// Class for fields/properties/methods used in the Main method
    /// </summary>
    class Program
    private static ManagedComputer m_mc = null;
    public static ManagedComputer Mc
    get
    return m_mc;
    private set
    m_mc = value;
    static void Main( string[] args )
    String _s = "";
    if ( !CommonCls.AppInit("en-US" , true ) )
    return;
    _s = "Test of the default constructor of ManagedComputer";
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(true , _s);
    m_mc = new ManagedComputer();
    _s = String.Format("Name of the ManagedComputer : {0}" , m_mc.Name );
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false , _s);
    _s = String.Format(" - {0} ClientProtocols" , CommonCls.Int32ToString( m_mc.ClientProtocols.Count , 5 ));
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false , _s );
    _s = String.Format(" - {0} ServerAliases" , CommonCls.Int32ToString( m_mc.ServerAliases.Count , 5 ) );
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false , _s);
    _s = String.Format( " - {0} ServerInstances" , CommonCls.Int32ToString( m_mc.ServerInstances.Count , 5 ) );
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    foreach ( ServerInstance _serverinstance in Mc.ServerInstances )
    _s = String.Format(" - Instance : {0}" , _serverinstance.Name );
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    _s = String.Format( " - {0} Services" , CommonCls.Int32ToString( m_mc.Services.Count , 5 ) );
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    _s = "List of the available services : ";
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    foreach ( Service _service in Mc.Services )
    _s = " - Service : " + _service.Name;
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    _s = " - DisplayName : " + _service.DisplayName;
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    _s = " - ErrorControl : " + _service.ErrorControl.ToString();
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    _s = " - PathName : " + _service.PathName;
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    _s = " - ProcessId : " + _service.ProcessId.ToString();
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    _s = " - ServiceAccount : " + _service.ServiceAccount;
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false ,_s);
    _s = " - ServiceState : " + _service.ServiceState.ToString();
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    _s = " - Type : " + _service.Type.ToString();
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    _s = " - StartMode : " + _service.StartMode.ToString();
    Console.WriteLine(_s);
    CommonCls.AppWriteLog(false,_s);
    EndOfProgram :
    CommonCls.AppClose();
    I am getting the following results
    2014-09-08T20:23:33.1175952+02:00 *** Test of the default constructor of ManagedComputer
    Name of the ManagedComputer : USER-PC
    - 3 ClientProtocols
    - 0 ServerAliases
    - 3 ServerInstances
    - Instance : EXPRESS_ADV_2014
    - Instance : EXPRESSADV2014
    - Instance : SQLEXPRESS
    - 12 Services
    List of the available services :
    - Service : MSSQL$EXPRESS_ADV_2014
    - DisplayName : SQL Server (EXPRESS_ADV_2014)
    - ErrorControl : Normal
    - PathName : "F:\Install_SQLServerExpress2014\MSSQL12.EXPRESS_ADV_2014\MSSQL\Binn\sqlservr.exe" -sEXPRESS_ADV_2014
    - ProcessId : 1972
    - ServiceState : Running
    - Type : SqlServer
    - StartMode : Auto
    - Service : MSSQL$EXPRESSADV2014
    - DisplayName : SQL Server (EXPRESSADV2014)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL12.EXPRESSADV2014\MSSQL\Binn\sqlservr.exe" -sEXPRESSADV2014
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : SqlServer
    - StartMode : Disabled
    - Service : MSSQL$SQLEXPRESS
    - DisplayName : SQL Server (SQLEXPRESS)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS_ADV\MSSQL\Binn\sqlservr.exe" -sSQLEXPRESS
    - ProcessId : 356
    - ServiceState : Running
    - Type : SqlServer
    - StartMode : Auto
    - Service : MSSQLFDLauncher$EXPRESS_ADV_2014
    - DisplayName : SQL Full-text Filter Daemon Launcher (EXPRESS_ADV_2014)
    - ErrorControl : Normal
    - PathName : "F:\Install_SQLServerExpress2014\MSSQL12.EXPRESS_ADV_2014\MSSQL\Binn\fdlauncher.exe" -s MSSQL12.EXPRESS_ADV_2014
    - ProcessId : 1708
    - ServiceState : Running
    - Type : 9
    - StartMode : Manual
    - Service : MSSQLFDLauncher$EXPRESSADV2014
    - DisplayName : SQL Full-text Filter Daemon Launcher (EXPRESSADV2014)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL12.EXPRESSADV2014\MSSQL\Binn\fdlauncher.exe" -s MSSQL12.EXPRESSADV2014
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : 9
    - StartMode : Manual
    - Service : MSSQLFDLauncher$SQLEXPRESS
    - DisplayName : SQL Full-text Filter Daemon Launcher (SQLEXPRESS)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS_ADV\MSSQL\Binn\fdlauncher.exe" -s MSSQL11.SQLEXPRESS_ADV
    - ProcessId : 3980
    - ServiceState : Running
    - Type : 9
    - StartMode : Manual
    - Service : ReportServer$EXPRESSADV2014
    - DisplayName : SQL Server Reporting Services (EXPRESSADV2014)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSRS12.EXPRESSADV2014\Reporting Services\ReportServer\bin\ReportingServicesService.exe"
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : ReportServer
    - StartMode : Auto
    - Service : ReportServer$SQLEXPRESS
    - DisplayName : SQL Server Reporting Services (SQLEXPRESS)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSRS11.SQLEXPRESS_ADV\Reporting Services\ReportServer\bin\ReportingServicesService.exe"
    - ProcessId : 2516
    - ServiceState : Running
    - Type : ReportServer
    - StartMode : Auto
    - Service : SQLAgent$EXPRESS_ADV_2014
    - DisplayName : SQL Server Agent (EXPRESS_ADV_2014)
    - ErrorControl : Normal
    - PathName : "F:\Install_SQLServerExpress2014\MSSQL12.EXPRESS_ADV_2014\MSSQL\Binn\SQLAGENT.EXE" -i EXPRESS_ADV_2014
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : SqlAgent
    - StartMode : Disabled
    - Service : SQLAgent$EXPRESSADV2014
    - DisplayName : SQL Server Agent (EXPRESSADV2014)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL12.EXPRESSADV2014\MSSQL\Binn\SQLAGENT.EXE" -i EXPRESSADV2014
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : SqlAgent
    - StartMode : Disabled
    - Service : SQLAgent$SQLEXPRESS
    - DisplayName : SQL Server Agent (SQLEXPRESS)
    - ErrorControl : Normal
    - PathName : "C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS_ADV\MSSQL\Binn\SQLAGENT.EXE" -i SQLEXPRESS
    - ProcessId : 0
    - ServiceState : Stopped
    - Type : SqlAgent
    - StartMode : Disabled
    - Service : SQLBrowser
    - DisplayName : SQL Server Browser
    - ErrorControl : Normal
    - PathName : "C:\Program Files (x86)\Microsoft SQL Server\90\Shared\sqlbrowser.exe"
    - ProcessId : 2628
    - ServiceState : Running
    - Type : SqlBrowser
    - StartMode : Auto
    CommonCls.AppWriteLog is only a method which has 2 parameters , the 2nd one is the string to write in a application log , the 1st if true , the current datetime is written before the content of the 1st parameter. It is useful to simulate a hardcopy of the screen
    , especially when the application is a console one.
    I have not tested to write the startup parameters but it was working in a previous application
    As you can see , I have 3 instances , 1 SQL Server 2012 and 2 SQL Server 2014 ( but one is "ill" it's why the startup of the SQL Server service is disabled , it will be repaired when I will reinstall W7 or install W8 )
    I don't see any reason why you are not seen the 2012 instances except if the version of your assembly is 10 instead 11 ( a little tip :when you are adding a reference , in the box after a browse , you are sorting the names of the
    assemblies in the selection box , as the assemblies 2008/2008 R2 are appearing before the assemblies 2012 , it' minimizing the risk of confusion of assemblies and try to increase the visibility of the full path by double-clicking the title of the Path
    column , if you don't do that , you should not see the version number included in the path name ).
    Don't hesitate to post again for more help or explanations.
    Have a nice day
    Patrick
    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

  • BT Infinity Usage Monitor not updating.....hmmm???

    This happens at the end of every month.  I'm starting to think it is an actual ploy from BT to stop users from knowing how much broadband usage they have left?  The usage monitor normally starts acting up around the 25th of every month....then you get an odd day where it works then it then it stops updating completely.  This leaves a BT user in a vunerable position.
    A, Scared of using Internet - Not wanting a penalty charge by going over your limit!
    B, Not allowing the BT user to use their full amount of data that they are paying for = saving BT money = ripping us off!!!
    SORT IT OUT BT.......IT'S JUST NOT GOOD ENOUGH.

    A lot more in this thread regarding the usage monitor,
    http://community.bt.com/t5/BT-Infinity/BT-Infinity-Usage-Monitor-not-updated-today/td-p/616958
    Regards,
    Frogman

  • Configuration note  of SQL SERVER 2005

    Hello,
    Is there a SAP configuration note for SQL 2005 like note 327494 for SQL 2000 ?
    Or does someone know if there should be special configuration for SQL SERVER 2005 ?
    Pelase advice,
    Dimitry

    Hello
    Please review 879941 Configuration Parameters for SQL Server 2005
    thanks
    N.P.C

  • Suppress Powershell Warning in agent job "WARNING: Could not obtain SQL Server Service information"

    Hi
    I get this warning running through powershell_ise but through sql agent it just errors out.
    The code does everything it is supposed to and I tried everything to completely resolve the warning to no avail.
    How do I supress it so sql agent wont error out running powershell code?
    Thanks!
    WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'server_name' failed with the following error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    Warning only present when it connects to remote servers, it doesn't produce it for local server. And it does get all info from the remote servers.
    Paula

    Hi paulata,
    According to your description, when you run powershell scripts about  the remote machine
     in SQL Server Agent job, the warning error will occur. “The common error message is Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).” This suggests that your credentials aren't sufficient for accessing the
    remote system. If you have an account that has sufficient permissions for the query, there's a simple workaround for this problem in the form of PowerShell's Get-Credential command and the script's Credential parameter. I recommend you check if your account
    has permission on remote machine and it can execute the powershell scripts.
    In addition, if you want to run query statement on the remote machine , I recommend you create Linked Server, then do some related operations. There is a similar issue about access denied, you can review the following article.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/157f536d-6716-4547-bdb4-9e3c8451cb95/sql-agent-service-account-permissions-sql-server-2008?forum=sqlgetstarted
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

Maybe you are looking for

  • Problem with 3D and Modify selections

    Could someone help? When I first installed CS5 upgrade on Windows 7 from CS3, the 3D option was availbale. It has now disappeared. I had added the mystical (AutoFX) plug-in and fearing that was the culprit, I uninstalled and have not installed it aga

  • Select extra row without using UNION ALL in pl/sql

    Hi, Can anyone tell me how to select extra row without using UNION or UNION ALL in pl/sql. Actually I want to have my o/p of query as partitioned by designation and ordered by salary and than one extra row which will contain the highest salary in a p

  • Can't find the last three weeks of back-ups on my Time Machine -- HELP!

    Today I purchased a new 17" macbook pro to replace one that crashed over the weekend. I did a complete restore from time machine. When it was done, I realized it only restored files from 3.8.2010. It's 3.29.2010. How can I find the last 21 days? I kn

  • Changing snooze from 1 wk. to 2 wks. ?

    Is there a way to change the snooze options from 1 wk. to 2 wks., 3 wks., etc. Also with the hrs. if I wanted it to snooze more than 2 hrs. ? It would REALLY be nice to snooze items say for when you leave for a vacation for a couple of wks. if need b

  • Hi, about table maintainance

    How  can  we enter the values in the table with out using th option table maintainance allowed.