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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Creating 100 tables in 1 shot

Author  Topic 

faizankh
Starting Member

8 Posts

Posted - 2005-10-03 : 15:16:25
hello,

I'm new to SQl Server, i'm migrating from oracle to sql server and i have to create 100 tables, my question is:

Is there a dynamic query to create tables in 1 shot, please help.

thanks

Kristen
Test

22859 Posts

Posted - 2005-10-03 : 15:45:24
Yes, you can execute the CREATE TABLE statement dynamically.

Assuming you had a string variable @strSQL that contained the relevant CREATE TABLE syntax then:

exec(@strSQL)

would execute it (you'd just need to have sufficient permissions to create tables)

Are you creating the tables based on tables in Oracle? 'coz if so, although I haven't done it, I expect that Microsoft have a "wizard" to facilitate this - failing that I'm sure there are plenty of tools that will script the tables, using Oracle DB as a source, in MSSQL format ready to run on MSSQL.

Kristen
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-10-04 : 12:54:08
You can always use DTS, or in SQL 2005 the new Integration Services, especially if you are bringing over data also. Although check the limitations of DTS to make sure it gets all of the triggers, and constraints. I don't remember if there are any objects it misses with Oracle.

I think TOAD will script your tables out of Oracle, and then you'd need a little tuning to match the syntax to SQL Server. Or maybe with the new version of TOAD for SQL Server they offer some kind of conversion routine.

---------------------------
EmeraldCityDomains.com
Go to Top of Page
   

- Advertisement -