Viewing 15 posts - 106 through 120 (of 683 total)
Jeff Moden (5/12/2008)
Nicely done, Ryan.
Thanks Jeff 🙂
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 12, 2008 at 4:51 am
I guess you could 'pad' that first number before you do your comparisons...
declare @t table (warehouse int, [From] varchar(10), [To] varchar(10))
insert @t
...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 12, 2008 at 4:12 am
What output would you want for the example you gave?
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 12, 2008 at 3:41 am
Cross post
http://www.sqlservercentral.com/Forums/Topic498623-147-1.aspx
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 12, 2008 at 3:39 am
Perhaps you're trying to do this?
Select
CASE
WHEN Col1 = 'Y' THEN 'Col1'
WHEN Col2 = 'Y' THEN 'Col2'
WHEN Col3...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 12, 2008 at 2:29 am
If you add an index (clustered or not) to #sparseData...
create clustered index ix_sd1 on #sparseData (dateId)
...the cross apply has the best performance for the small dataset you give (at least...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 12, 2008 at 2:26 am
Another option:
select * from #drivingTable a cross apply
(select top 1 * from #sparseData where dateId <= a.dateid order by dateId desc) b
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 12, 2008 at 2:10 am
Michael Valentine Jones (5/9/2008)
Simply put, this approach is always a disaster.
I love it! 😀
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 9, 2008 at 11:23 am
Perhaps you should change the title to walking down the tree 😀
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 9, 2008 at 11:09 am
If I've understood you correctly, here's one idea...
; with
a as (select *, case when charindex('.', Proj_ID) > 0 then left(Proj_ID, len(Proj_ID) - charindex('.', reverse(Proj_ID))) end as...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 9, 2008 at 11:06 am
srienstr (5/9/2008)
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 9, 2008 at 10:08 am
shahab (5/9/2008)
ts_date is just a date field. for tangible sold.
The point was that you've referred to it in your rules, but it's not in your structure (at least not in...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 9, 2008 at 8:39 am
Well, here's one idea of the type of thing you could do...
-- Structure and Data
CREATE TABLE [dbo].[AlDate](
[EMPL_ID] [varchar](12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 9, 2008 at 7:59 am
What's ts_dt?
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 9, 2008 at 7:50 am
Looks like another use for the 'tally' table...
http://www.sqlservercentral.com/articles/TSQL/62867/
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 9, 2008 at 7:08 am
Viewing 15 posts - 106 through 120 (of 683 total)