August 5, 2015 at 9:38 am
Ed Wagner (8/5/2015)
Jack Corbett (8/5/2015)
I couldn't answer all the questions, but I don't expect to be able to answer every question in an interview. I would think I'd pass the lab but I'd use the internet, expecially for the delimited string work. I've done it multiple times, but not regularly enough that I remember how, I just look it up.I'm in the same boat as you with the building a delimited string from multiple rows. I just consult my previous code.
A similar situation applies to date math, which I've tested nearly to death. I do some of the more frequent ones from memory, but I also have Lynn's page[/url] bookmarked when I can't remember one of them. It's one of my most useful pages I keep on hand at all times.
Start writing those queries from memory and you should look at any instance as an opportunity for refactoring, take it apart, reassemble, minor adjustments and tweaks, never think that it is perfect.
😎
August 5, 2015 at 9:50 am
Ed Wagner (8/5/2015)
SQLRNNR (8/5/2015)
Sean Lange (8/5/2015)
Ed Wagner (8/5/2015)
Jack Corbett (8/5/2015)
I couldn't answer all the questions, but I don't expect to be able to answer every question in an interview. I would think I'd pass the lab but I'd use the internet, expecially for the delimited string work. I've done it multiple times, but not regularly enough that I remember how, I just look it up.I'm in the same boat as you with the building a delimited string from multiple rows. I just consult my previous code.
A similar situation applies to date math, which I've tested nearly to death. I do some of the more frequent ones from memory, but I also have Lynn's page[/url] bookmarked when I can't remember one of them. It's one of my most useful pages I keep on hand at all times.
That one is so useful I created a proc to return the code so I don't even have to open a browser. 😀
Oh, I like that idea!
You mean like this? 😉 I pulled it from my dba database. It's sometimes easier to just hit the page.
ALTER procedure [dbo].[CommonDates]
as
BEGIN
SELECT Description, SQL
FROM (VALUES('DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)', 'Beginning of this day'),
('DATEADD(day, DATEDIFF(day, 0, GETDATE()) + 1, 0)', 'Beginning of next day'),
('DATEADD(day, DATEDIFF(day, 0, GETDATE()) - 1, 0)', 'Beginning of previous day'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()), 0)' , 'Beginning of this week (Monday)'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()) + 1, 0)', 'Beginning of next week (Monday)'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()) - 1, 0)', 'Beginning of previous week (Monday)'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0)' , 'Beginning of this month'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()) + 1, 0)', 'Beginning of next month'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()) - 1, 0)', 'Beginning of previous month'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()), 0)' , 'Beginning of this quarter (Calendar)'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()) + 1, 0)', 'Beginning of next quarter (Calendar)'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()) - 1, 0)', 'Beginning of previous quarter (Calendar)'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()), 0)' , 'Beginning of this year'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()) + 1, 0)', 'Beginning of next year'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()) - 1, 0)', 'Beginning of previous year')
) x(SQL, Description);
END;
go
I think I'm not the only one who really appreciates that page.
Yes. That is almost exactly what I have in mine. Nothing like keeping some of our tools close to our finger tips.
This brings to light the challenges I would have with Wayne's interview. Unless I had my own utility db I would be scrambling to find some of the resources I am so used to having. Things like this, DelimitedSplit8K, my tally table view etc...I could recreate most of them but it would not be nearly as easy. Without that db and my bookmarks I would be in a world of trouble.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 5, 2015 at 9:56 am
Sean Lange (8/5/2015)
Ed Wagner (8/5/2015)
SQLRNNR (8/5/2015)
Sean Lange (8/5/2015)
Ed Wagner (8/5/2015)
Jack Corbett (8/5/2015)
I couldn't answer all the questions, but I don't expect to be able to answer every question in an interview. I would think I'd pass the lab but I'd use the internet, expecially for the delimited string work. I've done it multiple times, but not regularly enough that I remember how, I just look it up.I'm in the same boat as you with the building a delimited string from multiple rows. I just consult my previous code.
A similar situation applies to date math, which I've tested nearly to death. I do some of the more frequent ones from memory, but I also have Lynn's page[/url] bookmarked when I can't remember one of them. It's one of my most useful pages I keep on hand at all times.
That one is so useful I created a proc to return the code so I don't even have to open a browser. 😀
Oh, I like that idea!
You mean like this? 😉 I pulled it from my dba database. It's sometimes easier to just hit the page.
ALTER procedure [dbo].[CommonDates]
as
BEGIN
SELECT Description, SQL
FROM (VALUES('DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)', 'Beginning of this day'),
('DATEADD(day, DATEDIFF(day, 0, GETDATE()) + 1, 0)', 'Beginning of next day'),
('DATEADD(day, DATEDIFF(day, 0, GETDATE()) - 1, 0)', 'Beginning of previous day'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()), 0)' , 'Beginning of this week (Monday)'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()) + 1, 0)', 'Beginning of next week (Monday)'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()) - 1, 0)', 'Beginning of previous week (Monday)'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0)' , 'Beginning of this month'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()) + 1, 0)', 'Beginning of next month'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()) - 1, 0)', 'Beginning of previous month'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()), 0)' , 'Beginning of this quarter (Calendar)'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()) + 1, 0)', 'Beginning of next quarter (Calendar)'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()) - 1, 0)', 'Beginning of previous quarter (Calendar)'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()), 0)' , 'Beginning of this year'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()) + 1, 0)', 'Beginning of next year'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()) - 1, 0)', 'Beginning of previous year')
) x(SQL, Description);
END;
go
I think I'm not the only one who really appreciates that page.
Yes. That is almost exactly what I have in mine. Nothing like keeping some of our tools close to our finger tips.
This brings to light the challenges I would have with Wayne's interview. Unless I had my own utility db I would be scrambling to find some of the resources I am so used to having. Things like this, DelimitedSplit8K, my tally table view etc...I could recreate most of them but it would not be nearly as easy. Without that db and my bookmarks I would be in a world of trouble.
I had an interview with Microsoft about 5 years ago or so (obviously didn't get the job) and they allow you to have a thumb drive with scripts, access to the internet etc. My problem writing code to create a comma delimit result set? One, I couldn't find the code on the web. Two, I didn't know I could have a thumb drive until I got there for the interview. And three, I didn't have it memorized.
I have been using the code for creating comma delimited results sets so many times now here that I have it memorized. I use it for more than just that, using it to generate dynamic SQL queries as well. Use something enough it becomes easy to remember. Bring on Microsoft this time with that same question!
August 5, 2015 at 10:08 am
Okay, someone wanted a loop, I thought I'd toss out something else, just not quite the complete answer they were looking for. Let's see if they can take the hint and build on it.
August 5, 2015 at 10:10 am
Sean Lange (8/5/2015)
Ed Wagner (8/5/2015)
SQLRNNR (8/5/2015)
Sean Lange (8/5/2015)
Ed Wagner (8/5/2015)
Jack Corbett (8/5/2015)
I couldn't answer all the questions, but I don't expect to be able to answer every question in an interview. I would think I'd pass the lab but I'd use the internet, expecially for the delimited string work. I've done it multiple times, but not regularly enough that I remember how, I just look it up.I'm in the same boat as you with the building a delimited string from multiple rows. I just consult my previous code.
A similar situation applies to date math, which I've tested nearly to death. I do some of the more frequent ones from memory, but I also have Lynn's page[/url] bookmarked when I can't remember one of them. It's one of my most useful pages I keep on hand at all times.
That one is so useful I created a proc to return the code so I don't even have to open a browser. 😀
Oh, I like that idea!
You mean like this? 😉 I pulled it from my dba database. It's sometimes easier to just hit the page.
ALTER procedure [dbo].[CommonDates]
as
BEGIN
SELECT Description, SQL
FROM (VALUES('DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)', 'Beginning of this day'),
('DATEADD(day, DATEDIFF(day, 0, GETDATE()) + 1, 0)', 'Beginning of next day'),
('DATEADD(day, DATEDIFF(day, 0, GETDATE()) - 1, 0)', 'Beginning of previous day'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()), 0)' , 'Beginning of this week (Monday)'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()) + 1, 0)', 'Beginning of next week (Monday)'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()) - 1, 0)', 'Beginning of previous week (Monday)'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0)' , 'Beginning of this month'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()) + 1, 0)', 'Beginning of next month'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()) - 1, 0)', 'Beginning of previous month'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()), 0)' , 'Beginning of this quarter (Calendar)'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()) + 1, 0)', 'Beginning of next quarter (Calendar)'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()) - 1, 0)', 'Beginning of previous quarter (Calendar)'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()), 0)' , 'Beginning of this year'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()) + 1, 0)', 'Beginning of next year'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()) - 1, 0)', 'Beginning of previous year')
) x(SQL, Description);
END;
go
I think I'm not the only one who really appreciates that page.
Yes. That is almost exactly what I have in mine. Nothing like keeping some of our tools close to our finger tips.
This brings to light the challenges I would have with Wayne's interview. Unless I had my own utility db I would be scrambling to find some of the resources I am so used to having. Things like this, DelimitedSplit8K, my tally table view etc...I could recreate most of them but it would not be nearly as easy. Without that db and my bookmarks I would be in a world of trouble.
Script your database and then just use it to create your database during the interview. 😉
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
August 5, 2015 at 10:29 am
SQLRNNR (8/5/2015)
Sean Lange (8/5/2015)
Ed Wagner (8/5/2015)
SQLRNNR (8/5/2015)
Sean Lange (8/5/2015)
Ed Wagner (8/5/2015)
Jack Corbett (8/5/2015)
I couldn't answer all the questions, but I don't expect to be able to answer every question in an interview. I would think I'd pass the lab but I'd use the internet, expecially for the delimited string work. I've done it multiple times, but not regularly enough that I remember how, I just look it up.I'm in the same boat as you with the building a delimited string from multiple rows. I just consult my previous code.
A similar situation applies to date math, which I've tested nearly to death. I do some of the more frequent ones from memory, but I also have Lynn's page[/url] bookmarked when I can't remember one of them. It's one of my most useful pages I keep on hand at all times.
That one is so useful I created a proc to return the code so I don't even have to open a browser. 😀
Oh, I like that idea!
You mean like this? 😉 I pulled it from my dba database. It's sometimes easier to just hit the page.
ALTER procedure [dbo].[CommonDates]
as
BEGIN
SELECT Description, SQL
FROM (VALUES('DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)', 'Beginning of this day'),
('DATEADD(day, DATEDIFF(day, 0, GETDATE()) + 1, 0)', 'Beginning of next day'),
('DATEADD(day, DATEDIFF(day, 0, GETDATE()) - 1, 0)', 'Beginning of previous day'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()), 0)' , 'Beginning of this week (Monday)'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()) + 1, 0)', 'Beginning of next week (Monday)'),
('DATEADD(week, DATEDIFF(week, 0, GETDATE()) - 1, 0)', 'Beginning of previous week (Monday)'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0)' , 'Beginning of this month'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()) + 1, 0)', 'Beginning of next month'),
('DATEADD(month, DATEDIFF(month, 0, GETDATE()) - 1, 0)', 'Beginning of previous month'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()), 0)' , 'Beginning of this quarter (Calendar)'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()) + 1, 0)', 'Beginning of next quarter (Calendar)'),
('DATEADD(quarter, DATEDIFF(quarter, 0, GETDATE()) - 1, 0)', 'Beginning of previous quarter (Calendar)'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()), 0)' , 'Beginning of this year'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()) + 1, 0)', 'Beginning of next year'),
('DATEADD(year, DATEDIFF(year, 0, GETDATE()) - 1, 0)', 'Beginning of previous year')
) x(SQL, Description);
END;
go
I think I'm not the only one who really appreciates that page.
Yes. That is almost exactly what I have in mine. Nothing like keeping some of our tools close to our finger tips.
This brings to light the challenges I would have with Wayne's interview. Unless I had my own utility db I would be scrambling to find some of the resources I am so used to having. Things like this, DelimitedSplit8K, my tally table view etc...I could recreate most of them but it would not be nearly as easy. Without that db and my bookmarks I would be in a world of trouble.
Script your database and then just use it to create your database during the interview. 😉
Just don't forget to drop the database when the interview is over. 😉
I'm in the same boat. I'd be in trouble without the tools I've built that I've come to rely on all the time. I could rebuild some of them from memory, but not without more time than it would take for an interview.
August 5, 2015 at 10:52 am
I don't necessarily have everything in a utility database, but I do have a bunch of things I use regularly as snippets in SQL Prompt. Like Itzik's virtual numbers table. I tend to add things on a pretty regular basis.
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
August 5, 2015 at 11:47 am
Snippets and a whole pile of script files saved in DropBox and on a creditcard-shaped flash drive (which I need to update).
And to get back on topic:
"What book do I read to become expert on advanced database internals" (paraphrased)
I don't think my reply of "All of them" was appreciated.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 5, 2015 at 11:58 am
GilaMonster (8/5/2015)
Snippets and a whole pile of script files saved in DropBox and on a creditcard-shaped flash drive (which I need to update).And to get back on topic:
"What book do I read to become expert on advanced database internals" (paraphrased)
I don't think my reply of "All of them" was appreciated.
What, you mean there's no magic "you're an expert now" book for SQL?
Ideally in a Cliffs' Notes edition?
August 5, 2015 at 12:11 pm
jasona.work (8/5/2015)
GilaMonster (8/5/2015)
Snippets and a whole pile of script files saved in DropBox and on a creditcard-shaped flash drive (which I need to update).And to get back on topic:
"What book do I read to become expert on advanced database internals" (paraphrased)
I don't think my reply of "All of them" was appreciated.
What, you mean there's no magic "you're an expert now" book for SQL?
Ideally in a Cliffs' Notes edition?
Here's a method to learn any programming language in 21 days.
If image is not visible, you can find it here.
August 5, 2015 at 12:18 pm
jasona.work (8/5/2015)
GilaMonster (8/5/2015)
Snippets and a whole pile of script files saved in DropBox and on a creditcard-shaped flash drive (which I need to update).And to get back on topic:
"What book do I read to become expert on advanced database internals" (paraphrased)
I don't think my reply of "All of them" was appreciated.
What, you mean there's no magic "you're an expert now" book for SQL?
Ideally in a Cliffs' Notes edition?
I'm sorry, I'll get on that right away for you. It should be done in about 8 years.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 5, 2015 at 12:21 pm
GilaMonster (8/5/2015)
jasona.work (8/5/2015)
GilaMonster (8/5/2015)
Snippets and a whole pile of script files saved in DropBox and on a creditcard-shaped flash drive (which I need to update).And to get back on topic:
"What book do I read to become expert on advanced database internals" (paraphrased)
I don't think my reply of "All of them" was appreciated.
What, you mean there's no magic "you're an expert now" book for SQL?
Ideally in a Cliffs' Notes edition?
I'm sorry, I'll get on that right away for you. It should be done in about 8 years.
And by then it will be out of date and you'll have to start all over. :w00t:
August 5, 2015 at 12:24 pm
Luis Cazares (8/5/2015)
jasona.work (8/5/2015)
GilaMonster (8/5/2015)
Snippets and a whole pile of script files saved in DropBox and on a creditcard-shaped flash drive (which I need to update).And to get back on topic:
"What book do I read to become expert on advanced database internals" (paraphrased)
I don't think my reply of "All of them" was appreciated.
What, you mean there's no magic "you're an expert now" book for SQL?
Ideally in a Cliffs' Notes edition?
Here's a method to learn any programming language in 21 days.
If image is not visible, you can find it here.
Okay, Luis, that's simply awesome. 😀
August 5, 2015 at 12:42 pm
GilaMonster (8/5/2015)
jasona.work (8/5/2015)
GilaMonster (8/5/2015)
Snippets and a whole pile of script files saved in DropBox and on a creditcard-shaped flash drive (which I need to update).And to get back on topic:
"What book do I read to become expert on advanced database internals" (paraphrased)
I don't think my reply of "All of them" was appreciated.
What, you mean there's no magic "you're an expert now" book for SQL?
Ideally in a Cliffs' Notes edition?
I'm sorry, I'll get on that right away for you. It should be done in about 8 years.
That won't work, I need it yesterday because I screen-scraped a couple blogs (this one: http://www.scarydba.com/ and this one: http://sqlinthewild.co.za/) and pawned them off as my own to get a DBA job!
(I KID! I'd never do such a thing! Please don't kill me!)
On a side note, anyone want my summer cold? I'll even drive to your house and deliver it in person...
August 5, 2015 at 12:48 pm
I am entry level.First, I want to gain knowledge on internals of log shipping and internals of mirroring. So,Please suggest good books to start with
I'm so tempted to say Books Online 😀
Viewing 15 posts - 49,891 through 49,905 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply