I created a table using the
create table
command but it does not show up in the object explorer. I have tried refreshing both the explorer and IntelliSense but it still does not show up. The table is present in the database I confirmed that by printing it out using the select
command.
It appears like you created your table in the system master
database instead of in your user defined database. There are a few things you can do:
At the top of your query, write USE your_database_name
That will set your connection to run your query against a specific database.
In SSMS, on the top left by default I think, there should be a white box with a dropdown arrow next to it. This is a list of all the databases in the instance you are currently connected to. Click yours, and run your table create.
Fully qualify your table name during the create as my_database_name.schema_here.table_name_here
Always look at the bottom of your SSMS window and confirm you are running queries in the correct instance (dev vs prod) and running them against the correct database.
USE database_name
GO
CREATE TABLE dbo.my_new_table (ID INT)
GO
or
CREATE TABLE database1.dbo.test_user_table (ID INT)
GO