Viewing 15 posts - 496 through 510 (of 626 total)
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
I don't often post these kinds of links but it was so good I just had to share.
For anybody who has ever written code...
http://fundd.blogspot.ca/2012/02/public-object-dostuff-return-new-object.html
Cheers,
July 2, 2015 at 11:27 am
To illustrate Gila's point I used AdventureWorks to demonstrate how a temp table could work.
BAD
DECLARE @query_from NVARCHAR(MAX) = ''
DECLARE @query NVARCHAR(MAX)
DECLARE @TableVariable TABLE (ID INT)
INSERT INTO @TableVariable VALUES (1),(2)
SET @query_from...
July 2, 2015 at 9:19 am
Viewing 15 posts - 496 through 510 (of 626 total)