开发者

Same name tables under different schemas with SQL Server 2005 Management Studio Express

开发者 https://www.devze.com 2023-01-18 20:32 出处:网络
I know how to create a new schema and write a DDL script to create tables with the same name that reside in different schemas in the same database. I want to know how to do that using SQL Server 2005

I know how to create a new schema and write a DDL script to create tables with the same name that reside in different schemas in the same database. I want to know how to do that using SQL Server 2005 Management Studio Express.

To repeat, I want to know if I can create two tables having the same name but residing in different schemas of开发者_开发知识库 the same database using SQL Server 2005 Management Studio Express.


Yes. You can do that by changing the schema property in property window to a different value than dbo (which is the default value of schema) for the new table being created in SQL Server.

While you in the process of creating a new table in your database press F4 key and properties window will be shown on the right hand side of your screen. That properties window shows the various attributes of the new table being created:

Same name tables under different schemas with SQL Server 2005 Management Studio Express

You can choose any of the built-in schemas e.g. guest,db_owner etc. from the drop down box or your own custom schema which you are using in your database.

To answer your original question - As long as you are setting the schema property of the two tables you are creating to a unique value (e.g. dbo, guest) even if they have same name let's say table1 it should not cause any problem.

0

精彩评论

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