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)
 Using a text file to store pointers to sql files

Author  Topic 

MikeNau
Starting Member

1 Post

Posted - 2003-02-13 : 16:31:42
Is there a way to use a text file to load other files containing valid sql statements?

For example, the file load_views.sql contains the following:

read login_view.sql
read user_view.sql

Ideally, I would pass in the load_views.sql file to osql and it would then load login_view.sql and user_view.sql files.

Any ideas?

Thanks,
Mike.

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-02-13 : 16:35:39
Create a .bat batch file
and include one osql line for login_view.sql
and another for user_view.sql

Then when you run your .bat file it will execute both statements.

You can even have conditional statements.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-02-13 : 16:40:21
You could call load_views.sql with osql, then inside load_views.sql would be sql commands that call your two files with xp_cmdshell. I don't think that you want to do this though. You should just do what ValterBorges suggested instead of what you are trying to do.

Go to Top of Page
   

- Advertisement -