Viewing 15 posts - 16 through 30 (of 444 total)
Thanks for good question.
There was a connect item to change this behavior of join hints
https://connect.microsoft.com/SQLServer/feedback/details/753790/allow-join-hints-without-force-order
January 14, 2016 at 3:42 am
This is really not so hard, but a single query i can imagine excludes using indices on date columns. Nevertheless it should be faster then cursor. And 1+ million of...
January 12, 2016 at 8:28 am
prameela.vankineni (1/12/2016)
select
@year as [YEAR],
@MONTH...
January 12, 2016 at 7:11 am
Try this
declare @currentdate datetime = '20150308' -- getdate() --
select tc.*
from (
select y = datepart(YYYY,dateadd(m,-1,@currentdate))
, m = datepart(m,dateadd(m,-1,@currentdate))
) params
join temp_calendar tc
on [month_id] between y*100+1 and y*100+m
;
January 12, 2016 at 2:22 am
Jeff Moden (1/11/2016)
That produces the following, as requested...
SomeColumnName
--------------
a
11
13
b
21
24
c
22
(8 row(s) affected)
d is missing. Just in this case both tables need to be taken into account.
And i should say first...
January 11, 2016 at 8:06 am
Generally, MS SQL has recursive CTE for trees processing. This particular tree has exactly 2 levels which allows for simple solution.
declare @test-2 table (ParentId varchar(10), ChildId varchar(10));
declare
January 11, 2016 at 6:08 am
I'm not sure about what output is desired. Anyway 2014 has LED/LAG. So most probably you needn't ROW_NUMBERing CTEs here at all.
December 18, 2015 at 2:45 am
This is really not an SQL problem. You need some geodesic mathematics for it which SQL Spatial doesn't provide out of the box. Generally it depends on what model of...
December 17, 2015 at 2:39 am
According to OP statement
martyn.dowsett (12/15/2015)
December 17, 2015 at 1:45 am
Let input be as follows
INSERT#MgtStructure (ManagerID, EmployeeID) VALUES
--('A', 'B'),
('A', 'C'),
('A', 'D'),
('B', 'C'),
('D', 'E'),
('F', 'G'),
('F', 'K'),
('H', 'I'),
('H', 'J')
--,('H', 'A')
Which is correct group for C ?
As OP stated, it's not a...
December 16, 2015 at 6:59 am
To add a bit more fun, what if
DECLARE @url VARCHAR(8000) = 'http://www.mydomain.info/Customer.aspx?xxh_hmid=45678&h_hmid=2907831&dcc=EUR&mobiredirect=no&cpn=3790';
December 16, 2015 at 1:27 am
You need a criteria to choose which row must show closing balance. Isn't DATE column missing?
December 16, 2015 at 1:14 am
In fact this boils down to something like
WHERE...
CashDate = dateadd(d, case when <entity> then -DelayDays else "N days" end, currdate)
Check signs, not tested.
Depending on indexes available you...
December 16, 2015 at 1:08 am
Generally, create a set of keys (year +month i suppose) to collect data about and left join data collection query to this set.
December 11, 2015 at 6:55 am
Viewing 15 posts - 16 through 30 (of 444 total)