Forum Replies Created

Viewing 15 posts - 2,116 through 2,130 (of 6,036 total)

  • RE: NEWID() - How does it work?

    Paul White (2/23/2013)


    I do wonder why anyone would covert a 16-byte uuid to a 36-character string though.

    I wonder where do you find someone who would not... :crazy:

    :hehe:

  • RE: Are Triggers a "legacy" Feature? (Database Weekly, Nov 08 2008)

    My argument was based on the use of triggers to implement business logic and to do the sort of data integrity checking that should be enforced by keys and constraints....

  • RE: Are Triggers a "legacy" Feature? (Database Weekly, Nov 08 2008)

    jfogel (2/19/2013)


    I get that but my point is that sometimes you don't want this and if a person is performing an action without knowing or forgetting there is a trigger...

  • RE: using locks in sql server 2005

    1. Revise the code to implement the best practices.

    2. Make sure you have appropriate indexes in place and your code in trigger uses it.

    Having these conditions fulfilled you should not...

  • RE: Age

    Jeff Moden (9/25/2012)


    Michael Valentine Jones (9/25/2012)


    You can use the function on the link below to find the age:

    Age Function F_AGE_IN_YEARS

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=74462

    Any chance of making it NOT a scalar function?

    SELECT DATEDIFF(yy, 0,...

  • RE: Calculation with aliases

    You should put the whole initial query into the derived table, except for ORDER BY clause:

    USE ICP;

    GO

    DECLARE @beginDatum Datetime

    DECLARE @eindDatum Datetime

    SELECT dtSums.Tijdsduur, dtSums.WrapUp, dtSums.OnHold, dtSums.Tijdsduur - dtSums.WrapUp - dtSums.OnHold AS...

  • RE: How can we calculate Age of employee?

    Should be really way simpler

    SELECT

    dob,

    [day],

    DATEDIFF(yy, 0, [day] - dob) Years,

    DATEDIFF(MM, 0, [day] - dob)%12 Months,

    DATEDIFF(dd, DATEADD(mm, DATEDIFF(mm, 0, [day] - dob), 0), [day] - dob) days

    FROM (

    SELECT...

  • RE: Character '*' in float column

    Or you can create a view on top of the table with those FLOAT columns converted to VARCHAR and set up an INSTEAD OF INSERT, UPDATE trigger on it -...

  • RE: Find First and Last Period without holes

    dwain.c (1/15/2013)


    I understand you already have a solution but this might be a bit more efficient. The technique is based on an article by Jeff Moden on Grouping Islands...

  • RE: Dynamically discovering row relationships

    Try to build a "full select" query to include all sequential references from the "root" table to the smallest "seed":

    SELECT *

    FROM Table1 A

    LEFT JOIN Table2 B ON B.Col = A.Key

    LEFT...

  • RE: Character '*' in float column

    ohpenot (2/13/2013)


    That is exactly what i was looking for.

    Not sure about that.

    Did you try to run it?

    It won't work if those columns in dbo.Tablebase are of FLOAT data type.

    Table...

  • RE: simple MAX question

    Pete-600513 (1/19/2013)


    Thank you very much. I thought there might be an easy way with the max function

    You were right.

    SELECT DT.max_score, A.name, a.dob

    FROM dbo.Exam A

    INNER JOIN (SELECT MAX(score) max_score

    FROM dbo.Exam

    ) DT...

  • RE: What's wrong with my DISTINCT

    momba (2/5/2013)


    ...I need to study this row number() thing. Will let you know how it goes when I straigten it out. Thanks for being so patient with my...

  • RE: Changing from "hard-coded" to dynamic query

    This modification will make sure you include only actually existing tables and do not miss any of them:

    declare @SQLCmd nvarchar(max), @Params nvarchar(max), @DiscDate datetime ;

    SET @DiscDate = '20090630';

    set @Params =...

  • RE: Query Help

    Update Test

    Set UpdateField = case when MinDuration < 12 then Right else Left end

    from Test

Viewing 15 posts - 2,116 through 2,130 (of 6,036 total)