views:

29

answers:

1

hi,

Could you tell me how to remove the database name from the table's name.

Each time I create a table the database name is automatically prefixed to the name

this is my table definition

Create table Links
(
Id Int IDEntity(1,1) ,
DisplayName Varchar(250) NOT NULL,
Href Varchar(250) NOT NULL,
Tooltip Varchar(550) NOT NULL,
IsVisible smallInt,
[Index] int,
IsEditable smallInt,
IsOnMenu smallInt 
)

thanks

+1  A: 

Database name or schema name? what happens when you do this?

 Create table BlaTest(id int)

 Insert BlaTest values(1)

 select * from BlaTest

What do you see?

Also can you run this after you have run the script above and post results

select *
 from INFORMATION_SCHEMA.TABLES
where TABLE_NAME = 'BlaTest'

or for your table

select *
 from INFORMATION_SCHEMA.TABLES
where TABLE_NAME = 'Links'

you can't remove the schema..a table is always part of a schema...you don't have to use the name and then it will assume the default schema for the user that is executing the query. However if you do include the schema then SQL Server does not have to lookup the schema every time and you get a little performance benefit

SQLMenace
you are right i think its the schema name but how do iremove it?nk is th thi
GigaPr
you can't remove it..a table is always part of a schema...you don't have to use the name and then it will assume the default schema for the user that is executing the query
SQLMenace
@GigaPr: why do you even want to remove it?? This cannot be done - a table is **always** part of a schema - you cannot have tables "floating around" outside of any schema.
marc_s