Viewing 15 posts - 9,226 through 9,240 (of 59,099 total)
This should do, short and simple 😉 😎
USE TEEST;
GO
SET NOCOUNT ON;
GO
DECLARE @MYDATE DATE = '20190101';
;WITH TDATES AS
(
SELECT DATEFROMPARTS(
DATEPART(YEAR,@MYDATE)
...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 1, 2019 at 5:41 pm
Also, I missed the final post by Des Norton. Tested that in the same manner as I did previously and his code also also seems to work correctly.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 1, 2019 at 1:25 pm
Heh... that's what you get for posting PowerShell on an SQL Forum. 😀 😀 😀
The problem is very likely the use of both carriage return and line feed (newline) from...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 1, 2019 at 6:27 am
Provided that they're not too long, you could use "Extended Properties" (in SQL Server, anyway) to keep track of things. Another method would be to actually store certain documentation in...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 1, 2019 at 6:21 am
Whew! Still checking but the same August 1954 output from the function I built lists things as the OP requested.

So does September 1954...
--Jeff Moden Change is inevitable... Change for the better is not.
RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
Helpful Links:
How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)
June 1, 2019 at 5:39 am
Ah... crud. Sorry... I have to take back what I said about Chris' code. I noticed that he was using a DATEADD of 27 days in the final result and...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 1, 2019 at 5:18 am
Shifting gears, I expanded the test dates on Chris' good code and it seems to handle the "leading" edge cases in the places I looked. He also did it in...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 1, 2019 at 4:45 am
p.s.
Here's what the output looks like. The highlighted row is the "leading" edge case that I spoke of in my previous post. As you can see below, the function I...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 1, 2019 at 4:33 am
Hi I have a requirement to calculate the start and end of the working Month, The criteria is that if the 1st of the Month is a Monday then...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 1, 2019 at 4:19 am
I created a table for the server connection strings.
Does that table contain login names and passwords?
--Jeff Moden
Change is inevitable... Change for the better is not.
May 31, 2019 at 10:06 pm
It's likely that it's a version thing then, and certainly, likely to be 2014+ since that's when the cardinality estimation engine changed. Funny enough, Pinal's advice is the opposite...
--Jeff Moden
Change is inevitable... Change for the better is not.
May 30, 2019 at 11:20 pm
if I set "set STATISTICS IO on" , and execute one SQL Query statement it shows as below, can you say it took 1767*8kb memory when runing this state...
--Jeff Moden
Change is inevitable... Change for the better is not.
May 30, 2019 at 11:01 pm
No problem. Thanks for the question and the feedback.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 30, 2019 at 10:56 pm
Some people are of the opinion that if you have to go back and forth a few times in email then you are better off picking up the phone...
--Jeff Moden
Change is inevitable... Change for the better is not.
May 30, 2019 at 6:59 pm
Not only would I follow that advice, but I'd have that discussion in person then follow up with a bulleted email of the "requirements" discussed, asking for the...
--Jeff Moden
Change is inevitable... Change for the better is not.
May 30, 2019 at 6:25 pm
Viewing 15 posts - 9,226 through 9,240 (of 59,099 total)