Forum Replies Created

Viewing 15 posts - 136 through 150 (of 812 total)

  • RE: Finding Triggers

    George Vobr - Thursday, March 2, 2017 8:52 AM

    Interesting question, thanks Steve, to exercise logical reasoning...😉
    That a table has INSTEAD OF Trigger...

  • RE: Finding Triggers

    Magnus Ahlkvist - Wednesday, March 1, 2017 11:56 PM

    One can define Instead Of Triggers on a table and the count for these...

  • RE: Mixed page allocation

    TjhomasH6610 - Tuesday, February 14, 2017 1:24 AM

    Great question, but I think the answer is incorrect.
     The first reference states "This setting is...

  • RE: ShrinkFile

    BillLudlow - Wednesday, February 8, 2017 2:51 AM

    Is it that it releases the log space but doesn't change the physical file size? ...

  • RE: ShrinkFile

    t.franz - Wednesday, February 8, 2017 12:46 AM

    This is not true.
    I just used
    DBCC SHRINKFILE (N'mydb_log' , 0, TRUNCATEONLY)
    on my 4...

  • RE: Get the full name

    Uncomment the query you want to try:
    WITH Fullname
    AS
    (
    SELECT * FROM (VALUES
    ('Erin','Keri','Moody','Sr.')
    ,('Megan','Laura','Morales','B.S.')
    ,('George','Lena',NULL,'')
    ,(NULL,'Ryan','Lucas','M.D.')
    ,('Sheryl','Marianne','Morton','IV')
    ) AS V([firstname],[middlename],[lastname],[suffix])
    )
    --SELECT COALESCE
    --        (
    --        firstname,...

  • RE: Get the full name

    Julie Breutzmann - Wednesday, January 25, 2017 9:03 AM

    Steve Jones - SSC Editor - Tuesday, January 24, 2017...

  • RE: Get the full name

    hakan.winther - Wednesday, January 25, 2017 2:28 AM

    That was an easy one, thanks! You could also solve this query with CONCAT. 🙂

    That's...

  • RE: Char with null

    sendijunk (1/11/2017)


    Good question. Could use a bit more explanation though. Interesting what happens if you replace ISNULL with COALESCE.

    The return type depends on "precedence" of types. In this case, the...

  • RE: Query regression by index or statistics?

    Both filtered index and statistics suffer of parameterization in the where clause.

    In the following query, the optimizer can't predict which filtered statistic should be used (think to stored procs).

    declare @lan...

  • RE: GetDate() in blocked sessions

    The correct answer is "depend" on numbers of records in the table:

    With one or few records the correct answer is "09:00:10", but with many records (in my case 6800) the...

  • RE: Using Mod to Generate Work Shifts

    mlandry (12/22/2016)


    CHAR(...) + 65 is far too dependent upon the shift labels A, B, C. If they changed to non-contiguous strings, then this is out the window.

    Old "C" language trick.

  • RE: Using Mod to Generate Work Shifts

    Dohsan (12/22/2016)


    Could possibly remove the case

    CREATE FUNCTION [dbo].[ShiftCalc]

    (

    @ShiftTime DATETIME,

    @ShiftStart DATETIME,

    @NumOfShifts TINYINT

    )

    RETURNS TABLE WITH SCHEMABINDING

    AS

    RETURN

    SELECT

    OnShift = CHAR(ABS(DATEDIFF(DAY,@ShiftStart,DATEADD(HOUR,-DATEPART(HOUR,@ShiftStart), @ShiftTime))) % @NumOfShifts + 65);

    GO

    DECLARE @ShiftAStart DATETIME = '2006-01-01T07:00:00';

    SELECTD.Incident,

    CA1.OnShift

    FROM(

    VALUES(CAST('2006-01-01T07:00:00' AS DATETIME)),

    ('2006-01-01T17:00:00'),

    ('2006-01-02T06:00:00'),

    ('2006-01-02T07:00:00'),

    ('2006-01-02T23:00:00'),

    ('2006-01-03T07:00:00'),

    ('2006-01-03T09:00:00'),

    ('2006-01-04T07:00:00')

    ) AS D(Incident)

    CROSS

    APPLYdbo.ShiftCalc(D.Incident,@ShiftAStart,3) AS...

  • RE: Using Mod to Generate Work Shifts

    SET @compareDate = DATEADD(HOUR, -7, @ShiftDate)

    SELECT CASE ABS(DATEDIFF(DD, @compareDate, @baseDate)) % 3

    WHEN 0 .....

  • RE: The autogenerated view

    Thanks! I learned a real new and interesting feature!

Viewing 15 posts - 136 through 150 (of 812 total)