SQL Server 2012 Import-Module 'sqlps' breaks the "Test-Path" PowerShell cmdlet

I've run into something that is "very" frustrating with the new SQL Server 2012 PowerShell module.  When I Import the module, it breaks the "Test-Path" cmdlet when trying to test a UNC path to a directory.
For example:  
"Test-Path -path \\server\dirname" returns true as expected before the sqlps module is imported.  But after you import the SQL Server module "Import-Module 'sqlps' –DisableNameChecking" the same Test-Path
now returns false.
If I run the following in Windows PowerShell ISE I see the following results:
Test-Path -path "\\server\directoryname"
Import-Module 'sqlps' –DisableNameChecking
Test-Path -path "\\server\directoryname"
True
False
Anyone have any idea what's going on?
UPDATE: after more testing, it looks like the problem happens with any cmdlet that references a UNC.  The New-Item has the same problem.  Before importing 'sqlps', New-Item is able to create a directory at the UNC path specified, but ater importing
'sqlps', the New-Item fails.
Thanks!

Hi Mikea730,
Sqlps.exe doesn't take advantage of a couple of these nice PowerShell V2 cmdlets without doing a bit of configuring in your environment. 
Please refer to the following references to make some configuration in your server
http://www.maxtblog.com/2010/11/denali-get-your-sqlpsv2-module-set-to-go/
http://www.simple-talk.com/sql/database-administration/practical-powershell-for-sql-server-developers-and-dbas-%E2%80%93-part-1/
http://sev17.com/2010/07/making-a-sqlps-module/
Thanks,
TechNet Subscriber Support
If you are
TechNet Subscription user and have any feedback on our support quality, please send your feedback
here.
Iric Wen
TechNet Community Support

