Why are tables not showing up in Object explorer in database

  • Thread starter Thread starter WWGD
  • Start date Start date
  • Tags Tags
    Database Sql
Click For Summary
The discussion revolves around a user who successfully created a database in MS SQL Server 2012 but is unable to see the tables within that database in the object explorer. The user initially speculates that the absence of 'Insert' statements might be the reason for the missing tables. They encounter an error when attempting to run an insert statement, indicating an invalid object name. Other participants suggest checking if the transaction is still open and remind the user to commit the transaction if necessary. The user confirms they have access to a console and describes their process for creating the database and tables. They later realize the issue stemmed from logging into the master database instead of the newly created database. This highlights the importance of ensuring the correct database context when working with SQL Server.
WWGD
Science Advisor
Homework Helper
Messages
7,772
Reaction score
12,992
Hi all,
I successfully created (scripted) a database in MS SQL Server 2012. My problem is that while the database itself is listed in the object explorer , the tables from the database are not. The database I scripted did not contain actual data, i.e., there were no 'Insert' statements. Is this last the reason why the tables are not listed? I tried to see if the tables were stored somehow without appearing by running an insert into statement for one of the tables in the script statement , but I get the error statement : " Msg 208, Level 16, State 1, Line 1 Invalid object name 'ContactInfo'. "

What am I doing wrong? Why aren't the database tables listed? Thanks.
 
Technology news on Phys.org
Do you have access to an actual console? What do you get when you type in
"SHOW TABLES"?

Is the transaction still open? If you used a transaction and forgot to "commit" it'll all disappear.
 
  • Like
Likes WWGD
Thanks, NJRunner. Yes, I have access to a console .I scripted the database in the usual (at least to me) way : Create database..go Create table Table_name (Field1 data type 1,...). Create Table Table_name2 ,... Then I ran it as a query. The database itself showed up . I refreshed object explorer. I closed the session , reopened it.
How does one commit the database?
 
If the db itself showed up, then it must have been committed. What happens when you run SHOW TABLES? Do you get a list of the tables? Also try a DESCRIBE on one of your tables, it'll tell you a lot about it.
 
  • Like
Likes WWGD
Thanks, NJ runner, will follow up Monday when I am back at work.
 
  • Like
Likes newjerseyrunner
@newjerseyrunner : Duh on myself, I was logging on to the master database. Thanks for your patience.
 
  • Like
Likes newjerseyrunner
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

Replies
5
Views
2K
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K