Forum Replies Created

Viewing 15 posts - 106 through 120 (of 129 total)

  • RE: How to Minus X amount of minutes in a T-SQL query

    declare@max-2 int

    set@max-2 = 240

    select *

    from (

    select '2010-01-01 10:00:00' [time]

    union all

    select '2010-01-01 11:00:00'

    union all

    select '2010-01-01 12:00:00'

    union all

    select '2010-01-01 13:00:00'

    union all

    select '2010-01-01 14:00:00'

    ) blah

    where[time]

    betweendateadd(minute, -@max - 120, getdate())

    anddateadd(minute,...

  • RE: Creating Clustered index on a large table

    Is your composite index sequential, and the columns never update?

    because it needs to be to work well as a clustered index ...

    you can also use ASC DESC to ensure the...

  • RE: What columns are eligible to be in non clustered index

    I think there are 325 distinct non-clustered indexes to choose from

    given 5 columns - if you ignore the ASC DESC options

    some examples:

    create index IX_Blah

    on dbo.Table (a, b, c, d, e)

    create...

  • RE: sp_detach

    sp_who

    sp_who2

    kill

    alter database set single_user

    use master

    exec dbo.sp_detach

  • RE: Calculate Working Hour Query

    Eugene Elutin (7/5/2010)


    1. In terms of the "primary use" and column names, may be your logic is a bullet proof in your head, but is is illogical for me.

    Lets...

  • RE: Calculate Working Hour Query

    the primary function of the IsPaused column is "is this session paused"

    the secondary function of the IsPaused column is "if this session is paused - when was it paused"

    that is...

  • RE: Calculate Working Hour Query

    I would not recommend such table design for logging details in OLTP system. It looks more like a table from reporting database, where the data needs to be denormailized.

    Just think...

  • RE: Calculate Working Hour Query

    even simpler and more efficient is to use a single record per session:

    create table dbo.TimeLog (

    [TimeLogID] int identity

    ,[EmpID] int not null

    ,[LoginTime] datetime not null

    ,[LogoutTime] datetime

    ,[PauseDuration] int not null

    ,[SessionDuration] int not...

  • RE: Calculate Working Hour Query

    I don't like complex queries over large datasets when you can easily cache the data:

    declare @timeLog table (SNO int, EMPID int, [STATUS] char(10), [DATE] Datetime, [DURATION] int)

    the logout logic would...

  • RE: change DateFirst within a funciton

    all the information you need is available within the function

    so adjust for the error introduced by @@datefirst

    I think this would work:

    create functiondbo.fnWeekDay(@Now datetime, @DateFirst int)

    returnsint

    begin

    --

    return((datepart(weekday, @Now) + @@datefirst - @DateFirst...

  • RE: How to share lookup tables across multiple databases that need RI constraints

    an idea:

    funnel all inserts and updates to the lookup tables via stored procedures

    and use a transaction to update tables across all databases

    this would give you all the benefits of the...

  • RE: exec sys.sp_refreshsqlmodule 'dbo.spSimple'

    (delete)

  • RE: It's the little things that kill...

    what have you learnt?

    never make any changes to production systems after lunchtime or after thursday

    build LOTS of constraints / checks / safe guards into your apps / db

    make a testing...

  • RE: Lock acquisition time

    I believe the locking system in SQL Server

    was designed for old fashioned applications

    that opened and held long lived connections and locks

    they *had* to use high resolution locks or they wouldn't...

  • RE: Democratizing the Microsoft MVP Award

    it is a ridiculous system - anybody can judge a person by their forum posts

    we do not need Microsoft's help

    and to be motivated by gaining MVP status? come on ...

Viewing 15 posts - 106 through 120 (of 129 total)