August 22, 2020 at 1:45 am
Not sure if this has been done, but I thought I'd have a little fun on a rare day off:
The MSSQL DBA's Prayer:
Our Master, which art in DataCenter
Two-part be thy name
Thy Schema come
Thy backups done
On site, as they are off-site
Select us this getutcdate our dataset
And forgive us our cursors
As we forgive your defaults that impact performance
And lead us not into recursion
But deliver us from corruption
For thine is the atomicity, the consistency and the isolation
For ever and ever
We hope
Heh... yeah... you fit into this crowd just fine. 😀
--Jeff Moden
Change is inevitable... Change for the better is not.
August 27, 2020 at 5:12 pm
You know I've been gone a while when Jeff replies to a question I posted with a Google search!
🙂
September 1, 2020 at 7:39 pm
They say that helping others can also improve one's own learning. Partly for that reason, partly altruistic and partly as another avenue to pick up useful tips, I joined a SQL Facebook group a few weeks ago.
I figured I'm not at the level to be able to contribute much here... yet, with the august, hardcore, greybeards watching threads like hawks, ready to pounce and impart the wisdom of many decades 😀
I really regret it. If you think the questions here can be bad.... has anyone else ever looked? The best questions appear to be a context-free one-liner and maybe a grainy photo of a screen, or handwritten query/exam question/homework/interview assessment question.
On the other hand, it's done wonders for the inferiority complex I've developed reading some of the threads here!
"Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information upon it. When we enquire into any subject, the first thing we have to do is to know what books have treated of it. This leads us to look at catalogues, and at the backs of books in libraries."
— Samuel Johnson
I wonder, would the great Samuel Johnson have replaced that with "GIYF" now?
September 1, 2020 at 7:53 pm
I love the grainy pictures of problems, I send my solutions back in pictures with even lower resolution! Heh maybe I'm just old and cranky but I get a cheap laugh out of it.
September 1, 2020 at 8:05 pm
I love the grainy pictures of problems, I send my solutions back in pictures with even lower resolution! Heh maybe I'm just old and cranky but I get a cheap laugh out of it.
Cheap laughs are the best laughs 😉
"Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information upon it. When we enquire into any subject, the first thing we have to do is to know what books have treated of it. This leads us to look at catalogues, and at the backs of books in libraries."
— Samuel Johnson
I wonder, would the great Samuel Johnson have replaced that with "GIYF" now?
September 6, 2020 at 8:51 pm
Yay!! Just passed my goal of 1,500 points on Stack Overflow which means I can now create a tag for the JsonAutoService C# data access library. I began on August 9th and in 4 weeks I'm now in 4th place overall (username SteveC) for the past 30 days in the sql-server tag.
https://stackoverflow.com/tags/sql-server/topusers
It's been intense. Now that the goal has been met I'm going to relax a little bit over there. I was throwing down like crazy. Phew! Glad the pressure is off and now I can focus on getting the message out about JsonAutoService
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 24, 2020 at 6:45 pm
Ok! Keeping in touch with the original intent of this thread, I've just found the perfect 2nd question to ask people I'm interviewing. It's a perfect fit for my infamous "How do you get the current date and time using T-SQL question that 20 out of 22 candidates couldn't answer before I stopped counting. It's NOT a trick question, either.
No need to pile on... I'm just gobsmacked a bit since it's coming from a person who's been asking questions on SQL Server Central for 2 years implying that they've worked with SQLServer/T-SQL for at least that long...
https://www.sqlservercentral.com/forums/topic/function-code
For those that are interested that don't already know, I ask that first question because it's super easy and I ask it after I explain that I don't ask trick questions, esoteric questions, or "Manhole Cover" questions because I know they're nervous as hell and want to give them something easy. I had no idea that it would become a "litmus strip" test.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 24, 2020 at 7:01 pm
Which of these is your question:
"What does the 101 format produce on a date converted to varchar?"
"How do you convert a date to varchar and format it?"
"What is the worst way you can think of to format a date?"
-------------------------------------------------------------------------------------------------------------------------------------
Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses
September 24, 2020 at 7:28 pm
Time spent working with something does not always reflect how well you have mastered it.
You might want to write a simple Exists / Not Exists query and add something like ‘ Sprinkle some pixie dust here’. Use as a interview question.
I remember as a kid taking the National Math Exam. It was always a mix of easy, some hard, and some trick common sense questions. Fun to see how many stumbled through some of the questions.
September 24, 2020 at 7:31 pm
Which of these is your question:
"What does the 101 format produce on a date converted to varchar?"
"How do you convert a date to varchar and format it?"
"What is the worst way you can think of to format a date?"
Heh... spot on and much appreciated but my question would be "What does this code do"? If they can tell me, my followup question would be "Can you tell me a better way to accomplish what this function was (and I use the term loosely) "designed" to do"? If they don't mention why scalar functions suck, I'll ask them "Why shouldn't this be done in a scalar function"? If they can discuss that intelligently, then I'll ask "What improvements have they made for scalar functions in 2019"?
Every question I ask has a "decision tree" as to what I'm going to ask next and how I get the candidate to get over the jitters and start talking and offering additional information and "opinion" about the things we're discussing.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 25, 2020 at 9:30 am
With regard to DateTimes...
We have a core application, used for legal case management, partly black box. The application always converts the local datetimes, entered into the front end, to UTC Datetime for storage, then converts to local datetime when read. Sensible, it's designed to be used in multiple timezones. We only operate in one timezone, however daylight saving time also causes the conversion of course.
Got that nasty prickly feeling that I've been doing something badly with regard to datetimes for a long time. In my "infancy", and the white heat of becoming Accidental, Lone DBA at the point this system was commissioned, while also having to produce many, many reports from it, I did something I probably should have revisited!
When reporting, we were advised to use the supplied function UTCToLocalTime on dates:
CREATE FUNCTION [dbo].[UTCToLocalTime](@date [DATETIME])
RETURNS [DATETIME] WITH EXECUTE AS CALLER
AS
EXTERNAL NAME [ApplicationNameCLR].[UserDefinedFunctions].[UTCToLocalTime]
GO
Obviously I've never used the function on columns in a JOIN, or WHERE clauses, only in SELECT. The function annoyingly returns '1900-01-01 00:00:00.000' when it encounters a NULL date, so very early on I created (please be gentle):
CREATE FUNCTION [dbo].[udUTCToLocalTime](@date DATETIME)
RETURNS DATETIME
AS
BEGIN
RETURN NULLIF(dbo.UTCToLocalTime(@date),'1900-01-01 00:00:00.000')
END
It's been working well, producing accurate results but I'm sure there is a nasty overhead adding milliseconds to reports. Now I'm wondering whether my time (should I ever get any) would be well spent bypassing the assembly and looking for a way to create my second function using native SQL techniques.
(This is the system which caused me to get hauled over hot coals by JC because it uses a CodeLookup table and I wanted to do a wierd, one-off query using an rCTE to produce a hierarchy of the codes 😉 )
https://www.sqlservercentral.com/forums/topic/unusual-recursive-cte-with-non-unique-codes (JC tongue lashing since removed, I see)
"Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information upon it. When we enquire into any subject, the first thing we have to do is to know what books have treated of it. This leads us to look at catalogues, and at the backs of books in libraries."
— Samuel Johnson
I wonder, would the great Samuel Johnson have replaced that with "GIYF" now?
September 25, 2020 at 2:12 pm
"How do you get the current date and time using T-SQL question that 20 out of 22 candidates couldn't answer before I stopped counting. It's NOT a trick question, either.
Do you mean the current date and time where the interview happens or the datetimeoffset of the SQL Server instance? It is a trick question lol
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 25, 2020 at 2:18 pm
Jeff Moden wrote:"How do you get the current date and time using T-SQL question that 20 out of 22 candidates couldn't answer before I stopped counting. It's NOT a trick question, either.
Do you mean the current date and time where the interview happens or the datetimeoffset of the SQL Server instance?
Heh... exactly. That would have been a good question from the candidate because it would demonstrate that know something about dates and times. Of course, if they answer like that, my retort would be "Excellent question. Tell me how you'd get both using T-SQL".
--Jeff Moden
Change is inevitable... Change for the better is not.
September 25, 2020 at 2:25 pm
Steve Collins wrote:Jeff Moden wrote:"How do you get the current date and time using T-SQL question that 20 out of 22 candidates couldn't answer before I stopped counting. It's NOT a trick question, either.
Do you mean the current date and time where the interview happens or the datetimeoffset of the SQL Server instance?
Heh... exactly. That would have been a good question from the candidate because it would demonstrate that know something about dates and times. Of course, if they answer like that, my retort would be "Excellent question. Tell me how you'd get both using T-SQL".
My "favourite" response ever for that question is "do you mean now?"
😎
With a bit of a pun, my reaction was: "what part of current do you not understand now"
September 25, 2020 at 2:30 pm
My "favourite" response ever for that question is "do you mean now?"
We're in now now
https://www.youtube.com/watch?v=nRGCZh5A8T4
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
Viewing 15 posts - 65,131 through 65,145 (of 66,815 total)
You must be logged in to reply to this topic. Login to reply