September 12, 2013 at 6:52 am
Hi all,
Please what is the syntax for datediff in minutes.
I have tried the expression datediff("m", fields!startddate.value, fields!enddate.value) but it is not working. I have equally use the full minutes as in "minutes" but still not working. "mm" does not work either.
September 12, 2013 at 7:09 am
Not to call you lazy, but a 1-minute Google search would provide you with the answer. The first result when entering datediff into google gives the Technet documenation page.
Heck, just even selecting datediff in SSMS and hitting F1 woul lead you directly to the documentation.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
September 12, 2013 at 7:49 am
This doesn't necessarily answer your question, but, in my opinion, best practice is to use the full name, not the abbreviation so I'd use DATEDIFF(minute, '20100101', getdate()) not, DATEDIFF(mi, '20100101', getdate()).
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
September 12, 2013 at 10:43 am
I was refering to expressions and not sql. Anyway I later found out the correct one to use.
For other people who might have the same problem, the correct expresion is to use Datediff("n", Fields!startdate.Value, Fields!enddate.Value). Minute or m or mi will not work in expressions.
EO
September 12, 2013 at 10:50 am
eobiki10 (9/12/2013)
I was refering to expressions and not sql. Anyway I later found out the correct one to use.For other people who might have the same problem, the correct expresion is to use Datediff("n", Fields!startdate.Value, Fields!enddate.Value). Minute or m or mi will not work in expressions.
EO
Glad you found your answer.
In the future you might want post questions like this in an SSRS or SSIS forum (whichever product you needed the expression for) or if posting in a General forum like this one specifically mention the product you are working in.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
September 12, 2013 at 10:57 am
Oddly enough, SQL is a language that contains expressions.
It might have been useful is you had specified which language you were talking about in your first post.
Tom
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply