I successfully created (scripted) a database in 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 an error:
" Msg 208, Level 16, State 1, Line 1 Invalid object name 'ContactInfo'. "
What am I doing wrong? Why aren't the database tables listed?
Here is the actual script I used:
CREATE DATABASE [Name]; GO CREATE TABLE Company (CompName Varchar(10) PRIMARY KEY , CompCity VarChar(20), CompState CHAR(2), CompAddress Varchar(50), CompZip SMALLINT ); CREATE TABLE NamePhone (CompName VarChar(10) NOT NULL PRIMARY KEY REFERENCES Company(CompName) , CompPhone Varchar (12) NOT NULL ); CREATE TABLE ContactInfo (ContactFName NVarChar(20) PRIMARY KEY , ContactLName NVarchar(20), ContTitle Varchar(10), ContactDirPhone Char(10), ContEmail Varchar(320) , ContCompany Varchar(10) REFERENCES Company(CompName) ); CREATE TABLE ContactReportsTo (ReportstoFName NVarChar(20) , ReportstoLName NVarchar(30), ReportstoPhone Varchar(50), ReportstoCompany Varchar(10) REFERENCES Company(CompName), ContactFName NVarchar(20) REFERENCES ContactInfo(ContactFName));