Code Assist in Management Studio - SQL Server 2012

I'm just getting started with the MS SQL Server 2012 Management Studio. I have been writing SQL for years so the language is not an issue. I am used to an IDE that has a code assistant that offers a list of column names whenever I type a table alias followed
by a dot anywhere in the select list or where clause, assuming I have assigned that alias in the from clause. I think this is called IntelliSense in SSMS world. Whatever it's called, I'm trying to understand this functionality in SSMS.
While working on one of my first queries in Management Studio I have seen this behavior a few times, but it seems very sporadic. Sometimes, after I type the alias and a dot and then start typing a column name, I have seen a list of column names from the
appropriate table, which start with the letters I typed. Sometimes, nothing happens.
In "the other IDE" if I started typing a column name sooner than a set time (e.g. 500 milliseconds) the code assist would not activate, but I could hit the F6 function key and, hey presto, there's the code assist. Is there a way in SSMS to manually
activate the code assistant?
Thanks
Gregory

Hi ThatOtherFella'sBrother,
According to your description, I test the IntelliSense in SQL Server 2012 Management Studio (SSMS) and find IntelliSense is work well. Based on my research, there are several potential reasons why IntelliSense doesn't work as below.
1.Your cursor may be inside a comment or a string literal, where IntelliSense parsing simply doesn't dare to venture.
2.The insertion point is inside a code comment. IntelliSense options are not available when the insertion point is within a comment in your source file.
3.The insertion point is inside a string literal.
4.The automatic options are turned off.
5.Your script isn't too large. SSMS will not try to parse a script that is larger than the size set in Tools > Options > Text Editor > Transact-SQL > IntelliSense > Maximum script size.
6.You may have been denied permissions on the object it may reside in a schema to which you don't have access.
To troubleshoot the issue, please pay attention to the points below.
1.Make sure to enable IntelliSense following the steps in the article:
https://msdn.microsoft.com/en-us/library/ms173743.aspx
2.Improve the value of 'Maximum script size' in Tools > Options > Text Editor > Transact-SQL > IntelliSense > Maximum script size if you are working with a very large script.
3.IntelliSense functionality does not cover database objects created by another connection after your editor window connects to the database. If objects are missing from IntelliSense features such as completion lists, you can choose one of these three mechanisms
below to refresh the cache of objects for your editor window.
a.Select the Edit menu, select IntelliSense, then select Refresh Local Cache.
b.Use the CTRL+Shift+R keyboard shortcut.
c.Disconnect your editor window from the instance of the Database Engine and reconnect.
4.Make sure that you have permissions on the object and the schema of the object.
5.Make sure that the connected instance is SQL Server 2008 or later. Since IntelliSense is only available when the Database Engine Query Editor is connected to an instance of the Database Engine from SQL Server 2008 or later.
There are two connect items for your reference.
https://msdn.microsoft.com/en-us/library/ms173434.aspx
http://www.mssqltips.com/sqlservertip/2591/troubleshooting-intellisense-in-sql-server-management-studio-2012/
Regards,
Michelle Li

