Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sequential querries

Status
Not open for further replies.

atiqraza

Programmer
Jan 9, 2007
24
US
I was wondering if anyone could tell me how to perform sequential queries on a table.

For example I want to first sort the table using a certain column, and then with the sorted result i want to do a number of calculations and updates.

I have the sql written down and i can perform it manually, but i would like it to be automated, like executing a stored procedure.

Is this possible in SQL ??
 
I guess so. It's hard to tell without seeing your query and what you are trying to do.

Most likely a sub-select would work for you.

SELECT drv.column1, drv.column2
FROM (SELECT co1, col3 FROM table1) drv

Then create it as a stored procedure and run it from a job. Create the job and your first step will be EXEC <your stored procedure name>.

-SQLBill

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top