问题
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.


Please give me a solution to fix this problem. Your help will be highly appreciated.
回答1:
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.

For me, after repairing the instance, the error was solved.
Thanks for all who spent their valuable time to reply my question.
回答2:
I fixed the problem by running SSMS as administrator.
回答3:
I got the same error message. Problem was 0 bytes free on the C: drive.
回答4:
I faced the same error once in my project. This is purely due to SSMS(sql client) is corrupted. Just for cross check that server is fine and client is corrupted, try to connect to the sql-server in this machine from any other server if you have access and query the tables. If it returns data, just uninstall and reinstall the client(ssms) to solve the issue
Thanks
回答5:
Its may be late, but i get the same error in SQL SERVER 2016, i resolved it by assigning full access to the back up folder.
回答6:
I got the same error for SQL 2016 and the only solution for me was to completely uninstall (in appwiz.cpl) all entries Visual Studio + SQL. Then I executed VisualStudioUninstaller and I reinstalled SQL and after Visual Studio.
回答7:
I got the message after deleting a database. The database was gone, so I moved on.
来源:https://stackoverflow.com/questions/25574884/sql-server-2012-error-object-reference-not-set-to-an-instance-of-an-object