Forum Replies Created

Viewing 15 posts - 4,246 through 4,260 (of 8,761 total)

  • RE: The dotted table

    TomThomson (11/23/2015)


    Nice question.

    But your "not necessarily recommended" is a bit less emphatic than my expression would be if I encountered something like this in a code review. :rolleyes:

    +1

    😎

    Certainly drop the...

  • RE: SQL Unpivot

    Quick solution

    😎

    USE tempdb;

    GO

    SET NOCOUNT ON;

    DECLARE @SAMPLE TABLE (ID CHAR(4),Salary INT,Employee_Tax1 INT,Employee_Tax2 INT,Employer_Tax1 INT,Employer_Tax2 INT);

    INSERT INTO @SAMPLE(ID,Salary,Employee_Tax1,Employee_Tax2,Employer_Tax1,Employer_Tax2) VALUES ('A001',1000,120,95,125,105);

    SELECT

    X.ID

    ,X.Earn_Ded

    ,X.Employer_Tax

    FROM @SAMPLE S

    CROSS APPLY

    (

    ...

  • RE: Subtract column with variable

    Quick solution

    😎

    USE tempdb;

    GO

    SET NOCOUNT ON;

    IF OBJECT_ID(N'tempdb..#t') IS NOT NULL DROP TABLE #t;

    create table #t

    (

    id int,

    col1 decimal(18,2)

    )

    go

    insert into #t (id,col1)

    values...

  • RE: Are the posted questions getting worse?

    Ed Wagner (11/22/2015)


    I think the spam bomb went off again today.

    I guess you are not referring to TT's posts:-D

    😎

  • RE: Database Server Memory always showing 98%

    This whole thing doesn't make sense unless more information is provided, memory configurations and specs are relative to all the work the server has to perform, not exceptions like occasional...

  • RE: Execution plan when there are variables at the query is wrong

    ricardo_chicas (11/20/2015)


    Yeah, it is just sad that we define a clustered index, therefore ordered, with two variables that are of the same data type withing the scope of the query,...

  • RE: Execution plan when there are variables at the query is wrong

    First thing that comes to mind is parameter sniffing and local variables, suggest you read up on the subject, plenty of good articles around covering this.

    😎

  • RE: Database Server Memory always showing 98%

    rameelster (11/20/2015)


    but the database instance contain 2 databases each with size 240 GB and 714 GB respectively. Dont you think that 80 percent memory is very less.

    No I don't...

  • RE: Database Server Memory always showing 98%

    rameelster (11/20/2015)


    DB server consists of Inter Xeon processor(2 Processors) with 40 cores and a memory size of 64 GB. I have allocated 61 GB for sql server and the rest...

  • RE: Need comma separated output

    Quick suggestion

    😎

    USE tempdb;

    GO

    SET NOCOUNT ON;

    IF OBJECT_ID(N'tempdb..#Test') IS NOT NULL DROP TABLE #Test;

    Create Table #Test

    (id int identity,C1 bit , C2 Bit , C3 Bit)

    insert into #Test Values (0,0,0)

    ...

  • RE: Are the posted questions getting worse?

    Jeff Moden (11/19/2015)


    There are many more but, just to wet the appetite for other possibilities...

    SELECT {fn NOW()};

    SELECT {fn CURRENT_DATE()} + ' ' + {fn CURRENT_TIME()};

    EXEC...

  • RE: Are the posted questions getting worse?

    Luis Cazares (11/19/2015)


    Eirikur Eiriksson (11/19/2015)


    Luis Cazares (11/19/2015)


    I feel excluded.

    How come?

    😎

    You left my method out

    Couldn't fit it in the select statement, too many EXEC'y thingies in there, any alternatives?

    😎

  • RE: Are the posted questions getting worse?

    Alvin Ramard (11/19/2015)


    Eirikur Eiriksson (11/19/2015)


    Alvin Ramard (11/19/2015)


    Eirikur Eiriksson (11/19/2015)


    Luis Cazares (11/19/2015)


    I feel excluded.

    How come?

    😎

    Luis, I'll include you with me. 🙂

    That looks way too close to a union all statement...

  • RE: Are the posted questions getting worse?

    Alvin Ramard (11/19/2015)


    Eirikur Eiriksson (11/19/2015)


    Luis Cazares (11/19/2015)


    I feel excluded.

    How come?

    😎

    Luis, I'll include you with me. 🙂

    That looks way too close to a union all statement for comfort:-P

    😎

  • RE: Are the posted questions getting worse?

    Luis Cazares (11/19/2015)


    I feel excluded.

    How come?

    😎

Viewing 15 posts - 4,246 through 4,260 (of 8,761 total)