Viewing 15 posts - 61 through 75 (of 1,192 total)
A nice thought-provoking question!
The answer really does depend, though. Under some conditions the first two queries got the same query plan on my system (and performed equivalently), and...
March 28, 2018 at 1:56 pm
This is actually an unpivot, and you could do it either with the UNPIVOT operator or with CROSS APPLY. Using the sample data you provided:
SELECT empid,...
March 28, 2018 at 12:05 pm
Assuming you have something in the table that identifies the task list to which each of those items belongs, identifying problem data should be as simple as doing a ROW_NUMBER...
March 28, 2018 at 10:19 am
Heh, no worries. We've all skimmed over some important detail once or twice (no more than that, right? 🙂 )
It would be odd for it to be a...
March 28, 2018 at 9:37 am
The trigger mentioned in the error is not the trigger for which you posted code.
Could you post the definition of the trigger mentioned in the error (trg_tbl_Results_Update_SYSDateLastUpdated)?
March 28, 2018 at 8:54 am
In the first example, you're just passing the current value of a variable to the TVF, so it'll of course be the same in each query that's UNIONed in the...
March 27, 2018 at 1:21 pm
There's just one WITH clause, and specify the options you want:
WITH ENCRYPTION, EXECUTE AS 'RemoteLink'
Cheers!
March 27, 2018 at 12:31 pm
March 27, 2018 at 11:59 am
Please don't post the same question multiple times. It causes far more problems than it solves (it solves none, basically).
The original thread, which already has one reply, can...
March 26, 2018 at 1:47 pm
https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-release-notes has the supported platforms.
Cheers!
March 26, 2018 at 12:31 pm
That sort of CTE is part of a common construct to form an on-the-fly tally or numbers table.
The specific values don't really matter; it's just generating a certain...
March 26, 2018 at 10:09 am
To add a further tweak, nothing about the ROW_NUMBER is needed here, so there's no need to add the overhead of generating it.
Something like this is sufficient and...
March 22, 2018 at 1:40 pm
Here's another way, also using pietlinden's sample data:
SELECT A.*, PayDate
FROM Acct A OUTER APPLY
(
SELECT PayDate FROM PayDates WHERE PayDate>FixDate ORDER...
March 21, 2018 at 11:59 am
If I understand the requirements correctly, here's one method:
WITH
n AS (SELECT N FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0))x(n)),
n6 AS (SELECT n1.N FROM n n1, n n2,...
March 15, 2018 at 4:22 pm
Perhaps something like this?
WITH CTE AS
(
SELECT *, grp=DATEADD(DAY,-ROW_NUMBER() OVER (PARTITION BY CargoColmn ORDER BY DateLogged ASC),DateLogged)
FROM #MyDates
)
SELECT DateFrom=MIN(DateLogged), DateTo=MAX(DateLogged),CargoColmn
FROM ...
March 15, 2018 at 11:31 am
Viewing 15 posts - 61 through 75 (of 1,192 total)