Cannot view generated tables in Object Explorer - Microsoft SQL Management Studio

I am trying to create multiple tables in the database, however the tables are not showing up in the object explorer view.

my code looks like this:

use testDB
GO

create table dbo.teacher (id varchar(5), name varchar(24));
insert into teacher values ('dm112', 'Magro, Deirdre');
insert into teacher values ('je232', 'Elkner, Jeff');
insert into teacher values ('cm147', 'Meyers, Chris');
insert into teacher values ('kr387', 'Reed, Kevin');


create table dbo.course (
    number varchar(6),
    name varchar(24),
    credits int,
    teacherid varchar(6) 
);
insert into course values ('SDV100', 'College Success Skills', 1, 'dm112');
insert into course values ('ITD110', 'Web Page Design I', 3, 'je232');
insert into course values ('ITP100', 'Software Design', 3, 'je232');
insert into course values ('ITD132', 'Structured Query Language', 3, 'cm147');
insert into course values ('ITP140', 'Client Side Scripting', 4, 'kr378');
insert into course values ('ITP225', 'Web Scripting Languages', 4, 'kr387');


create table dbo.student (id varchar(3), name varchar(24));
insert into student values ('411', 'Perez, Gustavo');
insert into student values ('412', 'Rucker, Imani');
insert into student values ('413', 'Gonzalez, Alexis');
insert into student values ('414', 'Melgar, Lidia');


create table dbo.enrolled (studentId varchar(3), courseNumber varchar(6));
insert into enrolled values ('411', 'SDV100');
insert into enrolled values ('411', 'ITD132');
insert into enrolled values ('411', 'ITP140');
insert into enrolled values ('412', 'ITP100');
insert into enrolled values ('412', 'ITP14p');
insert into enrolled values ('412', 'ITP225');
insert into enrolled values ('413', 'ITD132');
insert into enrolled values ('413', 'ITP225');
insert into enrolled values ('414', 'SDV100');
insert into enrolled values ('414', 'ITD110');

      

I looked through this prior to posting and found this exact question:

Create table with T-SQL - unable to see created tables in object explorer

However, it used "tempdb" which I don't know.

I completed the request

select name, type_desc from testDB.sys.objects

      

which returned:

name          type_desc
---------------------------
...
teacher       USER_TABLE
course        USER_TABLE 
student       USER_TABLE
enrolled      USER_TABLE
...

      

I can change, select, delete, etc. on these tables, but I can't see them. Am I missing something? Another question raised the prospects for "test" and "production"? They didn't go into details and google didn't help me

: (

Thank you for any help you can offer.

Edit: Karl below found a solution! Although Refresh-Click (F5) in Object Explorer does not refresh the database view, right-click the database and click Refresh to refresh the tables.

+3


source to share


1 answer


This will happen if you open the node tables in the Explorer object and do not update after running DDL. It's a shame that SSMS doesn't start autorefresh explorer after DDL. The update is available via the right-click context menu in the object explorer.



+10


source







All Articles