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
 SQL Server Development (2000)
 Help needed Creating Procedure in Sql Server

Author  Topic 

reply2hemant
Starting Member

1 Post

Posted - 2013-06-27 : 08:20:52
Can anyone help me with a small procedure I have to write?

Requirement to create Stored Procedure :
1. Create tables
A1
A2
B1
B2
----------- this is done------

Fill the data in those tables
------------this is also done----

Create "Source_table.tx"t file with table names and place them in any location.
------------this is also done----

write a procedure to read the above file "Source_table.txt" and it should read the tables name 1 by 1 which performs a simple operation inside SP -->

Select * from @Table_Name

Also, it should check if the .txt file is exisiting or not.

If exists then Read the file and execute the SP.
SP does this :
Select * from A1
Select * from A2
Select * from B1
Select * from B2

After that, write an output file with the counts of records to the same location where our Source_table.txt exists .

If doesnt exist then write to a .txt file that "File name and Location doesnt exist"
   

- Advertisement -