Viewing 15 posts - 91 through 105 (of 153 total)
I'd read up on the virtual tables "inserted" and "deleted" that are available to you in triggers.
January 31, 2008 at 7:39 pm
Sometimes putting an additional filter, even on a constant, in your join clause is the only way to go. Consider the following:
Your boss asks for a data extract of all...
January 31, 2008 at 3:05 pm
Does this help?
Select ProcessDate
,[1to500] = count(case when amount between 1 and 500 then amount else null end)
,[501to1000] = count(case when amount between 501 and 1000 then amount else null end)
...
From
RPTView
where...
January 31, 2008 at 8:33 am
You can do something like this:
Use AdventureWorks
GO
Declare @OrderBy tinyint
Set @OrderBy = 1
SELECT [ContactID]
,[NameStyle]
,[Title]
...
January 28, 2008 at 1:59 pm
Cool. I'll have to stuff this one in my bag of tricks.
Thanks!
January 28, 2008 at 1:47 pm
you could do something horrid like:
LTrim(IsNull(@Val, '')) <> ''
Which would catch NULLs and space only input.
Anyone got some better ones?
January 28, 2008 at 1:44 pm
Matt,
This is quite a novel approach to getting a list of numbers:
select top 745 -- 31 days *24 hours +1
identity(int,0,1)...
January 28, 2008 at 1:05 pm
Try adding a GROUP BY clause to the query. It is missing from mine.
January 28, 2008 at 12:37 pm
Do you think something like this would work?
Declare @varday SMALLDATETIME
set @varday='01/01/2008 11:00:00'
Select count(PRIM_KEY_TRANSACTIONID)
From
(
Select Dateadd(hh, Hourvalue, Varday) VarDay
From
(
Select @varday Varday
) tab1
cross join
(
/*create a temp table populated with all of the...
January 28, 2008 at 9:24 am
I usually get this error when I'm connecting to SQL Server using Windows Authentication. When you make your DSN are you using windows authentication, or SQL Server authentication? Also, check...
January 28, 2008 at 6:49 am
I used Todd's quick and dirty ASP.NET code, and it worked like a charm.
Thank you all!
January 25, 2008 at 12:23 pm
Ya know, it didn't even occur to me to try that. I'll give it a shot.
January 25, 2008 at 11:08 am
Hmmm...either write code in the client that prevents this, or write code in the SP that ignores it. Perhaps the IF statement could be useful...
January 24, 2008 at 2:39 pm
Jim Russell (1/24/2008)
Would I lose anything by using CTE's just to keep from getting so confused?
I'm not yet a big fan of CTEs. I personally find this more confusing
With Tab1(SalesPersonID
,TotalSales
,OrderYear
,OrderMonth)
as
(
Select...
January 24, 2008 at 10:25 am
I'm a big fan of derived table for this purpose.
consider the following code that runs agains the AdventureWorks database
Declare @StartDate datetime, @EndDate datetime
Select @StartDate = '1/1/2003', @EndDate = '12/31/2003'
Select *,
...
January 24, 2008 at 9:31 am
Viewing 15 posts - 91 through 105 (of 153 total)