jedistar
asked on
Create tables in a faster easier way
Hi,
I have abt 100 tables in my MS SQL Server 2000.
I would like to ask how can i generate a script that will auto these
tables when i move them to another server.
I also need to change the owner for each table, how do i do that?
Thanks.
I have abt 100 tables in my MS SQL Server 2000.
I would like to ask how can i generate a script that will auto these
tables when i move them to another server.
I also need to change the owner for each table, how do i do that?
Thanks.
ASKER
i merely added tables/fields etc.
what is MS_foreachTAble stored procedure
and sp_changeowner stored procedure ?
How again.
what is MS_foreachTAble stored procedure
and sp_changeowner stored procedure ?
How again.
To change the owner for all tables of a database at once
You can use the undocumented function ms_foreachtable and the stored procedure sp_changeobjectowner in Query Analyzer to archive that quite easy.
Example to take over for dbo: sp_msforeachtable "sp_changeobjectowner '?', 'dbo'".
You can use the undocumented function ms_foreachtable and the stored procedure sp_changeobjectowner in Query Analyzer to archive that quite easy.
Example to take over for dbo: sp_msforeachtable "sp_changeobjectowner '?', 'dbo'".
ASKER
hrm still don't understand
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and run the sp_changeowner stored procedure First?
to script out the tables in the first place...
just right click the database in enterprise manager and
select all task - script ...
make sure your visit each SCREEN and select all the required functions
e.g. indexes / constraints, etc...
but this should be a task you use your modelling/design tool for....
what did you use to design the database in the first place...