Viewing 15 posts - 496 through 510 (of 627 total)
sheaS (7/29/2015)
Ok, awesome guys, I'll convert it to a date first then run these query's. Thanks a million. Will post results.
If you're going to convert it then you don't actually...
July 29, 2015 at 2:01 pm
Well we had a REPLACE and a LEFT solution why not add a CONVERT. 😉
DECLARE @mytable TABLE (myDate VARCHAR(20))
INSERT INTO @mytable
VALUES ('2015-07-28 00:00:00'),('2015-07-29 00:00:00'),('2015-07-30 00:00:00')
SELECT * FROM @mytable
UPDATE @mytable
SET myDate...
July 29, 2015 at 1:50 pm
rightontarget (7/21/2015)
July 21, 2015 at 3:49 pm
The first thing you need to realize is that the size of your data file is not the same thing as the amount of data you have. When the...
July 21, 2015 at 2:33 pm
It's not all that strange when you realize how SQL stores data. Several factors can affect size such as fill factor for example. In you case the biggest...
July 20, 2015 at 8:10 am
If you run these two select statements it will give you a clue as to where the issue is. (as well how to fix it) 😉
SELECT CAST(2015-07-20 AS DATETIME)
SELECT CAST('2015-07-20'...
July 20, 2015 at 7:56 am
TheSQLGuru (7/13/2015)
If all else fails ...
Be VERY VERY careful with what that statement REALLY means. You are doing data processing, and if all else fails you could process...
July 14, 2015 at 8:22 am
Thanks for the input guys. I checked out Kejser's blog and he has some really interesting things to say on the subject. This may be the simplest to...
July 13, 2015 at 12:18 pm
Jeff Moden (7/8/2015)
yb751 (7/8/2015)
July 8, 2015 at 12:04 pm
Where I work "ID" was used everywhere if it was the primary key. Then foreign keys would become AccountID for example. Programmers claimed it was easier for them...
July 8, 2015 at 8:14 am
Ahhh...now I understand. Yes, you'll need to use Dynamic SQL for that.
July 8, 2015 at 7:44 am
Maybe I misunderstand but if you simply want 'Month1: 07/07/2015' as a column name did you try...
SELECT 1 AS [Month1: 07/07/2015]
Just a simple example but as you can see the...
July 8, 2015 at 7:08 am
That being said he mentioned it worked for a single S_ID but I went by S_USER.
In that case...
TEST for single ID
SELECT
S_ID,
LAG(S_ACTV_CODE, 1) OVER (ORDER BY S_DATETIME ASC) AS S_ACTV_CODE_PREV,
S_ACTV_CODE,
S_USER,
S_DATETIME AS...
July 2, 2015 at 12:46 pm
Hmmm...not sure why but I just double checked and it looks fine here. I also checked the other 'users' separately with expected results.
July 2, 2015 at 12:32 pm
Since you (the OP) stated that your query worked with a single user I just used your own code with a specific user for testing.
SELECT
S_ID,
LAG(S_ACTV_CODE, 1) OVER (ORDER BY S_DATETIME...
July 2, 2015 at 11:44 am
Viewing 15 posts - 496 through 510 (of 627 total)