March 31, 2014 at 6:56 am
jasona.work (3/31/2014)
ChrisM@Work (3/31/2014)
Way back in the early 90's many of us FoxPro programmers waited with bated breath for MS' release of a product which included a crude implementation of SQL. After all, why scan and process a table one row at a time for a report or whatever when you could process the whole lot in one go? When it arrived it was a game-changer. Same result, far less code, far better performance. If you are looking for folks who can do both procedural and set-based, look no further than programmers who cut their teeth on FoxPro and VFP - and grabbed SQL with both hands when it appeared.OK, but what about the Foxpro programmers who stayed stuck in the "row-by-row" mentality?
Which, I think just described my previous employer...
:hehe:
They would be the worst offenders Jason because, with more than a decade to get it right and still failing, there's no hope - hence the disclaimer π
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 31, 2014 at 7:29 am
jasona.work (3/31/2014)
ChrisM@Work (3/31/2014)
Way back in the early 90's many of us FoxPro programmers waited with bated breath for MS' release of a product which included a crude implementation of SQL. After all, why scan and process a table one row at a time for a report or whatever when you could process the whole lot in one go? When it arrived it was a game-changer. Same result, far less code, far better performance. If you are looking for folks who can do both procedural and set-based, look no further than programmers who cut their teeth on FoxPro and VFP - and grabbed SQL with both hands when it appeared.OK, but what about the Foxpro programmers who stayed stuck in the "row-by-row" mentality?
Which, I think just described my previous employer...
:hehe:
I don't remember you from my first job π
I had to quit that job to discover the agonies of RBAR and the greatness of set-based code.
March 31, 2014 at 12:57 pm
I do like paying it forward.
Got an email from friend who was stuck on working out how many days old a debt is at the end of the month, and then flagging any that are 361 days or more.
To my trusty SSC briefcase and Lynn's common date routines, to work out the last day of the month... Because I don't remember them, just need to remember Lynn wrote an article on them! :w00t:
Cheers again to the forum and people taking the time to answer questions and post articles
Rodders...
March 31, 2014 at 1:08 pm
rodjkidd (3/31/2014)
I do like paying it forward.Got an email from friend who was stuck on working out how many days old a debt is at the end of the month, and then flagging any that are 361 days or more.
To my trusty SSC briefcase and Lynn's common date routines, to work out the last day of the month... Because I don't remember them, just need to remember Lynn wrote an article on them! :w00t:
Cheers again to the forum and people taking the time to answer questions and post articles
Rodders...
I know this article well. It has come in handy many times.
March 31, 2014 at 3:23 pm
Ed Wagner (3/31/2014)
rodjkidd (3/31/2014)
I do like paying it forward.Got an email from friend who was stuck on working out how many days old a debt is at the end of the month, and then flagging any that are 361 days or more.
To my trusty SSC briefcase and Lynn's common date routines, to work out the last day of the month... Because I don't remember them, just need to remember Lynn wrote an article on them! :w00t:
Cheers again to the forum and people taking the time to answer questions and post articles
Rodders...
I know this article well. It has come in handy many times.
+1
In fact, I have referred to that article so many times I just created myself a stored proc to return the info to me without having to load the page. π
create procedure [dbo].[CommonDateRoutines] as
select 'dateadd(dd, datediff(dd, 0, @ThisDate), 0)' as 'Beginning of this day'
, 'dateadd(dd, datediff(dd, 0, @ThisDate) + 1, 0)' as 'Beginning of next day'
, 'dateadd(dd, datediff(dd, 0, @ThisDate) - 1, 0)' as 'Beginning of previous day'
, 'dateadd(wk, datediff(wk, 0, @ThisDate), 0)' as 'Beginning of this week (Monday)'
, 'dateadd(wk, datediff(wk, 0, @ThisDate) + 1, 0)' as 'Beginning of next week (Monday)'
, 'dateadd(wk, datediff(wk, 0, @ThisDate) - 1, 0)' as 'Beginning of previous week (Monday)'
, 'dateadd(mm, datediff(mm, 0, @ThisDate), 0)' as 'Beginning of this month'
, 'dateadd(mm, datediff(mm, 0, @ThisDate) + 1, 0)' as 'Beginning of next month'
, 'dateadd(mm, datediff(mm, 0, @ThisDate) - 1, 0)' as 'Beginning of previous month'
, 'dateadd(qq, datediff(qq, 0, @ThisDate), 0)' as 'Beginning of this quarter (Calendar)'
, 'dateadd(qq, datediff(qq, 0, @ThisDate) + 1, 0)' as 'Beginning of next quarter (Calendar)'
, 'dateadd(qq, datediff(qq, 0, @ThisDate) - 1, 0)' as 'Beginning of previous quarter (Calendar)'
, 'dateadd(yy, datediff(yy, 0, @ThisDate), 0)' as 'Beginning of this year'
, 'dateadd(yy, datediff(yy, 0, @ThisDate) + 1, 0)' as 'Beginning of next year'
, 'dateadd(yy, datediff(yy, 0, @ThisDate) - 1, 0)' as 'Beginning of previous year'
_______________________________________________________________
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/
March 31, 2014 at 3:26 pm
Ed Wagner (3/31/2014)
rodjkidd (3/31/2014)
I do like paying it forward.Got an email from friend who was stuck on working out how many days old a debt is at the end of the month, and then flagging any that are 361 days or more.
To my trusty SSC briefcase and Lynn's common date routines, to work out the last day of the month... Because I don't remember them, just need to remember Lynn wrote an article on them! :w00t:
Cheers again to the forum and people taking the time to answer questions and post articles
Rodders...
I know this article well. It has come in handy many times.
Good deal, Rodders. π
Things like this are why I love my SSC Briefcase.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
March 31, 2014 at 3:43 pm
The Dixie Flatline (3/31/2014)
Ed Wagner (3/31/2014)
rodjkidd (3/31/2014)
I do like paying it forward.Got an email from friend who was stuck on working out how many days old a debt is at the end of the month, and then flagging any that are 361 days or more.
To my trusty SSC briefcase and Lynn's common date routines, to work out the last day of the month... Because I don't remember them, just need to remember Lynn wrote an article on them! :w00t:
Cheers again to the forum and people taking the time to answer questions and post articles
Rodders...
I know this article well. It has come in handy many times.
Good deal, Rodders. π
Things like this are why I love my SSC Briefcase.
And I think between us we have just summed up the community and SSC!
Sean, neat wrapping it up in a proc, worth adding to a DB_Admin db.
Not quite the same thing, but it reminded me of a company I worked at years ago. We had an open call on the call logging system from when they first started using it. It contained the contact details of a local cake shop that delivered. Made life really easy on birthdays, made a small mess of call stats though π
Rodders...
March 31, 2014 at 3:47 pm
Sean, neat wrapping it up in a proc, worth adding to a DB_Admin db.
Yep that's where I keep it. π
_______________________________________________________________
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/
April 1, 2014 at 2:43 am
Sean Lange (3/31/2014)
Sean, neat wrapping it up in a proc, worth adding to a DB_Admin db.
Yep that's where I keep it. π
Cool.
Always find it funny when I start a new gig and they "oh by the way we have an admin db as part of our build, you may not have come across the concept before..." π
Rodders...
April 1, 2014 at 2:50 am
So my friend has had an internal job move while on maternity leave. In fact she went back to find that her part of the telco business has been sold to another telco. I think she's on company no 15 or something since leaving school - never quit, never been made redundant. Which always makes me chuckle...
Anyway, they have a habit of doing this, oh you know X you can now work with Y and can you get the following things done.
So I told her where the date routines came from and by whom (as I said pay it forward), but I think she's overwhelmed at the moment
Baby, back to work, new house, new company and new role! Nothing like taking it easy.
So it might take a little while for the SSC reference to sink in! π
I also joked that she didn't give me any test data, so I made some up (create TABLE INSERT etc), and said it works with the test data I'd provided!
Also it was a nice example of breaking down the problem, need to now if the debt will be 361 or more days old at the end of the month and flag it. I think she tried to tackle it in one go.
So I explained how I went about working out the answer - as I don't like giving solutions with no explanation. Fish, Give, Rod, Day, Life etc. re-arrange into well known saying!
I might post it and see if anyone can come up with a better solution - I would guess so.
Rodders...
April 1, 2014 at 3:02 am
I'm watching an introductory course (on Pluralsight) on a new language, and the introduction is almost enough to make me ditch the language and never look at it again.
"... the most elegant language you'll find"
"... you'll never want to program in anything else..."
".. powerful, expressive, it makes programming fun again..."
I'm after a different programming language, not a @#$% religious experience for crying out loud.
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
April 1, 2014 at 3:09 am
GilaMonster (4/1/2014)
I'm watching an introductory course (on Pluralsight) on a new language, and the introduction is almost enough to make me ditch the language and never look at it again."... the most elegant language you'll find"
"... you'll never want to program in anything else..."
".. powerful, expressive, it makes programming fun again..."
I'm after a different programming language, not a @#$% religious experience for crying out loud.
What if they are telling the truth? :w00t:
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 1, 2014 at 3:52 am
GilaMonster (4/1/2014)
".. powerful, expressive, it makes programming fun again..."
I take issue with that statement--you can have fun programming in raw assembly language if you find the subject of the program interesting; conversely, the most glorious language in the world isn't going a save a boring project!
April 1, 2014 at 4:03 am
Ok...
"The language is expressive, easily readable and values explicitness. Abbreviations and corrupted spelling should be avoided in variable names"
and the string data type is 'str'
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
April 1, 2014 at 4:22 am
GilaMonster (4/1/2014)
Ok..."The language is expressive, easily readable and values explicitness. Abbreviations and corrupted spelling should be avoided in variable names"
and the string data type is 'str'
<snicker>
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 15 posts - 43,531 through 43,545 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply