Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
hasanali00
Posting Yak Master
207 Posts |
Posted - 2005-06-13 : 05:52:07
|
| When I run 'Generate SQL Script' to create scripts for tables, I get the following:if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Products_Vat]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[Products_Vat]GOCREATE TABLE [dbo].[Products_Vat] ( [VatID] [int] IDENTITY (1, 1) NOT NULL , [VatRate] [money] NULL ) ON [PRIMARY]GOWhen I run this script, it will create a table and make 'dbo' its owner.My question is: how can I generate script which does not include owner information into the script.(The reasopn why I dont want to include owner info into the script is that the other sql server where i will run this script has a different owner. So if I run the above script, i will end up with 2 Products_Vat tables by different owners)regards |
|
|
Thrasymachus
Constraint Violating Yak Guru
483 Posts |
Posted - 2005-06-13 : 08:22:33
|
| If the person running the script on the other machine will be logged in as the owner when the script is run just remove the dbo.Sean Roussy |
 |
|
|
hasanali00
Posting Yak Master
207 Posts |
Posted - 2005-06-13 : 08:56:46
|
| Actually, I have tried it. Even if I am logged on as a different user, the script creates a new Products_Vat table, whose owner is 'dbo' |
 |
|
|
Thrasymachus
Constraint Violating Yak Guru
483 Posts |
Posted - 2005-06-13 : 09:12:42
|
| I usually create all of my objects with dbo as the owner because it simplifies managing permissions but to my recollection that should have worked. What happens when you specify owner logged in as the owner.CREATE TABLE Sean.MyTable( etc...If all else fails I guess you could create your table and then use sp_changeobjectowner.Sean Roussy |
 |
|
|
|
|
|