Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql 2005 gui vs query for table creation 1

Status
Not open for further replies.
Aug 20, 1999
53
GB
Hi, am fairly new to sql (about 10 hours) and am getting to grips with writing sql. But when I create new database tables through code they don't show up inside the GUI environment at all.

They can store data and I can search and edit them so they are clearly working, but they don't show up in the GUI. Is this deliberate or is it just me? SQL has not been service packed....

Advice welcome..
 
You have to refresh the list before they will show.
Right click on "tables" in the tree on the right, and choose refresh
 
It's not a refresh issue, they simply don't show up in the GUI, even after a complete reboot.

I know this may be a bit basic but have coded like so:

create database companyx;
go
create table (
name nchar(20),
surname nchar(20),
age int
)
go


Am I missing anything? If not something must have screwed up on the server....
 
you haven't named your table

create table tbl <-- name

You also have some issues about where you are creating the table.

think about it. You come along and create a database
create database companyx;
go

Then you create your table
create table tbl (
name nchar(20),
surname nchar(20),
age int
)
go

But where did you just create the table? You more than likly did where ever you opened your query window and your default database. God help you if its master ;-)


You need to use a "use companyx" so you know where you are doing what when you do it

____________ signature below ______________
You are a amateur developer until you realize all your code sucks.
Jeff Atwood

 
Cheers guys, that's helped me work it out.

I had named the table (just missed the code out) but it was the USE DATABASE statement that'd I'd missed out. I'd assumed after creating the database I'd be set into it's context but apparantly not.

Had a look inside the master tables and found several that'd I'd lost earlier.

Cheers....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top