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)
)
3条答案
按热度按时间7hiiyaii1#
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
databasewydwbb8l2#
Check these two items:
1.Check your active database. You can set active database by using the :
and after that write your CREATE TABLE code.
yh2wf1be3#
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.