Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2012 error: object reference not set to an instance of an object

I use SQL Server 2012 and I have some databases on it. The problem is I suddenly get an error saying,

object reference not set to an instance of an object

I get this error when:

  • Going to write a new query
  • Select previously entered data by right click the table name -> Select top 1000 rows

What I can do without getting error message:

  • Log into my instance successfully using both Windows Authentication mode and SQL Authentication mode.
  • Edit the table data by right click the table name -> Edit top 200 rows
  • Create a new database

I'm using:

  • Microsoft SQL Server Management Studio: 11.0.3128.0
  • Microsoft .NET Framework: 4.0.30319.34014
  • Operating System: Windows 8.1

Here are some snapshots of the error. error

Advanced_information

Please give me a solution to fix this problem. Your help will be highly appreciated.

like image 652
Kasun Perera Avatar asked Aug 29 '14 19:08

Kasun Perera


People also ask

How do I fix object reference is not set to an instance of an object?

To fix "Object reference not set to an instance of an object," you should try running Microsoft Visual Studio as an administrator. You can also try resetting the user data associated with your account or updating Microsoft Visual Studio to the latest version.


2 Answers

I fixed the problem by running SSMS as administrator.

like image 160
Timothy Gonzalez Avatar answered Oct 13 '22 03:10

Timothy Gonzalez


I could solve the error. Repair the SQL Server.

Go to Add/remove programs Microsoft SQL Server 2012(x64) -> Uninstall/Change -> Repair. Select the instance that you want to repair here.

Select the instance

For me, after repairing the instance, the error was solved.

Thanks for all who spent their valuable time to reply my question.

like image 44
Kasun Perera Avatar answered Oct 13 '22 03:10

Kasun Perera