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)
 View to trstrict data

Author  Topic 

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2007-06-22 : 04:34:44
Hi i have a view were i need to resteict the amount of data thats displayed in a report. i group all my data together because i have about 600,000 rows of data in the view i need a way of not showing the pervious 2days of data, but i also need to display data from 2007 on wards

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-22 : 08:52:23
So, in 2007 you want to show all data except last days?

Madhivanan

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

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2007-06-22 : 10:25:36
I want to show all the data from 01-01-07 to getdate() -2 days

So my report will show all the data for 2007 apart up to -2 days.

for today i like to see data up to 20th of june tomorrow up to the 21th etc..
Go to Top of Page

pamit_1982
Starting Member

13 Posts

Posted - 2007-06-22 : 10:37:11
Consider datecreated as column..
use datediff..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-22 : 11:21:26
Create view yourview
as
Select columns from table
where datecol<dateadd(day,datediff(day,0,getdate()),-1)

Madhivanan

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

- Advertisement -