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
 General SQL Server Forums
 New to SQL Server Programming
 procedure

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2008-02-29 : 07:22:57
Dear All,
i've a database with around 1300 tables.daily several transactions happens on several tables. what exactly i need is,
from today 9Am to the next day 8:59AM transactions. each table is having datetime column. please help me in this regard

Vinod
Even you learn 1%, Learn it with 100% confidence.

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2008-02-29 : 08:24:01
Hmm...something like this maybe? ->

SELECT 'SELECT * FROM ' + table_name + ' WHERE DateColumn BETWEEN ''2008-02-28 09:00:00'' AND 2008-02-29 08:59:59'''
FROM information_schema.tables
WHERE table_type = 'base table'

Maybe not exactly what you need but might get you on the right track?

--
Lumbago
"SELECT Rum, Coke, Lime, Ice FROM bar WHERE ClosingTime = 'Late' AND FemaleMaleRatio > 4"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-29 : 08:28:35
select columns from table
where
datecol>=dateadd(hour,9,dateadd(day,datediff(day,0,getdate()),0)) and
datecol<dateadd(hour,9,dateadd(day,datediff(day,0,getdate())+1,0))


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -