SQL Server Management Studio can't open new query - sql-server

I installed VS 2022 and Microsoft SQL Server Management Studio v18.12.1 on my new computer. After opening SQL Server Management Studio and connecting to a database, if I click "New Query" or "Select Top 1000 Rows" from a table, I get this error:
The type initializer for 'System.Collections.Immutable.ImmutableHashSet`1' threw an exception. (mscorlib)
Could not load file or assembly 'System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest. (System.Collections.Immutable)
Could not load file or assembly 'System.Collections, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.
If I try to uninstall SQL Server Management Studio in control panel, after clicking uninstall, nothing happens.
I have installed .NET Framework 4.6.2 - 4.7.1, 4.8 SDK by vs installer. What I can do to resolve this problem?
I want to use Microsoft SQL Server Management Studio to query data from database

Related

SQL Server Data Tools version 17.x is available for which version of Visual Studio?

Kindly let me know where can I get 17.x version of SSDT. I am trying to run a powershell script which requires SQL Server Data Tools version 17.x. I am not sure which version of VS it's referring to? 2017 or 2015
The error message is:
Exception calling "DeployProject" with "2" argument(s): "Could not load file or assembly 19-Sep-2019 07:04:28 'Microsoft.SqlServer.IntegrationServices.Common.ObjectModel, Version=14.0.0.0, Culture=neutral, 19-Sep-2019 07:04:28 PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
As I know for Visual Studio 2017 the relevant SSDT version is 15.x And with Visual Studio 2019, the required functionality to enable Analysis Services, Integration Services, and Reporting Services projects has moved into the respective Visual Studio extensions.
Reference
Download and install SQL Server Data Tools (SSDT) for Visual Studio
Update 1
Based on your comments, you must install SSDT for SQL Server 2016 (version 14)
Previous releases of SQL Server Data Tools (SSDT and SSDT-BI)

Unable to add data connection

I have SQL Server 2014 installed. When I'm attempting to create a data connection within Visual Studio Express 2013 for Windows Desktop it's giving me the below error.
Unable to add data connection. Could not load file or assembly. Microsoft.SqlServer.Management.Sdk.Sfc, Version=11.0.0.0, Culture=neutral, PublicKeyToken=[key] or one of its .dependancies. The system cannot find the file specified.
I have downloaded and installed both the .msi files advised in this answer.
Although the answer states that with SQL Server 2014 you should receive the error message stating Version=12.0.0.0, however I'm receiving the error message showing Version=11.0.0.0. Should I maybe download and install the ENU\x64\SharedManagementObjects.msi for SQL Server 2012?
Checking C:\Windows\assembly shows that Microsoft.SqlServer.Management.Sdk.Sfc is installed as version 12.0.0.0.
I downloaded ENU\x64\SharedManagementObjects.msi for SQL Server 2012.
It would appear that when using Visual Studio 2013, and SQL Server 2014, it requires version 11.0.0.0 of Microsoft.SqlServer.Management.Sdk.Sfc.
For both types (32 bit and 64 bit), this works:
Open URL http://www.microsoft.com/en-us/download/details.aspx?id=35580
Download ENU\x86\SQLSysClrTypes.msi
Download ENU\x86\SharedManagementObjects.msi
Install ENU\x86\SQLSysClrTypes.msi
Install ENU\x86\SharedManagementObjects.msi
Restart your Visual Studio and now Everything will work smooth.
See here.

Cannot add a SQL Server project to a Visual Studio 2013 solution

I am using Visual Studio 2013 with SQL Server 2012.
When I try to add a SQL Server project (*.sqlproj) to my solution, I receive the following error:
Could not load file or assembly
'Microsoft.Data.Tools.Schema.Utilities.Sql.12, Version=12.0.0.0,
Culture=neutral, PublicKeyToken=etc...' or or one of its
dependencies. The system cannot find the file specified.
According to Microsoft, SQL Server Data Tools comes installed as part of the default installation with Visual Studio 2013.
Anyone else had this problem?
I've the same problem and found some decision possible it is suitable : http://sdksdotnetfunda.blogspot.com/2012/08/could-not-load-file-or-assembly.html

SQL Server stops when I right click on any table instance

When I right-click the instance of a table on the SQL Server 2005, it stops with the message:
Microsoft sql server is busy waiting for the internal operation to complete.
If I try to open a new instance of SQL Server Managemente Studio it can't open and shows me the message:
Could not load file or assembly 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=...' or one of its dependencies. The system cannot find the file specified.
Thanks
I solved the problem using the hint from the event Viewer, (something I didn't noticed before).
There were two error notifications:
Product: Microsoft Visual Studio 2010 Team Explorer - ENU -- Error 1706. An installation package for the product Microsoft Visual Studio 2010 Team Explorer - ENU cannot be found. Try the installation again using a valid copy of the installation package 'vs_setup.msi'.
Product: Microsoft Visual Studio 2010 Team Explorer - ENU -- Error 1712. One or more of the files required to restore your computer to its previous state could not be found. Restoration will not be possible.
I just executed the vs_setup.msi from the Microsoft Visual Studio 2010 Team Explorer and it worked again normally.
It was fixed and working normally, hope this message will help anybody with the same problem.

Sql Server - missing pfclnt.dll?

I'm getting the following error when trying to initialise the SMO objects in my application:
Microsoft.SqlServer.Management.Trace.SqlTraceException: Failed to initialize object as reader. ---> System.IO.FileNotFoundException: Could not load file or assembly 'file:///c:\Program Files\Microsoft SQL Server\100\Tools\Binn\pfclnt.dll' or one of its dependencies. The system cannot find the file specified.
This file is indeed missing from that location.
Any ideas why and where I can go about getting it?
I'm running:
SqlServer 2005
ManagementStudio 9.00.4035.00
WinServer 2003 SP2
I experienced the same problem which was solved by switching over to x86 (from AnyCPU). It seems that the assembly is only available in 32 bit mode.
Next problem was "Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."
This was solved by adding the useLegacyV2RuntimeActivationPolicy attribute in my app.config. I already hade the supportedRuntime node, and can't say if it's necessary for the solution to work.
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>
You could try to reinstall SQL Server Management Studio or update to the latest service pack to fix this kind of issue.
If it is not working, you could also upgrade to SQL Server Management Studio 2008 since it is backward compatible with SQL Server 2005.
SQL Server 2005 SP4
SQL Server Management Studio 2008 Express (also works with Standard and Enterprise editions)

Resources