Forum Replies Created

Viewing 15 posts - 496 through 510 (of 626 total)

  • RE: how to reclaim space

    rightontarget (7/21/2015)


    Yes, the way I see it, if database size is nearly 5 times bigger than data, it is an issue. What is or how to properly maintain it? This...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: how to reclaim space

    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: table size difference in two DB

    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Date question

    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'...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Queue Table Strategies

    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Queue Table Strategies

    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: "ID" or "Id"

    Jeff Moden (7/8/2015)


    yb751 (7/8/2015)


    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: "ID" or "Id"

    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: expanding the keyword AS

    Ahhh...now I understand. Yes, you'll need to use Dynamic SQL for that.


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: expanding the keyword AS

    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Help with SQL - Calculate time difference for consecutive rows

    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Help with SQL - Calculate time difference for consecutive rows

    Hmmm...not sure why but I just double checked and it looks fine here. I also checked the other 'users' separately with expected results.


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Help with SQL - Calculate time difference for consecutive rows

    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Are the posted questions getting worse?

    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,


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Table variable in dynamic query

    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...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

Viewing 15 posts - 496 through 510 (of 626 total)