开发者

SQL Server 2008 tables name problem

开发者 https://www.devze.com 2023-01-11 21:14 出处:网络
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 automatica开发者_如何转开发lly prefixed to the name

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 automatica开发者_如何转开发lly 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消