jasona.work (5/22/2015)
Jeff Moden (6/6/2014)
thomashohner (6/6/2014)
kimberly_lehman (6/6/2014)
Ask "Using T-SQL, how do you get the current date and time"?
So would you consider this a valid answer? "I think it's CURRENT TIMESTAMP but if I was blanking on it I'd google it to be sure."
I've worked with so many language that sometimes I mix them up, so I often google things even if I know them. And sometimes even when I "know" something, a quick search reminds me of something I forgot. IMO, knowing how to find the information you need is just as valuable as already knowing it. And double checking yourself is a good skill too. If you've never forgotten a simple piece of syntax, then you never had a baby who didn't sleep through the night.
I believe GETDATE() is specific to T-SQL and CURRENT_TIMESTAMP is ANSI SQL function.
I think still learning
Now, that's the kind of answer that I'd expect from someone applying for a Senior position. I'd also expect them to just automatically cough up some extra info about UTC dates and times, etc. If they just say "GETDATE()" or just "CURRENT_TIMESTAMP", then they're probably not at the level I'm looking for for a Senior SQL Developer or a Senior DBA. Either is fine for a front-end developer position but they'd better know one of the two for a Senior front-end position that requires "some knowledge of SQL".
Like I said, you can tell a whole lot by asking questions at the start.
So would I be correct in presuming that a reason to use CURRENT_TIMESTAMP instead of GETDATE() would be code portability? Making it (somewhat) easier if you need to migrate / run the query against say a SQL server and an Oracle server?
If you believe in the myth of code portability, then yes... it would be one less thing to change.
--Jeff Moden
Change is inevitable... Change for the better is not.