|
Comments
|
|
nice
|
|
|
nice
|
|
|
Excellent tutorial!!
|
|
|
Very good
|
|
Steve Harris on
3/11/2010
perhaps talk about other date functions like using CONVERT
|
|
|
Great vid
|
|
|
This is good general information, if the date you are recieving is in a format that is valid for the Datepart function..
However, I have a specific case, where I receive mmddyy, no punctuation. The following code:
SELECT
datepart(yyyy, '030510') as WhatYear
returns 2003 as the year, instead of 2010. In this case, I must parse the date.
|
|
|
A good introductory video. It would be nice to see a sample where the data format for a date column has changed in a table so users can see exactly what you mean when you say that "parsing out a year or month or quarter can be dangerous versus using the datepart function".
|
|
|
Awesome!
|
|
|
why use getutcdate and not getdate?
|
|
Sara Karasik on
3/11/2010
Really well presented, but way, way to simple and beginner level.
|
|
|
I know I need this one
|
|
|
I knew most of this but found the part about passing in a parameter value very helpful - I didn't know that piece. thank you very much - Denise
|
|
|
I always use the date formate dd-MMM-yyyy, as that always converts correctly. I created a function that always returns this date format, and I never have to worry about the culture of the box
|
|
|
Excellent video. Thanks.
|
|
|
Useful information but it didn't blow my mind...gave it a 3.
|
|
|
Keep these things coming!!!
|
|
|
I am new to sql right now, so this is beyond my skill set.
|
|
|
This is good stuff and very helpful. Thank you for sharing and keep up the good work.
|
|
|
Very helpful. I would be helpful if the examples could be downloaded.
|
|
|
It was a good video. I have a very slow connection, but it helped having the code written out, highlighted and executed. Thank you.
|
|
|
When the results pane will obscure the code in the query window, please scroll down so that the code remains in view as you get a results pane. This would help those of us who are a little slow or who cannot remember what we saw for a very brief time. Thanks. Andy, you do an outstanding job on these!! Diana Dee
|
|
|
Great series of videos - really appreciate the work you put into them. SO I don't want to appear 'picky', but your "prove it returns a string" example - uses DATEPART(), rather than DATENAME() - although the end result is the same ;-)
Additionally, probably too complex, but your last example could be achieved using Dynamic SQL.....
Like I said - love your work.
Andy
|
|
luther smith on
3/15/2010
Simple and clear.
|
|
|
I believe you have a mistake/oversight - you forgot to change "datepart" to "datename" in the "prove it returns a string" block.
What really matters is the datatype of your variable as these have identical results:
declare @YearInt int
declare @YearStr varchar(20)
select @YearInt = datename(yyyy,getutcdate())
select @YearStr = datename(yyyy,getutcdate())
select @YearInt, @YearStr
select @YearInt +10, @YearStr + 10
select @YearInt = datepart(yyyy,getutcdate())
select @YearStr = datepart(yyyy,getutcdate())
select @YearInt, @YearStr
select @YearInt +10, @YearStr + 10
|
|
|
getting the datepart back as on int---I've always done gross manipulated because I was changing it to a varchar
|
|
|
Well done. Very good point about maintaining integrity of values if inputted format of date data changes.
|