Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Displaying dates in Name and dd-mm-yyyy Expand / Collapse
Author
Message
Posted Thursday, January 28, 2010 4:53 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, June 23, 2013 11:33 PM
Points: 39, Visits: 111
Hi All, I need a help on displaying dates in Name and dd-mm-yyyy on the particular month, when there is no data on the date, the dates are not coming in reports. attached the screen shot of what i am getting from RS and what i am expecting, please give me your valuable advice on how to get the information.

Thanks
Jprakash


  Post Attachments 
SQL.jpg (20 views, 97.98 KB)
Post #855082
Posted Thursday, January 28, 2010 5:14 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 2:02 AM
Points: 846, Visits: 303
For converting the number to a date, you can use the DateSerial function:

Description
Returns a Date value representing a specified year, month, and day, with the time information set to midnight (00:00:00).

Examples
=DateSerial(DatePart("yyyy",Fields!BirthDate.Value)-10, DatePart("m",Fields!BirthDate.Value)+3,DatePart("d",Fields!BirthDate.Value)-1)
=DateSerial(DatePart(DateInterval.Year,Fields!BirthDate.Value)-10,DatePart("m",Fields!BirthDate.Value)+3,DatePart("d",Fields!BirthDate.Value)-1)
=DateSerial(2007,10,24)

To get the name of the day, use the following Expression

=weekdayname(weekday(now()))

where you replace now() with your date(time) field.


Regards,

Willem
http://wschampheleer.wordpress.com
Post #855091
Posted Friday, January 29, 2010 7:22 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, June 23, 2013 11:33 PM
Points: 39, Visits: 111
Hi Willem,
the query i have used in sql is
SELECT DATEPART(YY, CHECKINTIME) AS Year, DATEPART(MM, CHECKINTIME) AS
Month, DATEPART(D, CHECKINTIME) AS 'Date', SUM(UPLOADLNCNT)
AS 'Total Lines', TRUSTID
FROM DEPTABLE
GROUP BY DATEPART(yy, CHECKINTIME), DATEPART(M, CHECKINTIME), DATEPART(D,
CHECKINTIME), TRUSTID
ORDER BY Year DESC, Month DESC, 'Date' DESC
and i tried the examples, but still i am getting error.
Please help me on this
Post #856063
Posted Friday, January 29, 2010 7:42 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 2:02 AM
Points: 846, Visits: 303
There's a few things to be said about your query but syntactically it is correct.
Where are you getting an error and what does it say?


Regards,

Willem
http://wschampheleer.wordpress.com
Post #856084
Posted Friday, January 29, 2010 8:26 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, June 23, 2013 11:33 PM
Points: 39, Visits: 111
Hi Willem, attached the screenshot
The error i am getting is in reports as #Error in the day number which was displaying earlier, and in reports on expression i have used
=DateSerial(DatePart("YYYY",Fields!Year.Value)-10, DatePart("m",Fields!Month.Value)+3,DatePart("d",Fields!Date.Value)-1)



  Post Attachments 
Error.JPG (3 views, 26.06 KB)
Post #856131
Posted Friday, January 29, 2010 10:20 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 11:51 AM
Points: 49, Visits: 450
If try something simple, it might make things easier and less errors,

If you could return the CHECKINTIME, just go the the Text Box Properties, in the Number/Custom section, using Custom Format:
dddd, will show name of weekday, like Monday, Tuesday...
d-MMM-yyyy, will show format of 0-Jan-2010...


Post #856238
Posted Friday, January 29, 2010 1:04 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 2:02 AM
Points: 846, Visits: 303
Why are you still using datepart when you have already done the extraction in your query?

Try this:

=DateSerial(Fields!Year.Value-10, Fields!Month.Value+3,Fields!Date.Value-1)


Regards,

Willem
http://wschampheleer.wordpress.com
Post #856369
Posted Tuesday, February 2, 2010 4:28 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, June 23, 2013 11:33 PM
Points: 39, Visits: 111
Hi Willem, thanks its working fine now, i have used
=DateSerial(Fields!Year.Value-10, Fields!Month.Value+3,Fields!Date.Value-1) in Expression on that column and in same column text box properties > Number > in category i chose date and in type 31-Jan-2000, but now only thing is i am not getting all the dates of the month january, coz there are no data's in 1st,2nd and 3rd date, i need to display whole of jan month with date's and in the data column as 0.
do i need to change the query, if yes, can you please help on the query

Thanks,
Jprakash
Post #857834
Posted Tuesday, February 2, 2010 4:53 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 2:02 AM
Points: 846, Visits: 303
You need to do an outer join with a table that contains all dates on which you want to report.

Check this topic for some inspiration.


Regards,

Willem
http://wschampheleer.wordpress.com
Post #857843
Posted Tuesday, February 2, 2010 6:02 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, June 23, 2013 11:33 PM
Points: 39, Visits: 111
Hi Willem, i tried on this query
select x.TRUSTID,Y.Date1, isnull(x.total,0) from
(select TRUSTID, Date=convert(varchar(25),UPLOADTIME,103),
Total=SUM(uploadlncnt) from DCLIVEJOBS where UPLOADTIME between '2010-01-01' and '2010-01-31'
group by TRUSTID,UPLOADTIME
)X
right outer join
(select '' as TA_A_NAme,convert(varchar(25),DATE,103) as date1,0 as Total from dbo.F_TABLE_DATE('01-Jan-2010','31-Jan-2010')
)Y on Y.Date1=X.Date order by Y.Date1

but i am getting 0 below the date column with a new row added (attached the screenshot), and more over i need to add a new row below the date date row and display the date as 31-Jan-2000


  Post Attachments 
DATE.JPG (3 views, 10.28 KB)
Post #857877
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse