Viewing 15 posts - 4,756 through 4,770 (of 8,731 total)
An improved version of my previous code. 😉
IF OBJECT_ID('TablesInformation') IS NOT NULL
DROP TABLE TablesInformation;
CREATE TABLE TablesInformation(
name ...
July 7, 2015 at 10:13 am
This is another formula to get there.
WITH TestData AS(
SELECT GETDATE() - RAND(CHECKSUM(NEWID())) * 7 AS date1, GETDATE() + RAND(CHECKSUM(NEWID())) * 7 AS date2
...
July 7, 2015 at 9:27 am
Without having to rely on an undocumented procedure, you could use something like this:
IF OBJECT_ID('TablesInformation') IS NOT NULL
DROP TABLE TablesInformation;
CREATE TABLE TablesInformation(
name...
July 7, 2015 at 9:00 am
As you said you're looking for an update query, I thought on posting an answer using some 2012 capabilities. Along with the use of updatable CTE's which work under the...
July 6, 2015 at 10:25 am
But your excel file with the expected results didn't follow a common logic for all the rows.
July 4, 2015 at 1:17 pm
GilaMonster (7/2/2015)
Do you get the feeling that IT people, especially ones at the top-end of the field, are...
July 2, 2015 at 4:04 pm
Thank you for the formatted expected results Lynn. You're right, the results are different. However, I'm not sure if the expected results are wrong or the query results are wrong.
For...
July 2, 2015 at 3:37 pm
Sean Lange (7/2/2015)
Luis Cazares (7/2/2015)
jasona.work (7/2/2015)
OTOH, got...
July 2, 2015 at 1:37 pm
gazy007 (7/2/2015)
July 2, 2015 at 10:33 am
Sean Lange (7/2/2015)
Thanks Gail and Luis. Don't know how I missed that. 😛
Probably your mind is already in a long weekend.
July 2, 2015 at 10:22 am
I'm not sure about your desired results, but I believe that you need to add a partition to your window functions.
SELECT
S_ID,
LAG(S_ACTV_CODE, 1)...
July 2, 2015 at 10:09 am
jasona.work (7/2/2015)
OTOH, got plenty to look forward...
July 2, 2015 at 7:44 am
Lynn Pettis (7/1/2015)
July 1, 2015 at 12:46 pm
Steve,
Just as an FYI, you can remove the ISNULL() by using the third parameter of LAG()
--Instead of
ISNULL(LAG(P.Lev, 1) OVER(PARTITION BY T.AccountID ORDER BY T.Datekey), 0) AS LAG_VALUE
-- Use
LAG(P.Lev, 1, 0)...
July 1, 2015 at 10:43 am
Viewing 15 posts - 4,756 through 4,770 (of 8,731 total)