Forum Replies Created

Viewing 15 posts - 646 through 660 (of 3,011 total)

  • RE: HHMMSS int field to human-friendly time?

    Jeff Moden (1/8/2012)


    To add to the reasons not to use undocumented or, sometimes, even documented MS provided code...

    The Developers of SQL Server will occasionally make significant performance mistakes in their...

  • RE: Censoring the Internet

    bteraberry (1/6/2012)

    ... The argument against SOPA is sort of like saying the government should not be able to seize property involved in narcotics distribution ... because we don't want the...

  • RE: SQL coding techniques

    bteraberry (1/6/2012)


    Ninja's_RGR'us (1/6/2012)


    I use on to make the join

    then I use where to filter data I don't need after the join is made

    I think this is fairly standard and generally...

  • RE: HHMMSS int field to human-friendly time?

    Here is a solution that doesn't use conversion to character string and back again.

    select

    next_run_date ,

    next_run_time ,

    NEXT_RUN_DATETIME =

    -- convert date

    dateadd(dd,((next_run_date)%100)-1,

    dateadd(mm,((next_run_date)/100%100)-1,

    dateadd(yy,(nullif(next_run_date,0)/10000)-1900,0)))+

    -- convert time

    dateadd(ss,next_run_time%100,

    dateadd(mi,(next_run_time/100)%100,

    --dateadd(hh,nullif(next_run_time,0)/10000,0)))

    -- Fix for prior line, because a time of 0...

  • RE: Time dimension

    Function F_TABLE_DATE is a calendar function that returns a table containing a variety of attributes of all dates from @FIRST_DATE through @LAST_DATE. It is meant to be used to...

  • RE: and the deadlocks are back...

    Sapen (1/4/2012)


    ok. The problem is I cant modify the EF generated scripts since they are generated dynamically. I meant if these scripts are hardcoded with the isolation level as serializable...

  • RE: Change Data Capture and indefinite retention

    NJ-DBA (1/3/2012)


    I have an application group who wants to use CDC as a long term solution for tracking changes. They dont want to move historical data to archive tables...

  • RE: and the deadlocks are back...

    The fact that the queries and updates are being run with isolation level of serializable is probably why you are getting deadlocks. There is rarely a good reason to...

  • RE: Previous week number

    Shree-903371 (1/4/2012)


    The ISO Week for above statement gives 51 but it should be 52.

    Week 51 of 2011 is the correct ISO week for 2011-12-25. The ISO week is defined...

  • RE: Is There Any Reason I Should NOT enable READ_COMMITTED_SNAPSHOT?

    ScottPletcher (1/3/2012)


    I've read the whole thread. Very interesting discussion.

    But I don't understand the claim that "Optimistic Locking" has no overhead.

    What about all those rollback/undo errors in Oracle? Oh...

  • RE: Is There Any Reason I Should NOT enable READ_COMMITTED_SNAPSHOT?

    SQL Kiwi (1/3/2012)


    Michael Valentine Jones (12/29/2011)


    This code shows a simple way to eliminate those problems using a rowversion column in the table to make sure it has not changed since...

  • RE: Result set order - Union All

    There is no default order to any result set, unless you have an ORDER BY clause.

  • RE: Primary Keys are necessary for good database design

    Jeff Moden (12/30/2011)

    ...

    And, yeah... there's nothing wrong with having a surrogate key as the PK and a natural key as an AK. 😉

    Especially when the value of the natural...

  • RE: Problem with a simple Scalar UDF

    Welsh Corgi (12/29/2011)


    I'm having a problem with a simple Scalar UDF.

    CREATE FUNCTION udf_ConvertDB2toSQL

    RETURNS DateTime

    AS

    BEGIN

    DECLARE @CSC_DATE varchar(7)

    DECLARE @SQLDate Datetime

    SET @CSC_DATE = '1111130'

    SET @SQLDate = (SELECT CAST(SUBSTRING(@CSC_DATE, 4 ,2)+ '/' +...

  • RE: how to get seconds from my time ....

    VIG (12/30/2011)


    DECLARE @time TIME = '20:10:10'

    select total_seconds =DATEDIFF(second,0,cast(@time as datetime))

    The time string can be directly assigned to a datetime variable as 1900-01-01 20:10:10:

    DECLARE @time datetime = '20:10:10'

    select total_seconds =DATEDIFF(second,0,@time)

    And the...

Viewing 15 posts - 646 through 660 (of 3,011 total)