Reputation: 37
I am currently trying to create a table in SQL. When I run the query I get the text, "Command(s) completed successfully."
However, this does not add the table to table folder on the left hand side. As far as I can tell, despite the fact that Visual Studio is telling me it was created, it hasn't been created.
I have refreshed the folder and the whole server multiple times.
CREATE TABLE [dbo].MembersTable
(
MemberID INT NOT NULL,
FirstName VARCHAR(100),
LastName VARCHAR(100),
MemberAddress VARCHAR(200),
TypeOfMembershipID VARCHAR(20),
PhoneNumber CHAR(11),
MembershipStart DATE,
MembershipEnd DATE,
Notice BIT,
TypeOfPaymentID VARCHAR(20),
PRIMARY KEY (MemberID),
FOREIGN KEY (TypeOfMembershipID) REFERENCES [dbo].MemberTypeTable(TypeOfMembershipID)
)
Upvotes: 0
Views: 9193
Reputation: 1
Make sure you have selected the DB where in you want to create the table. I selected the folder Tables > new query instead of Database > new query.
Upvotes: 0
Reputation: 2524
you have to refresh the list, by right clicking on the Tables node in the left menu.
Also, check that you are not creating the Table in the Master
database
Upvotes: 3
Reputation: 6568
Check these two items:
1.Check your active database. You can set active database by using the :
USE YOUR_DN_NAME
GO
and after that write your CREATE TABLE code.
Upvotes: 0