Viewing 15 posts - 25,111 through 25,125 (of 26,487 total)
Cursors may be evil, but they may be a necessary evil. Where possible use set based solutions, but sometimes you may find cursors are necessary, and therefore knowing how...
March 10, 2008 at 3:26 pm
Jeff Moden (3/10/2008)
Lynn Pettis (3/10/2008)
SELECT @startdate = CAST('2007' AS DATETIME)
SELECT @enddate = DATEADD(yy,1,CAST('2007' AS DATETIME)) - 1
I...
March 10, 2008 at 3:06 pm
There is possibly an error report somewhere (no I don't know where or its name other than it probably ends in the extension of .txt).
One possiblity here from what I...
March 10, 2008 at 2:59 pm
Could you provide the full text of the error message? With all ...'s it is hard to know what the error actually is.
Thanks
😎
March 10, 2008 at 2:34 pm
DECLARE @ConsultantID VARCHAR(20)
DECLARE @StartDate datetime
DECLARE @EndDate datetime
DECLARE @Year CHAR(4)
SET @ConsultantID = '0000003'
SET @StartDate = NULL
SET @EndDate = NULL
SET @Year = 2007
-- IF @Year <> NULL
-- ...
March 10, 2008 at 2:12 pm
The people you know who celebrate their birthdays on Feb 28 on non-leap years, doesn't mean the state or country they live in says they are another year older yet....
March 10, 2008 at 2:06 pm
Jeff, since the OP wants the end of the year wouldn't you want this:
SELECT @startdate = CAST('2007' AS DATETIME)
SELECT @enddate = DATEADD(yy,1,CAST('2007' AS DATETIME)) - 1
I know why you do...
March 10, 2008 at 1:52 pm
If there is a way to do this without comparing months and day, I just can't find on my and I haven't the energy to search all these posts. ...
March 10, 2008 at 1:29 pm
GSquared, don't think so. Please doupbe check this code snippet to be sure I have your code right:
declare @dob datetime,
@calcDate datetime
set...
March 10, 2008 at 1:08 pm
How about this:
datediff(yy, @dob, @calcDate) - case when (@calcDate < dateadd(yy, datediff(yy, @dob, @calcDate), @dob)) then 1 else 0 end as AgeInYears
Tests:
declare @dob datetime,
...
March 10, 2008 at 1:00 pm
I did say appears to work. That was the leap year test I was missing. thanks
😎
March 10, 2008 at 12:47 pm
Here is a formula that appears to work okay in SQL Server:
datediff(yy, @dob, @calcDate) - case when (datepart(dy, @calcDate) < datepart(dy, @dob)) then 1 else 0...
March 10, 2008 at 12:28 pm
I will add this to the issue at my previous employer: it was an inherited system (was supported by an outside company and brought internal) that was written entirely in...
March 10, 2008 at 10:15 am
If discounts have to be applied in a specific order, it does add to the complexity. Ten percent off of ten percent off, is not twenty percent off:
x =...
March 10, 2008 at 8:57 am
Viewing 15 posts - 25,111 through 25,125 (of 26,487 total)