Viewing 15 posts - 3,886 through 3,900 (of 7,636 total)
Yep, it's true, the OUTPUT clause cannot pull from your input sources, only the data that you are already outputting.
When I've been in your situation, I have always...
January 14, 2009 at 6:57 am
Oops, that was my mistake in the solution that I posted.
January 14, 2009 at 6:51 am
Well, you can use Dynamic SQL, but it's a possible security risk.
January 13, 2009 at 9:22 pm
Greg Edwards (1/13/2009)
Heads on a stick. Looks like something at the State Fair.Just hope one isn't my head.:w00t:
Greg E
What's that? Come closer so my light saber can hear you...
😀
January 13, 2009 at 8:48 pm
This'll do it:
Select PatID, Date_Time, Sodium
From bga
Where PatID IN(Select b2.PatID
From bga b2
Where 135.0 > b2.Sodium
And b2.Date_Time = (Select Min(b3.Date_Time)
From bga b3
Where b3.PatID = b2.PatID))
Order By PatID,...
January 13, 2009 at 8:45 pm
Grant Fritchey (1/13/2009)
Seems a little extreme... two words, Guy Fawkes.
Hey! That's my birthday!
January 13, 2009 at 8:13 pm
OK, here's, that:
Select [Year]
, [Month]
, Count(*) as [Monthly Records]
, SUM(Expenditure) as [Monthly Expenditures]
, Count(Distinct Doctor) as [Total Doctors]
From YourTable
Group By [Year], [Month]
January 13, 2009 at 8:11 pm
OK, like this:
Select [Year], [Month], SUM(Expenditure)/Count(Distinct Doctor)
From YourTable
Group By [Year], [Month]
January 13, 2009 at 7:29 pm
Ah, well, that's not a moving average, that's just an average, hang on...
January 13, 2009 at 7:19 pm
There are a lot of different "moving averages", how do you want yours to be defined?
January 13, 2009 at 6:35 pm
In SQL, CASE is a function and not a statement:
Select @myDate = CASE
WHEN @monthInput=1 THEN SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,@curDate))-1),DATEADD(mm,1,@curDate)),101)
WHEN @monthInput=2 THEN SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,@curDate))-1),DATEADD(mm,2,@curDate)),101)
Else @curDate
END
January 13, 2009 at 5:08 pm
More like this:
CREATE TRIGGER Insert_ApprovedDate
ON Request FOR INSERT
AS
Update r
Set dateApproved = getdate()
From Request r
Join inserted i ON i.PK...
January 13, 2009 at 2:26 pm
Yes, how many values can be in this column?
January 13, 2009 at 2:08 pm
Viewing 15 posts - 3,886 through 3,900 (of 7,636 total)