Similar Messages

  • Setup closed with exit code: 0x84C40013 - Silent Install error - SQL Server 2012 express management studio SP1

    I am trying to create a silent installation package for SQL Server 2012 Express Management Studio SP1. (both x86 & x64)
    Prior to installation I have performed the following :
    1. Turned ON the Windows feature 'Microsoft .NET Framework 3.5.1' (I had read somewhere on the internet that this is required prior to installation)
    2. Installed Microsoft .NET Framework 4.0
    I am using the following command line to perform an unattended install :
    <EXENAME> /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /FEATURES=Tools 
    However, the installation fails abruptly.
    The application installs successfully with the following command line :
    <EXENAME> /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /FEATURES=Tools
    The error occurs only while attempting to install the application with the /Q switch appended.
    Please help.

    Hello Fanny,
    Thanks for providing the link to the SQL Server 2012 unattended install guide.
    However, I must highlight that I was running the setup.exe with "Run As a Administrator" option and still facing the issue.
    Anyways, I found out the root cause and I must say that it was a rather silly one.
    As I had stated previously, the following command line was causing the issue :
    <EXENAME>
    /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /FEATURES=Tools
    I simply changed it to the following and it worked....
    <EXENAME>
    /QUIET /IACCEPTSQLSERVERLICENSETERMS /ACTION=INSTALL /FEATURES=TOOLS
    It so seems that everything must be in CAPITALS for this to work.
    Regards,
    Soumen

  • Unable to Login SQL server management studio:sql server 2005

    Hello All,
    I am unbale to login SQL server management studio with below scanario:
    Server Type:Database Engine
    Server Name:XXX
    Authntication:Windows Auth
    After enter "Connect : button below eeror is displaying
    Error:"Canot connetc to XXX server
    Additional information:
    Attempted to read or write protected memory .This is an often an indication that the other memory is corrupt(System.Data)
    Note:Database is connecting R3trans return code 0000
    SAP is working fine
    Please provide suggestion and inpuits its very urgent
    Thanks
    Nekkalapu

    HI All,
    Issue resolved after rebooting the server.
    Thanks
    Nekkalapu

  • Can not install Microsoft SQL Server 2012 Express on Win7, 64 bit, used on VS Studio 2010

    I had a Win7 Ultimate 64bit, Intel(R) Core(TM) 2 Duo, 4GB SDRAM, 500GB HDD. I have been used  Visual
    studio 2010, SQL Server 2008 R2 (SQL Management Studio), SQL Server Express2005, SQL Server Express2008, Microsoft Office 2010. I downloaded setup from microsoft.com/en-us/download/details.aspx?id=29062,
    after extract files which it's giving me an error message.
    Anyone help me this issue.
    Other questions is What if I want to use SQL management Studio 2008 R2 and connect SQL Server 2012 on Windows 7 

     I downloaded setup from microsoft.com/en-us/download/details.aspx?id=29062,
    after extract files which it's giving me an error message.
    Anyone help me this issue.
    I'd ask them over here.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlexpress
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • Can't find SQL Server 2012 Configuration Manager

    In my Win8 I can't find SQL Server Configuration Manager.
    I need to connect to an SQL Database using a specific port.
    Does anyone know how to do that?
    Thanks a lot!!

    Hi Lina,
    Did you install multiple SQL Server instances on your local server? We can not configure SQL Server 2012 instance under SQL Server 2008 R2 Configuration Manager.
    If you had installed SQL Server Configuration Manager with SQL Server 2012, you can try to run "sqlservermanager11.msc". If this is not opening then you might not install SQL Server 2012 Configuration Manager.
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click
    here.
    Fanny Liu
    TechNet Community Support

  • Reports & Microsoft SQL Server 2012 Express LocalDB support policy

    Hello,
    Willing to move some databases into Microsoft SQL Server 2012 (2014) Express LocalDB, I have tryed to map some reports on that database.
    Using OLE DB SQL Native Client (v11) and SAP CR RunTime SP10 (>SP9), I still have trouble when using this data source:
    After drawing some simple reports (standard ones with 2-3 fields from the database):
    - VS designer:
    + when "checking database" or "getting a preview" of the report, it always complains about missing tables.
    + when trying to "re-map" tables from one SQL Server 2012 Express LocalDB to another one it fails, complaining about not findind resources.
    - Running application (.NET 4.0, 32 or 64-bits):
    + without any change to the report configuration: CR Viewer complains with multiple error codes (17, ...) that it cannot find the tables
    + trying to change the configured database from the report: CR VIewer complains with some more error codes
    => Is Microsoft SQL Server 2012 Express LocalDB now officially supported by CR ?
    => Is changing datasource/database configuraton during execution now officially supported by CR ?
    Feel free to provide an any links / howto's / white paper about how managing Microsoft SQL Server 2012 Express LocalDB with SAP CR !
    Many thanks in advance.
    Regards.

    Don,
    I did not want you to think that I am not willing to change anything...
    The issue is that LocalDB specs (http://msdn.microsoft.com/en-us/library/ms130822(v=sql.110).aspx) are not (seems not) fulfiled by what SAP APIs provide.
    Following specs, I need to provide ADO DB/SQL Native Client v11 an "AttachDBFileName" property which, for LocalDB instance, is equal to the DatabaseName property (check below screenshot from MS Mgmt Studio connected to a SQL Server 2012 LocalDB instance).
    Moreover, OLEDB discovery provide in CR 2013 UI this same list of "DatabaseName":
    When connected, this same CR 2013 UI got the right "view" of connected "MDF-labelled" names:
    Moreover, CR connected datasource properties also provide an "initial catalog" (databasename) value with that "MDF-labelled" name:
    That is what I saw previously in API dumped objects and what I tryed to reproduce in my code:
    As previously explained, after adding tables, I am also beeing able to add fields from those tables in my fresh-new report document:
    It fikrst shows results in preview but as soon as I try to refresh / add some more fields / ask CR to "check database" / "change database source", the interface always complain about having "lost" objects:
    Site note for Ludek Uher: CR 2013 StandaAlone fresh-new builded reports are not working neither using CR runtime SP10 when opening/updating that report..
    So YES, I am OK to change whatever is required but please explain me what to use/put into the "crConnectioninfo.DatabaseName" property for a SQL Express 2012 LocalDB case.
    Or leave it as is, LocalDB not being supported by CR ...
    (all my reports & c# code are working well while using SQL Express 2012 "classic" (not localdb)).
    Thanks again for your time.
    Regards.

  • Issue installing SQL Server 2012(with SP1) on windows 7 Error result: -2067529718

    When running the installation, it suddenly stops without any error popup.
    I ran the installation from the command prompt and this is what I get:
    An error occurred during the SQL Server 2012 Setup operation.
    Error result: -2067529718
    Result facility code: 1220
    Result error code: 10
    I recently uninstalled SQL Server 2012 SP1, because the SQL server service was not starting up, it would just hang in there with no response. I tried many things to get that issue fixed, finally I decided to uninstall and start fresh but I couldn't since
    I was getting an error stating that I needed Windows 7 SP1(which was already installed). I downloaded the
    microsoft fix it tool which fixed the issue.
    On the control panel/Programs and features, I still see that SQL Server 2012 is listed if I click to uninstall again it tells me:
    An error occurred while trying to uninstall Microsoft SQL Server 2012. it may have already been uninstalled. do you want to remove Microsoft SQL Server 2012 from the Programs and features list?
    if I click yes, eventually it will be listed again.
    currently I'm not able to install SQL server again and besides the info provided there are not error messages (I also copied the installation files to disk).
    UPDATE: it appears that the sql server was not completely removed from the system, I still see listed the SQL server(SQLExpress) and server browser services on the SQL server configuration manager.
    Thanks.

    1) First Reboot your server and try again for the installation.
    2) If first fail again than Take a backup of Registry first for safe side and then delete the entries of SQL server 2012 if found take a reboot again and try to install again.
    One more thing if installation created any file then move/Delete that also before installation.

  • How to join MS SQL Server 2012 to Dreamweaver CS6

    Hello everyone.
    Here's my question: Is it possible to link a Microsoft SQL Server 2012 Database to Dreamweaver CS6, instead of the default MySQL Database?
    I don't particullarily like MySQL because it's interface isn't familiar to me. Instead, I use s way more professional Database Management software, SQL Server 2012. I know that when I try to connect Dreamweaver CS6 to a database, I only have the option to link it to MySQL and I'd like to change it, or at least, to add the SQL Server to the options list. Is there a way to configure that or a kind of Dreamweaver plug-in or extension?
    Please answear.
    Best regards,
    Vlad Drelciuc
    Web Content Developer

    Since you refer to MySQL as the default database, I presume that you're talking about using PHP.
    Yes, you can link to MS SQL Server - as long as you're willing to code everything by hand. If you're looking for automated code generation, though, the answer is no.
    Even the default PHP/MySQL server behaviors are not really worth considering for professional web development. They're fine for quick prototyping, but they use deprecated functions that are not suitable for a production environment.

  • DataBase Migration from SQL server 2005 to SQL server 2012

    What are the challenges and steps to be taken care for proper migration of the Database.
    Applications are using the Visual Studio 2012.
    saikalyan

    Few things that I can think of -
    Verify all logins and users are migrated correctly.
    Some of the SQL Server 2005 features/code could be deprecated in SQL Server 2012. Changes could be required before or after migration.
    Some of the queries could have different performance (better or worse) on 2012 due to changes in query optimizer.
    The applications/SSIS/DTS config files are updated to use the new server/instance name.
    DNS alias names from the old servers (if used) are moved to the new server to have minimal impact on connection strings.
    Plan for downtime of applications and batch processes.
    Notify developers about the migration and the new server name(s)
    - Aalam | (Blog)

  • Can not install Microsoft SQL Server 2012 Express on Win7, 64 bit

    Hi,
    I had a Win7 Ultimate 64bit, Intel(R) Core(TM) 2 Duo 2.8Ghz, 4GB SDRAM, 500GB HDD. I have been used  Visual
    studio 2010, SQL Server 2008 R2 (SQL Management Studio), SQL Server Express2005, SQL Server Express2008, Microsoft Office 2010. I downloaded setup from microsoft.com/en-us/download/details.aspx?id=29062,
    after extract files and run setup which it's giving me an error message.
    "The operation system on this computer or its service pack level does not meet the minimum requirements for SQL server 2012. To determine the minimum required operating system supported for this SQL server release, see Hardward and software
    Requirement for installing SQL server 2012 at: http://go.microsoft.com/fwlink/?LinkID=195092"
    Anyone help me this issue

    it requires a minimum of Windows 7 SP 1 before installing SQL server 2008.
    It can be downloaded from below:
    http://support.microsoft.com/kb/976932/en-us
    For more details check below:
    http://msdn.microsoft.com/en-us/library/ms143506.aspx
    Please click the Mark as answer button and vote as helpful if this reply solves your problem

  • 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

  • SQL Server 2012 Management Studio Displays Error With "New Query" and Intellisense Works Intermittenly

    I was upgrade to SQL Server 2012 and Visual Studio 2010 was upgraded with SP1 the same day.  This is x64 machine. 
    Microsoft SQL Server Management Studio      11.0.2100.60
    Microsoft .NET Framework      4.0.30319.261
    Operating System      6.1.7601
    Problem 1) With SQL Server Management Studio, selecting "New Query" a warning box is displayed: "The 'Microsoft.Practices.EnterpriseLibrary.Configuration.Design.VisualStudioIntegration2010Package, Microsoft.Practices.EnterpriseLibrary.Configuration.Design.VisualStudioIntegration2010,
    Version=1.0.0.0, Culture=netutral, PublicKeyToken=null' package did not load correctly.    The problem mayhave been cuased by a configuration change or by the installation of another extension.  You can get more information by running the
    application together with the /log parameter on the command line, and then examining the file ...\AppDate\Roaming\Microsoft\AppEnv\10.0\ActivityLog.xml'.  Continue to show this error message?
    Problem 2) In a Query Initellisense works intermittently but most of the time it will not display anything.  I have tried Edit|Intellisense|Refresh Cach size and also seperately, Edit | Intellisense | List Members but neither has helped.  Also
    tried different selections for Tools|options| T-SQL | Intellisense| Maximum Script Size; no luck either. 

    Hi WallyJim,
    For your first problem, possible workaround:
    In Programs and Features (or Add/Remove Programs), right click the Microsoft Enterprise Library 5.0 Optional Update 1 program and select change. Remove the VisualStudio2010 integration.
    Then, install the EnterpriseLibrary Configuration extension from Microsoft via the Extension Manager in VS2010. This will allow you to launch the configuration editor from VS2010, but will not be installed for SSMS.
    For more information, please refer to
    https://connect.microsoft.com/SQLServer/feedback/details/620532/error-message-on-new-query-window-opening.
    For your second problem, the following conditions might affect the behavior of IntelliSense:
    There is a code error above the cursor.
    The insertion point is inside a code comment.
    The insertion point is inside a string literal.
    The automatic options are turned off.
    For more information, refer to Troubleshooting IntelliSense (SQL Server Management Studio):
    http://msdn.microsoft.com/en-us/library/ms173434.aspx.
    Thanks,
    Maggie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.

  • 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

  • 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.

  • SQL Server 2012 Management Studio: XML XQuery-query the XML Blob using CTE: How to specify the coorelation name in bulk rowset?

    Hi all,
    I just started doing the XML Xquery programming in my SQL Server 2012 Management Studio. I executed the following code:
    --query the XML Blob using a CTE (pulling from the XML file each time) Products
    WITH XmlFile (Contents) AS (
    SELECT CONVERT (XML, BulkColumn)
    FROM OPENROWSET (BULK 'H:\Products.xml', SINGLE_BLOB) ) AS XmlData
    SELECT *
    FROM XmlFile
    GO
    I got the the following Msg:
    Msg 491, Level 16, State 1, Line 4
    A correlation name must be specified for the bulk rowset in the from clause.
    How can I specify the correction name for the bulk rowset in my project?
    Please kindly help, advise and respond.
    Thanks in advance,
    Scott Chang

    Hello Scott,
    You have to assign a table alias for the OPENROWSET =>
    --query the XML Blob using a CTE (pulling from the XML file each time) Products
    WITH XmlFile (Contents) AS (
    SELECT CONVERT (XML, BulkColumn)
    FROM OPENROWSET (BULK 'H:\Products.xml', SINGLE_BLOB) AS MyXML ) AS XmlData
    SELECT *
    FROM XmlFile
    GO
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

Maybe you are looking for

  • How to use security token in WLS 9.2

    I am using Workshop with Weblogic Server 9.2 to implement a Web services with security token (UsernameToken). I have successfully create the web services by using @Policy(uri="Policy:Auth.xml", direction=Policy.Direction.inbound). I use the default a

  • Pack existing Handling Units into outbound delivery

    Hi, The current scenario is that a WHSCON IDoc is passed into SAP which will pack handling units onto an inbound delivery. As part of this processing the IDoc will create the HU records on VEKP. Now, we are sending in a similar WHSCON IDoc to pack th

  • Tabbed browsing in IE 10 on Windows Phone 8

    Does Windows phone 8 OS suspend IE 10 tabs which are in the background ? Recently i was using my friend's Nokia Lumia 620 and i was surfing the internet. I had opened three tabs. i noticied that the small progress bar, that denotes how much the page

  • Drop files in Network Home on Server?

    I want to add a folder with a file inside to everyone's desktop that has a network home account. Only 25 users but wanted to do it from the server where the network homes are stored. Logged in with Admin credentials but I'm denied access when trying

  • Create xml from a collection type

    can anyone please explain me how to create an xml from a neseted table