Friday, February 17, 2012

Created table in SQL SERVER EXPRESS but don't see it

I installed SQL SERVER 2005 Developer Edition over SQL SERVER EXPRESS in order to get the Management Studio.
I created a new Database called TRADING.
I then started a NEW QUERY and created a table and inserted 2 rows.
I then selected from the table and got 0 rows .
I then went to Trading database on the left side and clicked tables and did not see the table I created.
What am I doing wrong. SHould I remove SQL SERVER EXPRESS and then install SQL SERVER 2005 Developer Edition.

look in the master database. you might have created it there.

|||

As Karl suggested, you likely created the table in a database other than your new TRADING database.

In order to use a database, you have to be in the context of that database. You do this by using the USE statement. For example:

CREATE DATABASE Trading

GO

USE Trading

CREATE TABLE MyTable (C1 int, C2 varchar(50))

GO

INSERT INTO MyTable VALUES (1, 'Test')

See the topic 'USE (Transact-SQL)' in Books Online for more information.

You can also see the current database context when you're in the SQL editor by looking at the database listed in the Standard toolbar. Selecting another database from the dropdown list in the toolbar is the same as running a USE <databasename> statement.

Regards,

Gail

No comments:

Post a Comment