Forum Replies Created

Viewing 15 posts - 1,681 through 1,695 (of 6,036 total)

  • RE: Date Function

    SumonB (1/20/2016)


    Hi Scott,

    I just need the current date and a date before 15 days to find out whatever backups I took during the last 15 days.

    I changed the code...

  • RE: Date Function

    Here the query I used to test the outcome:

    SELECT DO.RunTime,

    DATEPART(dd, DateOnly),

    CASE WHEN DATEPART(dd, DateOnly) > DO.Threshold

    THEN DATEADD(dd, -15, DateOnly)

    ELSE DATEADD(dd, -1, DATEADD(mm, DATEDIFF(mm, 0, DateOnly), 0) )...

  • RE: Date Function

    SumonB (1/15/2016)


    Can anyone help me with this. I am trying to create a start date and end based on the current date. The code is not calculating properly if my...

  • RE: Date Function

    SumonB (1/19/2016)


    Hi Scott,

    I executed the code today..

    Declare @StartDate Datetime,

    @EndDate Datetime

    if DAY(@StartDate) >= 7

    set @StartDate = DATEADD(day, -15, DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0))

    else

    set @StartDate = DATEADD(DAY, -1, DATEADD(MONTH, DATEDIFF(MONTH, 0,...

  • RE: Stored Procedures slower than queries

    Stijn977 (1/15/2016)


    serg-52 (1/15/2016)


    Sergiy (1/14/2016)


    Apart from that.

    How do you deal with concurrent updates?

    If 2 or more users edit the same record in their independent instances of C++ application - which version...

  • RE: Stored Procedures slower than queries

    Stijn977 (1/15/2016)


    took me a minute to realize what you meant, but I think you mean:

    use ISNULL everywhere

    for those fields which allow NULL : use CASE ?

    No, what...

  • RE: Idetify repeated values from a table

    It seems like you need a "running total update".

    See the article describing how to do it:

    http://www.sqlservercentral.com/articles/T-SQL/68467/

  • RE: Stored Procedures slower than queries

    Apart from that.

    How do you deal with concurrent updates?

    If 2 or more users edit the same record in their independent instances of C++ application - which version of the record...

  • RE: Stored Procedures slower than queries

    Stijn977 (1/14/2016)


    Hi Sergiy, appreciate you joining the discussion.

    Unfortunately your idea isn't fitting for me because:

    - if the update runs, it would update all fields of the table (in case...

  • RE: Idetify repeated values from a table

    nm.rajesh (1/14/2016)


    If the measure value is repeated and the count of them is greater or equal to 8 then i want to flag and delete them

    Do you want to delete...

  • RE: Result set should return all values inspite of a "Where clause"

    Jeff Moden (1/14/2016)


    Shifting gears... I don't know what you're doing with your million row result set but, if you're returning it to the screen, you're probably doing something wrong. ...

  • RE: How to identify duplicate data with out Primary Key

    Using the harness from Phil's post:

    if OBJECT_ID('tempdb..#dupes') is not null

    drop table #dupes;

    create table #dupes (

    Id int identity (1,1) primary key clustered,

    Col1 int,

    Col2 Varchar(10),

    Col3 Varchar(10),

    Col4 Date,

    Col5 Varchar(10)

    )

    insert #dupes (...

  • RE: Stored Procedures slower than queries

    Stijn977 (1/12/2016)


    Thanks all who contributed.

    I did continue altering my SP-generator (I don't want to create a SP by hand for each table in the database), this now generates the...

  • RE: Header and Detail Data

    Jeff Moden (1/12/2016)


    Orlando Colamatteo (1/12/2016)


    Anyway, here is a resultset with the data in a fixed-width format and you can tweak it from here. If the header and detail lines need...

  • RE: query for datetime

    Hugo Kornelis (1/12/2016)


    If you insist on basing your ideas on relational theory on implementation choices made by Microsoft, then I guess we'll have to agree to disagree on this.

    Agree to...

Viewing 15 posts - 1,681 through 1,695 (of 6,036 total)