Viewing 15 posts - 2,131 through 2,145 (of 4,087 total)
Assuming that column1 cannot be null, then this will give the same results and should be slightly faster.
CASE
WHEN column2 > column1
THEN column2
ELSE column1 END AS Result
You have three...
December 5, 2016 at 9:38 am
paul.biltcliffe 32759 (12/2/2016)
Data Types:a.client = nvarchar(25), not null
a.status = nvarchar(1), not null
a.attribute_id = nvarchar(4), not null
On an unrelated note, why are you using nvarchar(1) for your status instead of nchar(1)?...
December 5, 2016 at 9:15 am
Phil Parkin (12/2/2016)
Just having a mind warp on how to insert into the address table and get that unique int value and put it into the correct master row for...
December 2, 2016 at 11:24 am
JALLY (12/2/2016)
Your solution above will create a conflict between columns that rely on the the sub queries for their source of data and the multi part identifier 'inv.active' will not...
December 2, 2016 at 11:08 am
You can't have a WHERE clause in the middle of your JOIN clause. Just move your WHERE clause after ALL of the JOIN clauses.
...
December 2, 2016 at 9:37 am
Something seems off here. You're worried about a new student status affecting the sort order, but that's impossible, because the student status defines the partition. You say that...
December 2, 2016 at 8:24 am
Here is the updated code:
;
WITH unique_dates AS (
SELECT DISTINCT p.Price, d.dt, d.is_start
FROM #prices p
CROSS APPLY (VALUES(p.date_from, 1), (DATEADD(DAY, 1, p.date_to), 0)) d(dt, is_start)
)
, packed_dates AS (
SELECT ud.price, ud.dt, ud.is_start,
CASE
WHEN LEAD(ud.dt,...
December 1, 2016 at 9:16 am
UPDATE does allow you to use a named table as long as it's not the one being updated. If you use the name of the table that's being updated,...
December 1, 2016 at 8:47 am
You can't. Temp tables are only visible to the session that created them.
Drew
November 30, 2016 at 4:08 pm
dsmith402 (11/29/2016)
Ok, that certainly makes sense. But how would this expression be re-written in order for it to work?
It depends on what you are trying to solve, which is why...
November 30, 2016 at 9:55 am
You have both a CASE expression and a COALESCE. For each of those, the possible values must be of compatible data types.
,coalesce(case WHEN FSI.FID IN ('1800','1810')
and FSI.StepCompletion is not...
November 29, 2016 at 4:23 pm
wjh_uk (11/28/2016)
With the following data the faster version...
November 29, 2016 at 12:42 pm
You say you want running totals, but your expected results look like they are the first step in getting your expected running totals. If that is the case, there...
November 29, 2016 at 11:06 am
This is a variation of the packing intervals problem. Since you have no gaps and no overlaps you can treat it as a gaps and islands problem where the...
November 28, 2016 at 4:03 pm
Your text contains a single quote that hasn't been properly escaped. You need to use two single quotes in your text to get one single quote, so child's should...
November 28, 2016 at 3:41 pm
Viewing 15 posts - 2,131 through 2,145 (of 4,087 total)