6 Replies - 781 Views - Last Post: 23 May 2011 - 01:49 PM

#1 scolty   User is offline

  • D.I.C Regular

Reputation: 3
  • View blog
  • Posts: 259
  • Joined: 27-April 11

Create table error

Posted 22 May 2011 - 12:30 PM

Evening, Ive just started out trying to learn T-SQL and i was using the following code to create a table

USE MyDatabase
GO
CREATE TABLE customers
(
CustomerNumber int NOT NULL,
LastName char(30) NOT NULL,
)


In the object explorer on the left i can see the MyDatabase object but i can find "customers" under the tables folder. When i try and run the above code i get the following error

"Msg 2714, Level 16, State 6, Line 1
There is already an object named 'customers' in the database."

ive uploaded a screenshot incase there is something stupid ive missed. Thanks in advance

Posted Image

Uploaded with ImageShack.us

Is This A Good Question/Topic? 0
  • +

Replies To: Create table error

#2 smohd   User is offline

  • Critical Section
  • member icon


Reputation: 1825
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Create table error

Posted 22 May 2011 - 12:40 PM

Refresh your database!
Was This Post Helpful? 1
  • +
  • -

#3 scolty   User is offline

  • D.I.C Regular

Reputation: 3
  • View blog
  • Posts: 259
  • Joined: 27-April 11

Re: Create table error

Posted 22 May 2011 - 12:47 PM

Hi, thanks fro replying. i already clicked the refresh button (between the "filter" button and the "Show policy health state for all nodes") but it doesnt seem to change anything.
Was This Post Helpful? 0
  • +
  • -

#4 smohd   User is offline

  • Critical Section
  • member icon


Reputation: 1825
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Create table error

Posted 22 May 2011 - 12:54 PM

Right click on your database name and click on refresh. Some times it refreshes the selected tab only.
Was This Post Helpful? 1
  • +
  • -

#5 scolty   User is offline

  • D.I.C Regular

Reputation: 3
  • View blog
  • Posts: 259
  • Joined: 27-April 11

Re: Create table error

Posted 22 May 2011 - 12:57 PM

lol, it worked now.. feeling rather foolish but o well.

Thank you very much again for reply, i really appreciate it.

Rgds
Was This Post Helpful? 0
  • +
  • -

#6 SurfingShark   User is offline

  • D.I.C Head

Reputation: 38
  • View blog
  • Posts: 188
  • Joined: 18-April 11

Re: Create table error

Posted 22 May 2011 - 07:38 PM

Now you know, and you'll never forget!

Just an FYI, it's good practice to put your desired schema in front of the table name declaration (i.e. "dbo.customers").
Was This Post Helpful? 1
  • +
  • -

#7 ForcedSterilizationsForAll   User is offline

  • D.I.C Addict

Reputation: 33
  • View blog
  • Posts: 506
  • Joined: 16-July 09

Re: Create table error

Posted 23 May 2011 - 01:49 PM

View PostSurfingShark, on 22 May 2011 - 09:38 PM, said:

Now you know...


And knowing is half the battle! GI JOE!
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1