Similar Messages

  • SQL Server 2012: Import and Export Wizard - Exporting Multiple Result Sets at Once?

    I'm working in SQL Server 2012 trying to export some data from our database into an Excel file. My SQL statement has two separate Select statements. They are not joined by a union. When I Execute them inside of SQL Server Management Studio, with Results
    set to go to a Grid, I get two result sets back. Two full tables of data.
    However, when I use the Import and Export Wizard, the Excel sheet only has the first set of data.
    What do I need to do to have it so both result sets show up in the excel file?

    Why cant use merge them using union/union all if intention is to get them to same sheet? Is it like the metadata is different so that they cant be merged to single sheet?
    If that being the case you need to do it in two steps. 
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • RDL Reports are not working after installing SQL Server 2012 Service Pack 2 in the SharePoint integration Mode

    I am using Reporting Service Integration mode with SharePoint. SSRS is installed on separated machine of SharePoint stacks in Integration Mode. Everything was working properly and I could create/edit/modify RDL reports(parameters, Datasource, Subscription)
    inside SharePoint and Document Libraries.
    But after installing SQL Server 2012 Service Pack 2, on opening RDL reports inside SharePoint I receive this error message. 
    The permissions granted to user 'i:0#.f|membership|username' are insufficient for performing this operation. ---> Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to user 'i:0#.f|membership|username' are insufficient for performing this operation
    I should mention that SSRS is installed in the SharePoint integration Mode and there is no SSRS management console.

    Hi Hedayat-Abedijoo,
    According to your description, you are using Reporting Services in SharePoint Integrated mode, and everything worked fine before you install SQL Server 2012 Service Pack 2. After the package is installed, when you open RDL reports, the error occurred: The
    permissions granted to user 'i:0#.f|membership|username' are insufficient for performing this operation.
    According to my search, there may be two reasons for the problem:
    This is caused when the application pool account that runs the SharePoint Web application you are on in IIS and the application pool account that SharePoint believes is running the site differ. This happens if the application pool account is changed directly
    in IIS instead of through SharePoint (using the approved method).
    This error can be caused when Kerberos authentication has been set up correctly and delegation in a double hop scenario will succeed, but Reporting Services integration has been set up for Trusted Account rather than Windows Authentication. This causes
    SharePoint to continue to impersonate the logged-on user when contacting Reporting Services; when Reporting Services compares the application pool account to the user account making the request, they are not equal.
    In this case, we can solve the problem by changing the application pool account in IIS back to the previous account and set AuthenticationTypes to RSWindowsNTLM only. For detail information, please refer to 8.3 “The permissions granted to user 'Domain\User'
    are insufficient for performing this operation” in the document:http://msdn.microsoft.com/en-us/library/ee384252(SQL.100).aspx
    If you have any questions, please feel free to let me know.
    Thanks,
    Wendy Fu

  • SQL Server 2012 Express - Could not load the file or assembly 'Microsoft.VisualStudio.OLE.Interop

    Windows 7 Home Premium, SP1
    64-bit
    I just installed SQL Server 2012 express - Express with Advanced Services (contains the database engine, Express Tools, Reporting Services, and Full Text Search),
    file name -  SQLEXPRADV_x64_ENU.
    Opening SQL Server Management Studio causes the error -
    "Could not load the file or assembly 'Microsoft.VisualStudio.OLE.Interop,
    Version=7.1.40304.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
    system cannot find the file specified."
    Do I need to install another file? Did I download the wrong version?
    Any suggestions? Thanks for any help.

    Hello,
    The issue may occure when the installation of your SQL Server is not a complete or a successful one. Did you try to repair or reinstall the SQL Server Express?  You can also try to install
    Service Pack 1 for SQL Server 2012
    to check if the issue presists.
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • SSMS.exe for SQL Server 2012 is getting Application Error: The exception unknown software exception (0xe0434352) occurred in the application at location 0x75c5c42d.

    SQL Server 2012 Management Studio attempting to log into a SQL Server 2012 instance on a remote server using SQL Authenticated login.
    What does this error mean and what can I do to fix it?
    Thanks in advance!

    Hi Nick,
    Have you seen any additionally information from Windows Event Viewer?
    Based on my research, exception code e0434352  is the exception code used internally by the CLR to represent most exceptions(*), it could mean anything. If you want to find out exactly what the real error is, please review this
    blog.
    In addition, in such case, Microsoft .Net Framework may need to be updated or repaired on your computer. For more details, you can refer to the following similar thread.
    http://answers.microsoft.com/en-us/windows/forum/windows8_1-performance/the-exception-unknown-software-exception/f1404ce4-cdbe-4758-aa19-bad55fcc099c
    Thanks,
    Lydia Zhang

  • SQL Server 2012 and guest access to the MSDB database

    Hello!
    Today we were given a vulnerability scan on one of our SQL Server 2012 systems and it is flagging the following issue:
    Guest is not disabled on the msdb database.
    I pointed our security team to the following article:
    https://support.microsoft.com/en-us/kb/2539091
    My question on this:
    Other than the three cases outlined, are there other possible implications of disabling guest on the msdb database?  Can you point me to a reference that states one way or the other if guest needs to be disabled on msdb?
    I do not like the thought of applying this change blindly and I am afraid of a potential issue caused in some other part of our application that we cannot account for down the road.
    Any info would be much appreciated.
    Thanks!
    -Bill S.

    Hello,
    Possible issues when SQL logins try to connect to a database.
    https://connect.microsoft.com/SQLServer/feedback/details/559791/if-you-disable-guest-user-in-msdb-it-causes-issues-with-a-sql-login-sql-2008
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • SQL server 2012 Import and Export Wizard missing Flat File Options

     When using either the 32 or 64 bit Import & Export wizard selecting   data source "flat file source" no options appear,  compared to excel import , sql or another data source ? tried uninstalling etc, build a VM 2008
    Server works fine options appear. Any sugguestions before I rebuild my laptop ?
    Stage that the Next button is optional, (usually greyed out)
    TITLE: SQL Server Import and Export Wizard
    The operation could not be completed.
    ADDITIONAL INFORMATION:
    The server name is not specified. (DTSWizard)
    BUTTONS:
    OK
    Microsoft.SqlServer.Management.UI.WizardFrameworkErrorSR 

    Hi mtech,
    When I open Import and Export Data(64-bit), I choose “flat file source”.
    Maybe you could try to reinstall it.
    If you have any feedback on our support, please click
    here.
    Thanks.
    Maggie Luo
    TechNet Community Support

  • It is there an alternative to the Test-SystemHealth powershell cmdlet for Exchange 2013?

    Hello
    The Powershell cmdlet Test-SystemHealth, that was available on Exchange 2010, is no longer available on Exchange 2013.
    Test-SystemHealth cmdlet gathered data about the Microsoft Exchange system and analyzed the data according to best practices.
    Are there any alternatives to this for Exchange 2013?
    Thanks!

    Haven't really played with it too much, but check out Get-ServerHealth
    http://technet.microsoft.com/en-us/library/jj218703(v=exchg.150).aspx
    Looks to have replaced Test-SystemHealth.

  • Import MS Access 2013 tables into SQL Server 2012

    Hi there,
    Is there a step by step example somewhere showing how to import an MS Access 2013 table into SQL Server 2012?
    I have read the existing posts and don't see a definitive answer.
    I have installed MS Access 2010 engine, first 32 bit then 64 bit.
    I have installed the MS Access 2013 runtime on my server.
    I use the Office 2015 Access Database Engine OLE DB Provider.
    I get the error:
    Error 0xc0202009: Source - APEntries [1]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E37.
    Error 0xc02020e8: Source - APEntries [1]: Opening a rowset for "`TableName`" failed. Check that the object exists in the database.
    The post regarding the above errors doesn't resolve the issue.
    I have full administrative permissions on the server.
    What is the trick to making this work?
    Thanks,
    Ric
    Ric Miller

    Hi there,
    I tried the exact same operation on a third machine.
    This machine has Windows 8.1 64 bit, SQL Server 2012 64 bit, MS Office 2013 Plus 32 bit.
    I am the administrator on this machine.
    I installed this:
    Microsoft Access Database Engine 2010 Redistributable 32 bit (because I have MS Office 2013 plus 32 bit installed.)
    From here:
    http://www.microsoft.com/en-us/download/details.aspx?id=13255
    It won't let me install the 64 bit version without uninstalling MS Office 32 bit.
    I created an MS Access database on this machine using MS Access 2013 and created a table with 3 records.
    I used the "Import and Export Data (32 bit)" from the start menu.
    After I installed the "Database Engine 2010 32 bit" driver above, I now have the option of "Office 2015 Access Database Engine OLE DB Provider" as Data Source which I did not have prior to doing this installation.
    I selected the driver and added the Properties of the Data Source Name file location of the MS Access file. I am using a blank password.
    I go thru the same sequence of selecting a table to import and after running the result is the same:
    Error 0xc0202009: Source - APEntries [1]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E37.
    "Error 0xc02020e8: Source - APEntries [1]: Opening a rowset for "`TableName`" failed. Check that the object exists in the database."
    This seems to be consistent across three machines with three operating systems with the same files and the same result.
    I understand that some people have gotten this to work.
    I would appreciate it if anyone can report an error in the above procedure to me.
    Thanks,
    Ric
    Ric Miller

  • SQL Server 2012 Management Studio:Importing XML file to new Table of new Database-XML parsing: unexpected end of input???

    Hi all,
    In the Notepad, I created an xml file (ZenQroducts.xml) :
    <Qroducts>
    <Qroduct>
    <SKU>1</SKU>
    <Desc>Book</Desc>
    </Qroduct>
    <Qroduct>
    <SKU>2</SKU>
    <Desc>DVD</Desc>
    </Qroduct>
    <Qroduct>
    <SKU>3</SKU>
    <Desc>Video</Desc>
    </Qroduct>
    In my SQL Server 2012 Management Studio, I executed the following code:
    --to create a new object Qroducts in a new database OPENXMLtesting
    CREATE DATABASE OPENXMLtesting
    GO
    CREATE TABLE Qroducts(
    sku INT Primary KEY,
    qroduct_desc VARCHAR(30));
    INSERT INTO Qroducts (sku, qroduct_desc)
    SELECT X.qroduct.query('SKU').value('.', 'INT'),
    X.qroduct.query('Desc').value('.', 'VARCHAR(30)')
    FROM (
    SELECT CAST(x AS XML)
    FROM OPENROWSET(
    BULK 'H:\ZenQroducts.xml',
    SINGLE_BLOB) AS T(x)
    ) AS T(x)
    CROSS APPLY x.nodes('Qroducts/Qroduct') AS X(qroduct);
    SELECT sku, qroduct_desc
    FROM Qroducts;
    I got the following message:
    Msg 9400, Level 16, State 1, Line 6
    XML parsing: line 13, character 12, unexpected end of input
    I have no ideas why I got this "XML parsing:line 13, character12, unexpected end of input" message. Please kindly help, advise me on where I made mistake and how I can resolve this problem, and respond in this Forum.
    Thanks in advance,
    Scott Chang
     

    Hi Manish, Thanks for your response.
    Yes, it is a duplicate with Qroducts/Qroduct instead of Products/Product. I did it, because I don't know how to remove the existing "Products" database.
    Again, I got the existing "Qroducts" database in this second trial!!??  I am comletely lost in doing "Importing XML file to SQL Table" now!!  I think that I have not touched T-SQL and XML programming, since 2008. I
    did not catch the new features of T-SQL 2008, XML, SQL/XML, XQuery, etc. for long time. Recently, I did not know what DECLARE, @x, SET,...were, and dived into the SQL/XML and XQuery programming. I knew the SQL Basics (SELECT, FROM, WHERE,..), creating
    the names of databases and tables in SQL Server 2008/2012 Management Studio (Express) before. This morning, I found an old T-SQL 2008 Prgrammer's Guide that has the new features of SQL Server 2008 for T-SQL, XML, XQuery, etc. I just starting reading
    it to know what DECLARE, @x, SET,... are. But, I still don't know where the existing databases "Products" and "Qroducts" (created by me) are - they are not in the Databases of SQL Server 2012 Management Studio I am using!!??  Could
    you please kindly point out where the "Products" and "Qroducts" databases are?
    Prashanth responded to my posted question too and he asked to to try his code: DECLARE @xml XML, SELECT @xml =' <Qroducts>.....SELECT product.value.....FROM @XML.nodes.....AS.... I just learned that his code is doing the thing we
    want to do and print the results below the SQL Query. This is not what I need in doing my SQL/XML programming. I am reading/studying the new (2008) features of T-SQL, XQuery 1.0: An XML Query Language (Second Edition), and Microsoft XQuery Language Reference
    (SQL Server 2012 Books Online) closely now. I hope that I can resume the T-SQL, XML Query, SQL/XML, XQuery in my SQL Server 2012 Management Studio soon.
    Please tell me  where the existing databases "Products" and "Qroducts" I created in my previous trials in my SQL Server 2012 Management Studio.  This is what I need to know and to delete them, before I do this kind of "Importing
    XML file to Table of SQL Server 2012 Management Studio"  programming again.
    Please kindly help, advise and respond again.
    Many Thanks,
    Scott Chang

  • Import data from Informix DB to SQL Server 2012

    I am trying to use the SSIS Import and Export Wizard in SQL Server Data Tools to migrate an Informix database to SQL Server 2012.  I go through the steps & when I hit Finish I get an error message that says:
    TITLE: SQL Server Import and Export Wizard
    Could not connect source component.
    Error 0xc0047062: Source - material [1]: System.Data.Odbc.OdbcException (0x80131937): ERROR [42000] [Informix][Informix ODBC Driver][Informix]A syntax error has occurred.
       at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
       at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
       at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
       at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
       at System.Data.Odbc.OdbcCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
       at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.ReinitializeMetaData()
       at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostReinitializeMetaData(IDTSManagedComponentWrapper100 wrapper)
    ADDITIONAL INFORMATION:
    ERROR [42000] [Informix][Informix ODBC Driver][Informix]A syntax error has occurred. (iclit09b.dll)
    BUTTONS:
    OK
    I am getting this error when I use the "Copy data from one or more tables or views" option.  I am able to migrate a single table with no problem when I use the "Write a query to specify the data to transfer"
    option.  This is my first time using SSIS so I am not sure what to do.  Can anyone help me out?  Thanks...

    The following link explains the steps/processes requires to perform this in SSIS:
    http://davidbridge.wordpress.com/2012/05/30/extraction-from-informix-database-using-ssis-data-warehouse-etl/
    Thanks, hsbal

  • Unable to install sql server 2012 eval edition with the downloaded files

    Error which I get when i try to launch the installer 
    I  have downloaded them in a single folder 
    Note : windows os is win 7 with sp1
    Mudassar

    TITLE: Microsoft SQL Server 2012 Service Pack 1 Setup
    The following error has occurred:
    Unable to open Windows Installer file 'C:\Users\mabdu1\Downloads\SQLServer2012SP1-FullSlipstream-ENU-x64\x64\setup\sql_engine_core_inst_msi\sql_engine_core_inst.msi'.
    Windows Installer error message: The system cannot open the device or file specified.
    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%20SQL%20Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3000.0&EvtType=0xDC80C325
    BUTTONS:
    &Retry
    Cancel
    Now I am getting this error after I downloaded 2012 sp1 iso and extracted it to do the installation
    Mudassar

  • SQL Server 2012 Management Studio:In the Database, how to print out or export the old 3 dbo Tables that were created manually and they have a relationship for 1 Parent table and 2 Child tables?How to handle this relationship in creating a new XML Schema?

    Hi all,
    Long time ago, I manually created a Database (APGriMMRP) and 3 Tables (dbo.Table_1_XYcoordinates, dbo.Table_2_Soil, and dbo.Table_3_Water) in my SQL Server 2012 Management Studio (SSMS2012). The dbo.Table_1_XYcoordinates has the following columns: file_id,
    Pt_ID, X, Y, Z, sample_id, Boring. The dbo.Table_2_Soil has the following columns: Boring, sample_date, sample_id, Unit, Arsenic, Chromium, Lead. The dbo.Table_3_Water has the following columns: Boring, sample_date, sample_id, Unit, Benzene, Ethylbenzene,
    Pyrene. The dbo.Table_1_XYcoordinates is a Parent Table. The dbo.Table_2_Soil and the dbo.Table_3_Water are 2 Child Tables. The sample_id is key link for the relationship between the Parent Table and the Child Tables.
    Problem #1) How can I print out or export these 3 dbo Tables?
    Problem #2) If I right-click on the dbo Table, I see "Start PowerShell" and click on it. I get the following error messages: Warning: Failed to load the 'SQLAS' extension: An exception occurred in SMO while trying to manage a service. 
    --> Failed to retrieve data for this request. --> Invalid class.  Warning: Could not obtain SQL Server Service information. An attemp to connect to WMI on 'NAB-WK-02657306' failed with the following error: An exception occurred in SMO while trying
    to manage a service. --> Failed to retrieve data for this request. --> Invalid class.  .... PS SQLSERVER:\SQL\NAB-WK-02657306\SQLEXPRESS\Databases\APGriMMRP\Table_1_XYcoordinates>   What causes this set of error messages? How can
    I get this problem fixed in my PC that is an end user of the Windows 7 LAN System? Note: I don't have the regular version of Microsoft Visual Studio 2012 in my PC. I just have the Microsoft 2012 Shell (Integrated) program in my PC.
    Problem #3: I plan to create an XML Schema Collection in the "APGriMMRP" database for the Parent Table and the Child Tables. How can I handle the relationship between the Parent Table and the Child Table in the XML Schema Collection?
    Problem #4: I plan to extract some results/data from the Parent Table and the Child Table by using XQuery. What kind of JOIN (Left or Right JOIN) should I use in the XQuerying?
    Please kindly help, answer my questions, and advise me how to resolve these 4 problems.
    Thanks in advance,
    Scott Chang    

    In the future, I would recommend you to post your questions one by one, and to the appropriate forum. Of your questions it is really only #3 that fits into this forum. (And that is the one I will not answer, because I have worked very little with XSD.)
    1) Not sure what you mean with "print" or "export", but when you right-click a database, you can select Tasks from the context menu and in this submenu you find "Export data".
    2) I don't know why you get that error, but any particular reason you want to run PowerShell?
    4) If you have tables, you query them with SQL, not XQuery. XQuery is when you query XML documents, but left and right joins are SQL things. There are no joins in XQuery.
    As for left/right join, notice that these two are equivalent:
    SELECT ...
    FROM   a LEFT JOIN b ON a.col = b.col
    SELECT ...
    FROM   b RIGHT JOIN a ON a.col = b.col
    But please never use RIGHT JOIN - it gives me a headache!
    There is nothing that says that you should use any of the other. In fact, if you are returning rows from parent and child, I would expect an inner join, unless you want to cater for parents without children.
    Here is an example where you can study the different join types and how they behave:
    CREATE TABLE apple (a int         NOT NULL PRIMARY KEY,
                        b varchar(23) NOT NULL)
    INSERT apple(a, b)
       VALUES(1, 'Granny Smith'),
             (2, 'Gloster'),
             (4, 'Ingrid-Marie'),
             (5, 'Milenga')
    CREATE TABLE orange(c int        NOT NULL PRIMARY KEY,
                        d varchar(23) NOT NULL)
    INSERT orange(c, d)
       VALUES(1, 'Agent'),
             (3, 'Netherlands'),
             (4, 'Revolution')
    SELECT a, b, c, d
    FROM   apple
    CROSS  JOIN orange
    SELECT a, b, c, d
    FROM   apple
    INNER  JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    LEFT   OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    RIGHT  OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    FULL OUTER JOIN orange ON apple.a = orange.c
    go
    DROP TABLE apple, orange
    Erland Sommarskog, SQL Server MVP, [email protected]

  • SQL Server 2012 Management Studio: Import XML File to SQL Table - XML parsing: illegal qualified name character

    Hi all,
    In my SQL Server 2012 Management Studio, I executed the following code:
    CREATE TABLE Products(
    sku INT Primary KEY,
    product_desc VARCHAR(30));
    INSERT INTO Products (sku, product_desc)
    SELECT X.product.query('SKU').value('.', 'INT'),
    X.product.query('Desc').value('.', 'VARCHAR(30)')
    FROM (
    SELECT CAST(x AS XML)
    FROM OPENROWSET(
    BULK 'H:\ZenProducts.xml',
    SINGLE_BLOB) AS T(x)
    ) AS T(x)
    CROSS APPLY x.nodes('Products/Product') AS X(product);
    SELECT sku, product_desc
    FROM Products;
    I got the following message:
    Msg 9455, Level 16, State 1, Line 5
    XML parsing: line 3, character 12, illegal qualified name character
    I have no ideas why the "product" in the statement "SELECT X.product.query('SKU').value('.','INT')" is not legal qualified name charcter!!!???  Please kindly help, advise and respond.
    Thanks in advance,
    Scott Chang

    Hi Manish, Thanks for your response.
    Here is a copy of my ZenProducts.xml:
    <Products>
    <Product>
    <SKU>1<</SKU>
    <Desc>Book</Desc>
    </Product>
    <Product>
    <SKU>2<</SKU>
    <Desc>DVD</Desc>
    </Product>
    <Product>
    <SKU>3<</SKU>
    <Desc>Video</Desc>
    </Product>
    I found the wrong "<<" in my xml file and changed it to the right "<" for the statement<SKU>1</sku>. I executed the corrected code and I got the following new message:
    Msg 2714, Level 16, State 6, Line 1
    There is already an object named 'Products' in the database.
    I don't know how to remove the old, existing the 'Products' object in the database and execute the corrected code again. Please kindly help, advise and tell me how to resolve this new problem.
    Many Thanks,
    Scott Chang
    P. S. I played with another project to get the 'Products' object in my database before. Frankly, I don't know where the old 'Products' object and the database are. Please enlighten me in resolving this matter more clearly.
    You welcome Scott, As Olaf mentioned in this post, there was already a table exists , so need to drop your Products table.
    Apart from this, I guess either you did not pasted the full XML file or what, I needed to have the (  </Products>)closing tag in your XML file as follows.
    <Products>
    <Product>
    <SKU>1</SKU>
    <Desc>Book</Desc>
    </Product>
    <Product>
    <SKU>2</SKU>
    <Desc>DVD</Desc>
    </Product>
    <Product>
    <SKU>3</SKU>
    <Desc>Video</Desc>
    </Product>
    </Products>
    You can use following script to drop if your 
    Products table is already existing.
    if exists(select 1 from sys.tables where name ='Products')
    drop table Products
    CREATE TABLE Products(
    sku INT Primary KEY,
    product_desc VARCHAR(30));
    INSERT INTO Products (sku, product_desc)
    SELECT X.product.query('SKU').value('.', 'INT'),
    X.product.query('Desc').value('.', 'VARCHAR(30)')
    FROM (
    SELECT CAST(x AS XML)
    FROM OPENROWSET(
    BULK 'H:\ZenProducts.xml',
    SINGLE_BLOB) AS T(x)
    ) AS T(x)
    CROSS APPLY x.nodes('Products/Product') AS X(product);
    SELECT sku, product_desc
    FROM Products;
    Let us know if you face any other problem.
    Thanks
    Manish
    Please click Mark as Answer if my post solved your problem and click
    Vote as Helpful if this post was useful.

  • Copy diagram to clipboard for sql server 2012 the row did not appear when paste in paint

    hello,
    i've been trying to create database diagram on my database on sql server 2012 platform. i can create the diagram, but when copy it to clipboard and try to paste it on paint, only the tables name appear without all the columns name. any idea how can i paste
    it to have information for both tables name and columns name as well.i've no issue creating diagram and paste on paint for my sql server 2008.
    Thanks in advance.
    kneeah

    Hi kneeah,
    According to your description, SQL 2012 database diagram is not printed correctly and several of column names are missed. There are some suggestions for troubleshooting this issue, you can refer to the following steps.
    1. We recommend you can copy database diagram to Word and check if it will print correctly.
    2. When printing database diagrams, several of the tables contain large grey squares instead of the column names. We recommend switch Windows XP computer from Classic theme to Windows XP theme, and check if it can print correctly.
    There is more similar issue about printing database diagram, you can review the following posts.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/267da892-c470-4269-854f-c1327746b16c/problem-with-printing-database-diagrams
    http://forums.asp.net/t/1190828.aspx
    Thanks,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

Maybe you are looking for