Forum Replies Created

Viewing 15 posts - 286 through 300 (of 3,011 total)

  • RE: Last Sunday of a month in sql

    dwain.c (2/11/2013)


    Michael Valentine Jones (2/11/2013)


    dwain.c (2/11/2013)


    If you don't like magic numbers, I think you can do it this way too:

    select

    a.DT,

    LastDayofMonth = dateadd(mm,datediff(mm,-1,a.DT),-1),

    LastSundayofMonth =

    dateadd(dd,(datediff(dd,'17530107',dateadd(mm,datediff(mm,-1,a.DT),-1))/7)*7,'17530107'),

    DwainsWay =

    ...

  • RE: Last Sunday of a month in sql

    ScottPletcher (2/11/2013)


    Michael Valentine Jones (2/11/2013)


    ScottPletcher (2/11/2013)


    ScottPletcher (2/11/2013)

    ...

    I haven't been in any business that worked with dates before 1900, but if yours did, then that would be a relevant concern for...

  • RE: Separate ETL server

    I prefer to have the ETL (SSIS) installed on a different server because it is quite common to need to install or update additional software, controls, DLLS, etc. that might...

  • RE: separate account for each SQL Server service

    I usually use the same AD account for the SQL Server Database Engine and SQL Server Agent but use AD different accounts for SQL Server Analysis Services and SQL Server...

  • RE: Last Sunday of a month in sql

    ScottPletcher (2/11/2013)


    ScottPletcher (2/11/2013)

    ...

    I haven't been in any business that worked with dates before 1900, but if yours did, then that would be a relevant concern for you. Besides, we...

  • RE: Last Sunday of a month in sql

    ScottPletcher (2/11/2013)


    Method below works for any and all date and language settings:

    DECLARE @startDate datetime

    DECLARE @number_of_months int

    SET @startDate = GETDATE()

    SET @number_of_months = 7

    SELECT

    DATEADD(DAY, DATEDIFF(DAY, '19000107', last_day_of_month) /...

  • RE: Last Sunday of a month in sql

    dwain.c (2/11/2013)


    If you don't like magic numbers, I think you can do it this way too:

    select

    a.DT,

    LastDayofMonth = dateadd(mm,datediff(mm,-1,a.DT),-1),

    LastSundayofMonth =

    dateadd(dd,(datediff(dd,'17530107',dateadd(mm,datediff(mm,-1,a.DT),-1))/7)*7,'17530107'),

    DwainsWay =

    1+dateadd(mm,datediff(mm,-1,a.DT),-1)-DATEPART(weekday,...

  • RE: Last Sunday of a month in sql

    Find the last day of the month, and then find the Sunday on or before that date.

    select

    a.DT,

    LastDayofMonth = dateadd(mm,datediff(mm,-1,a.DT),-1),

    LastSundayofMonth =

    dateadd(dd,(datediff(dd,'17530107',dateadd(mm,datediff(mm,-1,a.DT),-1))/7)*7,'17530107')

    from

    ( -- Test data

    select DT = getdate()union all

    select DT =...

  • RE: Preparing for a job interview...

    Although you should not come across as bitter (as others have said), you should be prepared to give a short, non-emotional explanation of why you are looking for a new...

  • RE: compress backup

    sqlfriends (2/5/2013)


    Thanks, it seems there is some downside when doing compression backup, it uses more of resources than regular backup

    Not necessarily. It reduces the disk and/or network IO, so...

  • RE: Optimize ad hoc workloads

    sqlfriends (2/5/2013)


    We have a database server that has databases for research department.

    It is used mainly for them to read data using select queries, or combine some data together to write...

  • RE: Encryption noob with a table design general question

    Jeff Moden (2/1/2013)


    Michael Valentine Jones (2/1/2013)


    William Plourde (2/1/2013)


    ok, I think I understand that. So if fetching the 'common' un enc data just make sure I use the appropriate field list...

  • RE: Encryption noob with a table design general question

    William Plourde (2/1/2013)


    ok, I think I understand that. So if fetching the 'common' un enc data just make sure I use the appropriate field list in the query. And if...

  • RE: Backup Time for 2 TB DB

    Why can't you just run a backup and see how long it takes?

  • RE: When is shrinking a data file acceptable?

    TheSQLGuru (1/24/2013)


    Ninja's_RGR'us (6/17/2011)


    Dan.Humphries (6/17/2011)


    You know I don't know that I really gave it much thought. My mind just said that made sense and I went with it. But...

Viewing 15 posts - 286 through 300 (of 3,011 total)