Viewing 15 posts - 2,716 through 2,730 (of 3,489 total)
This is the logical equivalent of a V/HLOOKUP in Excel. Something like this should work:
DECLARE @SalePrice SMALLMONEY = 250.00;
SELECT MAX(Bonus)
FROM #CompPlan
WHERE HighVal<@SalePrice;
-- sorry, I guess I left one thing...
January 11, 2015 at 6:25 pm
all dbs not accessed before (or do you mean since) a given date...
Exercise your GoogleFu.
Found this pretty quickly:
http://dinesql.blogspot.com/2010/05/when-was-my-sql-server-database-last.html
I tweaked it a little, but I may have misunderstood the filter you...
January 10, 2015 at 11:52 pm
Let me see if rephrasing this will help. I'm wondering how to model sales territories when the "borders" move over time.
Same basic sales database (think Contoso DW... it's just less...
January 10, 2015 at 11:31 pm
I have to admit that I know little about MySQL, but you should be able to use something like this:
WHERE event_time>DATEADD(m,-2,GETDATE())
(subtracts two months from the current date).
January 7, 2015 at 3:43 pm
one way would be to create a view and then put the aliases there.
CREATE VIEW vw_SomeView
AS
SELECT field1 AS NewName
,field2...
January 6, 2015 at 12:36 pm
Deleting posts (unless completely absurd) seems odd to me. To me, it's like tearing pages out of a knowledge repository. Nothing quite like remembering an old post that...
January 4, 2015 at 9:15 pm
Got details??
A rough analogy to your description is like saying that "my car used to run fine, now it doesn't." The obvious response is "What changed between when it...
January 2, 2015 at 9:29 pm
Wow. That's mind-boggling!!!! I see that MS has adopted the SQL Server license model for all of its software. I wonder if they sell a decoder ring...
January 2, 2015 at 10:13 am
the only way I could think of doing it was to have a "translation" table.
Something like (CustomerID, Year, AssignedTerritoryID).
That's the only way I could figure out to be able to...
January 2, 2015 at 9:48 am
I was waiting for Jeff Moden to answer, but since he hasn't yet, you might want to read his article:
http://www.sqlservercentral.com/articles/T-SQL/94570/
or
Or maybe one by Dwain Camps
https://www.simple-talk.com/sql/performance/the-performance-of-traversing-a-sql-hierarchy-/
December 31, 2014 at 4:42 pm
That's what I suspected. Then I can just filter the Territory dimension with the appropriate year and be off to the races.
Thanks!
December 31, 2014 at 1:10 pm
Doing things like you describe is not uncommon with date dimension/calendar tables in a data warehouse. Then you can do pretty much any kind of date-related query really easily.
December 31, 2014 at 12:10 pm
Yeah, until the defense turns up the pressure... then he'll hurry and throw some interceptions like he always does.
December 31, 2014 at 10:35 am
Just throwing this out there, but what if you do something like
UNPIVOT to convert the dates in the column names to rows,
join to the Calendar table to get week numbers...
December 30, 2014 at 11:45 pm
Once you have the DelimitedSplit8K function in your database, you can do something like this:
SELECT test.ID
, test.value
, split.ItemNumber
, Item = split.Item
FROM
(SELECT 1 AS ID,'1' AS Value
UNION ALL
SELECT 2,...
December 30, 2014 at 6:33 pm
Viewing 15 posts - 2,716 through 2,730 (of 3,489 total)