• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1155
  • Last Modified:

How to change tables schema OR convert.

Hi ALL,

I have migrate MSSQL 2000 to MSSQL 2005 but I am getting some problem about the schema.

Some  tables of  database are running  with different schema on New server for example

abcsql is db then it it's tables are running in abcsql and DBO schema so how to change dbo schema to abcsql.

I want to do this for many databases so require fastest way for it.


0
Sam Panwar
Asked:
Sam Panwar
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
the syntax to move a table from 1 schema to antoher:

ALTER SCHEMA [abcsql] TRANSFER [dbo].[table_name]


0
 
Sam PanwarSr. Server AdministratorAuthor Commented:
hi,

I require it for all  tables of the database ,can I do it,
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
run this query to generate the script:

exec sp_MSForEachtable 'ALTER SCHEMA [abcsql] TRANSFER ? '
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now