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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deciphering "new" data on a report, mixed with "old" data 1

Status
Not open for further replies.

Unravel

Programmer
Jul 5, 2013
5
US
I'm running SQL Server 2008 R2, and SSRS Visual Studio 2008.

Here is a question I received from one of my users:
Can you include an Action Date in the report so I’ll know if we’ve already seen the member on the report?

Is there a way in T-SQL to code for "new" data? I have a report that runs daily.
How can I find the rows that show up on today's report, but were not there yesterday?
 
Introduce timestamps on your data, either for the datetime they are inserted or the datetime they were reported last. You will have the one or other anyway, else you wouldn't know you need to put the new data into todays report, would you?

So how is your table structure?

If you have an insert datetime you could query

Select ...all the fields you query anyway..., CASE insertdate>='YYYYMMDD' THEN 1 ELSE 0 END as IsNew FROM yourtable WHERE ...

Or you would just query new data with SELECT ... WHERE insertdate>='YYYYMMDD'

YYYMMDD then needs to be the date or datetime (add the time portion) you last reported or the date you're interested in. Does that go in the direction of your needs?

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top