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 2005 Forums
 SQL Server Administration (2005)
 Automation object script

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2009-02-27 : 15:47:52
This is not exactly a SQL requirement. However I don’t know any other forums.

I have a file with following rows.
create table t1 (id int);
create table t2 (d int);
create table t3 (i int);

I want the file to split into 3 files t1.sql, t2.sql and t3.sql. with respective object definition.

I can do this with SSMS->generate script-> Individual file. However SSMS adds lots of additional stuff in the code.

I need to achieve this by batch programming and RegEx. I know little bit of both. But could not achieve this. Any suggestion?


------------------------
I think, therefore I am - Rene Descartes

ahmad.osama
Posting Yak Master

183 Posts

Posted - 2009-03-01 : 00:49:39
quote:
Originally posted by ravilobo

This is not exactly a SQL requirement. However I don’t know any other forums.

I have a file with following rows.
create table t1 (id int);
create table t2 (d int);
create table t3 (i int);

I want the file to split into 3 files t1.sql, t2.sql and t3.sql. with respective object definition.

I can do this with SSMS->generate script-> Individual file. However SSMS adds lots of additional stuff in the code.

I need to achieve this by batch programming and RegEx. I know little bit of both. But could not achieve this. Any suggestion?


------------------------
I think, therefore I am - Rene Descartes




You can do this thru VBSCRIPT....
read the current file(readline)
create and write it into a new file..

Its easy..just google for vbscript ...

Regards,
Ahmad Osama
Go to Top of Page
   

- Advertisement -