Can SQL Server 2012 witness monitor a 2008 R2 database.

Hi
I was wondering if it was possible for a sqlserver 201witness to monitor databases running sqlserver 2008R2. I am also curious to know about the vice versa possiblity.
Thanks

The two partners, that is the principal server and mirror server, must be running the same edition of SQL Server. The witness, if any, can run on any edition of SQL Server that supports database
mirroring.
See prerequisites section from below link:
http://msdn.microsoft.com/en-IN/library/ms366349.aspx
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Thanks,
Shashikant

Similar Messages

  • SQL Server 2012 - RESOURCE MONITOR / PREEMPTIVE_XE_CALLBACKEXECUTE high CPU usage

    Hello, 
      We are currently in the process of migrating an existing clustered SQL Server 2008 R2 instance over to a clustered SQL Server 2012 instance as we phase out the Windows Server 2008 with SQL Server 2008 R2.
      The setup is identical for the SQL Server 2012 instance as it is on the SQL Server 2008 R2 instance.  (meaning the RAM and CPU are both the same or better on the SQL Server 2012 instance)
      The process in which we are migrating is that we're moving a few databases over to the new SQL Server 2012 instance each night.  What we've noticed is that the CPU usage is much higher on the SQL Server 2012 instance than on the previous
    SQL Server 2008 R2 instance even though the there is only 1/2 of the databases migrated to the 2012 instance. 
      Running the following script:
    ;with cte ([totalCPU]) as (select sum(cpu) from master.dbo.sysprocesses)
    select
    tblSysprocess.spid
    , tblSysprocess.cpu
    , CONVERT(BIGINT,(tblSysprocess.cpu * CONVERT(BIGINT,100))) / CONVERT(BIGINT, cte.totalCPU) as [percentileCPU]
    , tblSysprocess.physical_io
    , tblSysprocess.memusage
    , tblSysprocess.cmd
    , tblSysProcess.lastwaittype
    from master.dbo.sysprocesses tblSysprocess
    cross apply cte
    order by tblSysprocess.cpu desc
    Produces the following results:
    In a clustered environment, is this normal and if not, does anyone know what this means or how to reduce the CPU usage?
    Thanks.

    Hello,
    The following query may help us identify extended events or audit configurations running on that SQL Server server that are producing that high CPU usage scenario.
    SELECT
    s.name
    AS 'Sessions'
    FROM
    sys.server_event_sessions
    AS s
    WHERE
    s.name
    <> 'system_health'
    and s.name
    <> 'AlwaysOn_health';
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • SQL Server 2012 installation and to default user database files to a particular path

    Hi, I am working on SQL Server 2012 installation on one of our test boxes and I would like to configure the sql server install binaries and all the system databases but for tempdb to be in my C and tempdb on a different drive and once all this is set up,
    whenever a developer creates a new database without specifying the path for the mdf & ldf files. They should be defaulted to a path like "D:/Data file" & "D:/Log file" for instance instead of being created on the C drive.
    Thanks in advance.........
    Ione

    Hi,
    You can of course set default location of database through management Studio please refer below link. Once you change default location even if you do not specify location it would take default one.
    http://sqlandme.com/2013/03/18/sql-server-changing-default-database-location-for-server/
    I would advise you not to keep files on C drive let it be dedicated system drive also its quite possible that SQL server service account would not have privilege on C drive so after you move tempdb SQL server would not come online as tempdb files cannot
    be created . Tempdb is always recreated after SQL Server starts so you just need to change location once using Alter database command
    See example mentioned in below link for how to do that
    http://msdn.microsoft.com/en-us/library/ms345408%28SQL.90%29.aspx
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • SQL Server 2012 express istallation failing to install "Database Engine Service" and "SQL Server Replication"

    I ran SQL Server 2012 express setup as user with administrator privileges and still it's failing to install "Database Engine Service" and "SQL Server Replication".
    Any and every ideas on how to resolve this issue is greatly appreciated.

    Three weeks passed and I am yet to find a fix for the the failed installation of the database engine on sql server 2012 express installation. I have tried various work-around including uninstalling, deleting all the directory paths, and reinstallation. Still
    not able to successfully install sql server 2012 express.
    I will greatly appreciate any and every contribution towards resolving this issue. Thanks in advance.
    Here is the content of log file after the latest failed installation:
    Overall summary:
      Final result:                  Failed: see details below
      Exit code (Decimal):           -2061893607
      Start time:                    2013-12-23 14:42:45
      End time:                      2013-12-23 15:07:51
      Requested action:              Install
    Setup completed with required actions for features.
    Troubleshooting information for those features:
      Next step for SQLEngine:       Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Next step for Replication:     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
    Machine Properties:
      Machine name:                  mymachine1
      Machine processor count:       4
      OS version:                    Windows 7
      OS service pack:               Service Pack 1
      OS region:                     United States
      OS language:                   English (United States)
      OS architecture:               x86
      Process architecture:          32 Bit
      OS clustered:                  No
    Product features discovered:
      Product              Instance             Instance ID                   
    Feature                                  Language            
    Edition              Version         Clustered
      SQL Server 2012      SQLEXPRESS_GT        MSSQL11.SQLEXPRESS_GT          Database Engine Services                
    1033                 Express Edition      11.0.2100.60    No        
      SQL Server 2012      SQLEXPRESS_GT        MSSQL11.SQLEXPRESS_GT          SQL Server Replication                  
    1033                 Express Edition      11.0.2100.60    No        
      SQL Server 2012                                                         
    Management Tools - Basic                 1033                 Express Edition     
    11.0.2100.60    No        
    Package properties:
      Description:                   Microsoft SQL Server 2012 Service Pack 1
      ProductName:                   SQL Server 2012
      Type:                          RTM
      Version:                       11
      Installation location:         C:\9b6607e524727c7fe1defd80\x86\setup\
      Installation edition:          Express
      Slipstream:                    True
      SP Level                       1
    Product Update Status:
      Success: KB 2674319
    Product Updates Selected for Installation:
      Title:                         Service Pack 1
      Knowledge Based Article:       KB 2674319
      Version:                       11.1.3000.0
      Architecture:                  x86
      Language:                      1033
      Update Source:                 MU
    User Input Settings:
      ACTION:                        Install
      ADDCURRENTUSERASSQLADMIN:      true
      AGTSVCACCOUNT:                 NT AUTHORITY\NETWORK SERVICE
      AGTSVCPASSWORD:                *****
      AGTSVCSTARTUPTYPE:             Disabled
      ASBACKUPDIR:                   Backup
      ASCOLLATION:                   Latin1_General_CI_AS
      ASCONFIGDIR:                   Config
      ASDATADIR:                     Data
      ASLOGDIR:                      Log
      ASPROVIDERMSOLAP:              1
      ASSERVERMODE:                  MULTIDIMENSIONAL
      ASSVCACCOUNT:                  <empty>
      ASSVCPASSWORD:                 <empty>
      ASSVCSTARTUPTYPE:              Automatic
      ASSYSADMINACCOUNTS:            <empty>
      ASTEMPDIR:                     Temp
      BROWSERSVCSTARTUPTYPE:         Disabled
      CLTCTLRNAME:                   <empty>
      CLTRESULTDIR:                  <empty>
      CLTSTARTUPTYPE:                0
      CLTSVCACCOUNT:                 <empty>
      CLTSVCPASSWORD:                <empty>
      CLTWORKINGDIR:                 <empty>
      COMMFABRICENCRYPTION:          0
      COMMFABRICNETWORKLEVEL:        0
      COMMFABRICPORT:                0
      CONFIGURATIONFILE:             
      CTLRSTARTUPTYPE:               0
      CTLRSVCACCOUNT:                <empty>
      CTLRSVCPASSWORD:               <empty>
      CTLRUSERS:                     <empty>
      ENABLERANU:                    true
      ENU:                           true
      ERRORREPORTING:                false
      FEATURES:                      SQLENGINE, REPLICATION, CONN, BC, SDK, ADV_SSMS, SNAC_SDK
      FILESTREAMLEVEL:               0
      FILESTREAMSHARENAME:           <empty>
      FTSVCACCOUNT:                  <empty>
      FTSVCPASSWORD:                 <empty>
      HELP:                          false
      IACCEPTSQLSERVERLICENSETERMS:  true
      INDICATEPROGRESS:              false
      INSTALLSHAREDDIR:              c:\Program Files\Microsoft SQL Server\
      INSTALLSHAREDWOWDIR:           <empty>
      INSTALLSQLDATADIR:             <empty>
      INSTANCEDIR:                   C:\Program Files\Microsoft SQL Server\
      INSTANCEID:                    SQLEXPRESS
      INSTANCENAME:                  SQLEXPRESS
      ISSVCACCOUNT:                  NT AUTHORITY\Network Service
      ISSVCPASSWORD:                 <empty>
      ISSVCSTARTUPTYPE:              Automatic
      MATRIXCMBRICKCOMMPORT:         0
      MATRIXCMSERVERNAME:            <empty>
      MATRIXNAME:                    <empty>
      NPENABLED:                     0
      PID:                           *****
      QUIET:                         false
      QUIETSIMPLE:                   false
      ROLE:                          <empty>
      RSINSTALLMODE:                 DefaultNativeMode
      RSSHPINSTALLMODE:              DefaultSharePointMode
      RSSVCACCOUNT:                  <empty>
      RSSVCPASSWORD:                 <empty>
      RSSVCSTARTUPTYPE:              Automatic
      SAPWD:                         <empty>
      SECURITYMODE:                  <empty>
      SQLBACKUPDIR:                  <empty>
      SQLCOLLATION:                  SQL_Latin1_General_CP1_CI_AS
      SQLSVCACCOUNT:                 NT Service\MSSQL$SQLEXPRESS
      SQLSVCPASSWORD:                <empty>
      SQLSVCSTARTUPTYPE:             Manual
      SQLSYSADMINACCOUNTS:           MH\gt038676t
      SQLTEMPDBDIR:                  <empty>
      SQLTEMPDBLOGDIR:               <empty>
      SQLUSERDBDIR:                  <empty>
      SQLUSERDBLOGDIR:               <empty>
      SQMREPORTING:                  false
      TCPENABLED:                    0
      UIMODE:                        AutoAdvance
      UpdateEnabled:                 true
      UpdateSource:                  MU
      X86:                           false
      Configuration file:            C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20131223_144132\ConfigurationFile.ini
    Detailed results:
      Feature:                       Management Tools - Complete
      Status:                        Passed
      Feature:                       Client Tools Connectivity
      Status:                        Passed
      Feature:                       Client Tools SDK
      Status:                        Passed
      Feature:                       Client Tools Backwards Compatibility
      Status:                        Passed
      Feature:                       Management Tools - Basic
      Status:                        Passed
      Feature:                       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, uninstall this feature, and then run the setup process again.
      Component name:                SQL Server Database Engine Services Instance Features
      Component error code:          0x851A0019
      Error description:             Could not find the Database Engine startup handle.
      Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3000.0&EvtType=0xE53883A0%400xBE03358B%401306%4025&EvtType=0xE53883A0%400xBE03358B%401306%4025
      Feature:                       SQL Server Replication
      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, uninstall this feature, and then run the setup process again.
      Component name:                SQL Server Database Engine Services Instance Features
      Component error code:          0x851A0019
      Error description:             Could not find the Database Engine startup handle.
      Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3000.0&EvtType=0xE53883A0%400xBE03358B%401306%4025&EvtType=0xE53883A0%400xBE03358B%401306%4025
      Feature:                       SQL Browser
      Status:                        Passed
      Feature:                       SQL Writer
      Status:                        Passed
      Feature:                       SQL Client Connectivity
      Status:                        Passed
      Feature:                       SQL Client Connectivity SDK
      Status:                        Passed
    Rules with failures:
    Global rules:
    Scenario specific rules:
    Rules report file:               C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20131223_144132\SystemConfigurationCheck_Report.htm

  • SQL Server 2012 AlwaysON Monitoring using SCOM

    Team,
    We have SCOM deployed and is serving as a monitoring solution for our SQL Estate. However I want some pointers to monitor the health of DBs within Avaialibility Group like DB Sync, log queue etc. Please direct me with the AlwaysOn health parameters that
    can be monitored by SCOM. 
    I have confirmed with SCOM admin that we have the latest management pack installed for SQL 2012 and currently its getting monitored. However we are not seeing any alerts though.
    Your inputs are highly appreciated.
    Regards,
    Sharath

    The below link might be useful
    http://blog.islamgomaa.com/?p=273
    http://thoughtsonopsmgr.blogspot.com/2012/04/updated-mp-sql-server-monitoring-mp.html
    --Prashanth

  • SQL Server 2012 Database with FileStream enabled tables

    Hi,
    I have some questions concerning the SQL Server 2012 FileStream feature.
    In a database combining both Filestream connected tables and none filestream connected tables. It is obviously possible to tell the root path to a filestream FILEGROUP. It's also possible to create database primary data file (.mdf) and several
    optional secondary data files (.ndf), and multiple log files.
    If I have two filestream connected tables, which each in turn have a couple of other referenced tables (none filestream connected). Is it possible to put the filestream filegroup1 (eg. the filestream connected table1) and its referenced none filestream connected
    tables, their data, indexes etc., on the same physical data file? And the other filestream connected table and its referenced tables to another physical file (.ndf)? If this is possible and recommended, how do I declare such an create database statement?
    For ex. when having tables for both none archived state, archived state, in the same database. Or is the best solution to split the two (and its referenced tables) in separate databases?
    SWEDEV

    Hello,
    File groups a just contains for the objects, you e.g. can split one table over several file Groups/secondarie files using partitioning. And a filestream is also just a table. You can reference all table Independent of file Groups / file stream.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • What is the difference between SQL Server 2012 R2 & SQL Server 2014

    Hi all,
     I am using SQL Server from last 3 years. I started SQL Server 2008 R2. Now I am using SQL Server 2012. I want to change my development environment to SQL Server 2012 R2. But suddenly I saw that SQL Server 2014 is released. I want to know what are the
    differences between SQL Server 2012 R2 & SQL Server 2014. Are both those are the same or different products?
    I searched through the Internet but I didn't find any article regarding that. So could someone help me to solve this matter?
    Thanks,
    Regards,
    Chiranthaka

    differences between SQL Server 2012 R2 & SQL Server 2014.
    We don't have a Version "SQL Server 2012 R2", only 2005, 2008, 2008R2, 2012 and 2014.
    See MSDN What's New in SQL Server 2014
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Automated SQL Server 2012 Installation

    I want to be able to install SQL Server during an automated server build while NOT logged into the machine. I have it installing SQL Server 2012 using a config file and setting the sa password. The installation completes but does not use the configuration
    file.
    Can SQL Server 2012 be installed this way?

    Yes you can automate, please check the below links and you have to modify the configuration file as per your server details....
    https://msdn.microsoft.com/en-us/library/dd239405%28v=sql.105%29.aspx
    https://msdn.microsoft.com/en-us/library/ms144259.aspx
    https://social.msdn.microsoft.com/Forums/en-US/9e7933a2-d43f-40b6-ae9f-ab7c8bdf06de/automate-sql-install-question?forum=sqlsetupandupgrade
    Raju Rasagounder Sr MSSQL DBA

  • SQL Server 2012 restoring database from backup file

    Hi All,
    1. I was restoring the database from PROD box to DEV box with the deferent name.
    For Ex: Both PROD and DEV boxes are having "A" database. Now I am refreshing database"A" from PROD bot to DEV box with name "B". Now while restoring in SQL server 2012 I used GUI and took database name as "A" by default.
    by mistake I executed the request. before completing I notice that "A" database in DEV Box went to restoring mode.
    Now, in middle I stopped the query but still I am seeing database "A" is in restoring state.
    Please guide me is there any way to bring database online with current data?
    2. Why sql server 2012 takes tail log backup of the existing database while restoring database with different name?

    Hi,
    check this link for the same issue and solutions:
    http://stackoverflow.com/questions/520967/sql-server-database-stuck-in-restoring-state
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Can we use SQL Server 2012 Web Edition as a witness server in mirroring?

    Hi All,
    Can we use SQL Server 2012 Web Edition as a witness server in mirroring?
    Grateful to your time and support. Regards, Shiva

    Hi All,
    Can we use SQL Server 2012 Web Edition as a witness server in mirroring?
    Grateful to your time and support. Regards, Shiva
    As Per BOL
    We strongly recommend that the witness reside on a separate computer from the partners. Database mirroring partners are supported only by SQL Server 2005 Standard and later versions and by SQL Server 2005 Enterprise Edition and later versions.
    Witnesses, in contrast, are also supported by SQL Server 2005 Workgroup and later versions and by SQL Server 2005 Express Edition and later versions. Except during an upgrade from an earlier version of SQL Server, the server instances in a
    mirroring session must all be running the same version of SQL Server. For example, a SQL Server 2005 witness is supported when you are upgrading from a SQL Server 2005 mirroring configuration but cannot be added to an existing or new SQL Server 2008 or later
    mirroring configuration.
    A witness can run on any reliable computer system that supports any of these editions of SQL Server. However, we recommend that every server instance that is used as a witness correspond to the minimum configuration that is required for the SQL Server Standard
    version that you are running. For more information about these requirements
    http://technet.microsoft.com/en-us/library/ms175191.aspx#SwHwRecommendations
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How can I make one computer server at Home for access of SQL Server 2012/2008

    Hi All,
    Sorry for this basic question but I am zero in networking. I will be very grateful if someone guides what should I do to make one of my home PC as server. Scenario is as follows:
    I want to give training to few students about SQL SERVER T-SQL.
    I have one Laptop using SQL Server 2012 having Windows 7 Pro(Laptop Master-want to make this server). I have other laptop running Windows 7 pro and got SQL SERVER 2008. My students have mix of laptops including Windows XP, Windows Vista, Windows 7 and Windows
    8. All students have SQL SERVER 2008 installed and working.
    Q1: I actually want to make Laptop Master(explained in above paragraph) as server and want other laptops to access that master server in home network. I will install sample exercise database on server and students will be writing queries to access
    data.
    Q2: can I secure sample database from students who can copy sample database from server?
    Q3: can students run queries remotely sitting their home?
    Thanks in advance.
    Kind Regards
    A K
    Adnan

    Hi itsadnan,
    According to your description, if you want to make your Laptop as Server, and your student can log in your SQL Server 2012 instance, you need to ensure that your computer and student’s computers are the same domain, and you enable TCP/IP, name pipes protocol
    in SQL Server Configuration Manager, your SQL Server 2012 instance is allowed to connect remotely and your student install SQL Server Manager Studio 2012 as client tool in their computer, and you create the related login name for your students. For more information,
    see:
    http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx
    According to your requirement, in actual, since your students install SQL Server 2008 on their computer, you totally can ask your student to install the sample exercise database in their SQL Server. For example, there are many resource about sample database
    in Website, which is helpful for student to learn database technology, such as
    AdventureWorks databases for SQL Server 2008. From SQL Server Management Studio, they can attach an AdventureWorks database, then write queries to access data.
    Since you have SQL Server 2008 in your other laptop, you can create the sample exercise database, and student can install this database via backup and restore, then write queries to access data and send to you for checking if it is right.
    Note:  Due to backwards compatibility, The students could not restore SQL Server 2012 database in their SQL Server 2008 instance.
    Thanks,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • XML Schema Collection (SQL Server 2012): How to create an XML Schema Collection that can be used to Validate a field name (column title) of an existing dbo Table of a Database in SSMS2012?

    Hi all,
    I used the following code to create a new Database (ScottChangDB) and a new Table (marvel) in my SQL Server 2012 Management Studio (SSMS2012) successfully:
    -- ScottChangDB.sql saved in C://Documents/SQL Server XQuery_MacLochlainns Weblog_code
    -- 14 April 2015 09:15 AM
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'ScottChangDB')
    DROP DATABASE ScottChangDB
    GO
    CREATE DATABASE ScottChangDB
    GO
    USE ScottChangDB
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL, [ID] INT NULL)
    INSERT INTO marvel
    (avenger_name,ID)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8);
    SELECT avenger_name FROM marvel ORDER BY ID For XML PATH('')
    DECLARE @x XML
    SELECT @x=(SELECT avenger_name FROM marvel ORDER BY ID FOR XML PATH('Marvel'))--,ROOT('root'))
    SELECT
    person.value('Marvel[4]', 'varchar(100)') AS NAME
    FROM @x.nodes('.') AS Tbl(person)
    ORDER BY NAME DESC
    --Or if you want the completed element
    SELECT @x.query('/Marvel[4]/avenger_name')
    DROP TABLE [marvel]
    Now I am trying to create my first XML Schema Collection to do the Validation on the Field Name (Column Title) of the "marvel" Table. I have studied Chapter 4 XML SCHEMA COLLECTIONS of the book "Pro SQL Server 2008 XML" written by
    Michael Coles (published by Apress) and some beginning pages of XQuery Language Reference, SQL Server 2012 Books ONline (published by Microsoft). I mimicked  Coles' Listing 04-05 and I wanted to execute the following first-drafted sql in
    my SSMS2012:
    -- Reference [Scott Chang modified Listing04-05.sql of Pro SQL Server 2008 XML by Michael Coles (Apress)]
    -- [shcColes04-05.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress]
    -- [executed: 2 April 2015 15:04 PM]
    -- shcXMLschemaTableValidate1.sql in ScottChangDB of SQL Server 2012 Management Studio (SSMS2012)
    -- saved in C:\Documents\XQuery-SQLServer2012
    tried to run: 15 April 2015 ??? AM
    USE ScottChangDB;
    GO
    CREATE XML SCHEMA COLLECTION dbo. ComplexTestSchemaCollection_all
    AS
    N'<?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="marvel">
    <xsd:complexType>
    <xsd:all>
    <xsd:element name="avenger_name" />
    <xsd:element name="ID" />
    </xsd:all>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>';
    GO
    DECLARE @x XML (dbo. ComplexTestSchemaCollection_all);
    SET @x = N'<?xml version="1.0"?>
    <marvel>
    <avenger_name>Thor</name>
    <ID>4</ID>
    </marvel>';
    SELECT @x;
    GO
    DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_all;
    GO
    I feel that drafted sql is very shaky and it needs the SQL Server XML experts to modify to make it work for me. Please kindly help, exam the coding of my shcXMLTableValidate1.sql and modify it to work.
    Thanks in advance,
    Scott Chang

    Hi Scott,
    2) Yes, FOR XML PATH clause converts relational data to XML format with a specific structure for the "marvel" Table. Regarding validate all the avenger_names, please see below
    sample.
    DECLARE @x XML
    SELECT @x=(SELECT ID ,avenger_name FROM marvel FOR XML PATH('Marvel'))
    SELECT @x
    SELECT
    n.value('avenger_name[1]','VARCHAR(99)') avenger_name,
    n.value('ID[1]','INT') ID
    FROM @x.nodes('//Marvel') Tab(n)
    WHERE n.value('ID[1]','INT') = 1 -- specify the ID here
    --FOR XML PATH('Marvel')  --uncommented this line if you want the result as element type
    3)i.check the xml schema content
    --find xml schema collection
    SELECT ss.name,xsc.name collection_name FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    select * from sys.schemas
    --check the schema content,use the name,collection_name from the above query
    SELECT xml_schema_namespace(N'name',N'collection_name')
    3)ii. View can be viewed as virtual table. Use a view to list the XML schema content.
    CREATE VIEW XSDContentView
    AS
    SELECT ss.name,xsc.name collection_name,cat.content
    FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    CROSS APPLY(
    SELECT xml_schema_namespace(ss.name,xsc.name) AS content
    ) AS cat
    WHERE xsc.name<>'sys'
    GO
    SELECT * FROM XSDContentView
    By the way, it would be appreciated if you can spread your questions into posts. For any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Update error of SQL Server 2012 enterprise running on Windows server 2008 standard SP2 (32 bits)

    Hi there;
    I have a windows server 2008 SP2 (32bits) in which I have an instance of SQL Server
    2008 and another of 2012.
    My Windows server 2008 installed the following updates; (see below).
    (KB2898858),(KB2909921),(KB890830),(KB2898869),(KB2911502),(KB2901126),
    (KB2916036),(KB2862973),(KB2901113)
    After the machine was re-started, I was not abble to connect
    to the instance of SQL Server 2012.  I am able
    to connect to the instance of SQL Server 2008.
    The error message I get when I atemp to connect can be found
    at the end of the list of updates below.
    Do I need to uninstall an update? if so, which one and how do I do that?
    Thanks        Gabriel I. Ruiz
    Security Update for Microsoft .NET Framework 2.0 SP2 on Windows Vista SP2 and Windows Server 2008 SP2 x86 (KB2898858)
    Installation date: ‎2/‎12/‎2014 11:42 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2898858
    Cumulative Security Update for Internet Explorer 9 for Windows Server 2008 (KB2909921)
    Installation date: ‎2/‎12/‎2014 11:42 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2909921
    Windows Malicious Software Removal Tool - February 2014 (KB890830)
    Installation date: ‎2/‎12/‎2014 11:41 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/890830
    Security Update for Microsoft .NET Framework 4.5.1 on Windows 7, Windows Vista and Windows Server 2008 x86 (KB2898869)
    Installation date: ‎2/‎12/‎2014 11:40 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2898869
    Security Update for Microsoft .NET Framework 2.0 SP2 on Windows Vista SP2 and Windows Server 2008 SP2 x86 (KB2911502)
    Installation date: ‎2/‎12/‎2014 11:36 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2911502
    Security Update for Microsoft .NET Framework 4.5.1 on Windows 7, Windows Vista, and Windows Server 2008 x86 (KB2901126)
    Installation date: ‎2/‎12/‎2014 11:36 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2901126
    Security Update for Windows Server 2008 (KB2916036)
    Installation date: ‎2/‎12/‎2014 11:34 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2916036
    Security Update for Windows Server 2008 (KB2862973)
    Installation date: ‎2/‎12/‎2014 11:34 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2862973
    Security Update for Microsoft .NET Framework 2.0 SP2 on Windows Vista SP2 and Windows Server 2008 SP2 x86 (KB2901113)
    Installation date: ‎2/‎12/‎2014 11:34 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2901113
    ===================================
    Cannot connect to HAVANA\HAVANA_2012_1ST.
    ===================================
    The client was unable to establish a connection because of an error during connection initialization process before login. Possible causes include the following:  the client tried to connect to an unsupported version of SQL Server; the server was too busy
    to accept new connections; or there was a resource limitation (insufficient memory or maximum allowed connections) on the server. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (.Net SqlClient Data Provider)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476
    Server Name: HAVANA\HAVANA_2012_1ST
    Error Number: 233
    Severity: 20
    State: 0
    Program Location:
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle, SNIPacket packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock)
       at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
       at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
       at System.Data.SqlClient.TdsParser.SendPreLoginHandshake(Byte[] instanceName, Boolean encrypt)
       at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
       at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
       at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer
    timeout)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance,
    SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
       at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
       at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
       at System.Data.SqlClient.SqlConnection.Open()
       at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
       at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
    ===================================
    No process is on the other end of the pipe

    Hi,
    Check if SQL Server service is running fine. I doubt you may have changed the user account password used for SQL Server service. After restarting the machine, you also need to update the user account of SQL Server service in Configuration
    Manager. Re-type the user account name and password under Log on tab and see how it helps.
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Difference between database features - SQL Server 2008 R2 navtive vs SQL Server 2012 with SQL Server 2008 compatibility set?

    I am investigating the impact of upgrading from SQL Server 2008 R2 to SQL Server 2012. To reduce the impact of the upgrade, I am planning to restore / create our application database onto SQL Server 2012 with compatibility level 100 (SQL Server 2008 and
    SQL Server 2008 R2).
    Are there any differences in feature support for database running in native mode on SQL Server 2008 R2 vs a database installed on SQL Server 2012 with compatibility level 100 set?

    Are there any differences in feature support for database running in native mode on SQL Server 2008 R2 vs a database installed on SQL Server 2012 with compatibility level 100 set?
    Yes there can be difference and impact there are few features deprecated in SQL Server 2012 you must be aware about that. Please see
    Deprecated Database Features in SQL Server 2012
    Deprecated SQL Server features in SQL Server 2012
    After you migrate database to 2012 please don't move ahead with production unless you have tested your application to new created database
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • After installed SP1 for SQL Server 2012, can no longer export to csv

    After installing SP1 today via Windows Update, I am no longer able to export data to csv using the SQL Server Import and Export wizard. I get the following error message:
    "Column information for the source and the destination data could not be retrieved, or the data types of source columns were not mapped correctly to those available on the destination provider."
    "Column "col1": Source data type "200" was not found in the data type mapping file."...
    (The above line repeats for each column)
    The work-around I have to do is to manually map each column in the "Edit Mappings..." option from the "Configure Flat File Destination" page of the wizard. This is an extreme inconvenience to have to have to edit the mappings and change
    each column to "string [DT_STR]" type from "byte stream [DT_BYTES]" type each time I want to export to csv. I did not have to do this before installing SP1; it worked perfectly for months with hundreds of exports prior to this update and
    no need to modify mapping.

    I am running Windows 7 64-bit, SQL Server 2012 Express edition. Again, just yesterday from Windows Update, I installed SQL Server 2012 Service Pack 1 (KB2674319), followed by Update Rollup for SQL Server 2012 Service Pack 1 (KB2793634). This situation was
    not occurring before these updates were installed, and I noticed it immediately after they were installed (and of course I restarted my computer after the updates).
    In SSMS I just now created a test DB and table to provide a step-by-step with screenshots.
    Here is the code I ran to create the test DB and table:
    CREATE DATABASE testDB;
    GO
    USE testDB;
    GO
    CREATE TABLE testTable
    id int,
    lname varchar(50),
    fname varchar(50),
    address varchar(50),
    city varchar(50),
    state char(2),
    dob date
    GO
    INSERT INTO testTable VALUES
    (1,'Smith','Bob','123 Main St.','Los Angeles','CA','20080212'),
    (2,'Doe','John','555 Rainbow Ln.','Chicago','IL','19580530'),
    (3,'Jones','Jane','999 Somewhere Pl.','Washington','DC','19651201'),
    (4,'Jackson','George','111 Hello Cir.','Dallas','TX','20010718');
    GO
    SELECT * FROM testTable;
    Results look good:
    id    lname    fname    address    city    state    dob
    1    Smith    Bob    123 Main St.    Los Angeles    CA    2008-02-12
    2    Doe    John    555 Rainbow Ln.    Chicago    IL    1958-05-30
    3    Jones    Jane    999 Somewhere Pl.    Washington    DC    1965-12-01
    4    Jackson    George    111 Hello Cir.    Dallas    TX    2001-07-18
    In Object Explorer, I right-click on the [testDB] database, choose "Tasks", then "Export Data..." and the SQL Server Import and Export Wizard appears. I click Next to leave all settings as-is on the "Choose a Data Source" page, then on the "Choose a Destination"
    page, under the "Destination" drop-down I choose "Flat File Destination" then browse to the desktop and name the file "table_export.csv" then click Next. On the "Specify Table Copy or Query" page I choose "Write a query to specify the data to transfer" then
    click Next. I type the following SQL statement:
    SELECT * FROM testTable;
    When clicking the "Parse" button I get the message "This SQL statement is valid."
    On to the next page, "Configure Flat File Destination" I try leaving the defaults then click Next. This is where I am getting the error message (see screenshot below):
    Then going to the "Edit Mappings..." option on the "Configure Flat File Destination" page, I see that all columns which were defined as varchar in the table are showing as type "byte stream [DT_BYTES]", size "0", the state column which is defined as char(2)
    shows correctly however with type "string [DT_STR]", size "2" (see screenshow below):
    So what I have to do is change the type for the lname, fname, address and city columns to "string [DT_STR]", then I am able to proceed with the export successfully. Again, this just started happening after installing these updates. As you can imagine, this
    is very frustrating, as I do a lot of exports from many tables, with a lot more columns than this test table.
    Thanks for your help.

Maybe you are looking for