Forum Replies Created

Viewing 15 posts - 151 through 165 (of 414 total)

  • RE: Result needed in a specific format

    Will this solve your problem?

     

    declare @table table(Name varchar(10), CreditCardNo int)

    insert @table select 'Arun', 1234567

    insert @table select 'Arun', 3456787

    insert @table select 'Amit', 5634566

    insert @table select 'Amit', 2345565

    select Name, min(CreditCardNo), max(CreditCardNo) from...

  • RE: Date three months ago (sort of...)

    Excellent

  • RE: An If statement in the Where clause

    Interesting link....

    Do we know that the column PublishOnIntra is included in an index? If it isn't, I still think that my suggestion can...

  • RE: Date three months ago (sort of...)

    Despite the description of the table in the initial post, I don't think there is an identity column (or a sequential ID) on the table. Quote:

    I am starting to resign myself...
  • RE: An If statement in the Where clause

    Maybe

    WHERE (@READONLY=1 or PublishOnIntra = 1)

    is better. This way, the condition "PublishOnIntra = 1" is probably ignored when @READONLY equals 1. But I am not sure....

  • RE: Date three months ago (sort of...)

    Please explain in more detail why my method fails - the code below returns "05-12" as requested...

     

    declare @Dates table(Code varchar(10), StartDate datetime, EndDate datetime)

    insert @Dates select '05-10', '2005-10-01 00:00:00.000', '2005-10-28...

  • RE: Date three months ago (sort of...)

    Correction: Replace getdate() above by

    dateadd(d, datediff(d, '1900', getdate()), '1900')

    to get rid of hours, minutes, seconds and milliseconds...

  • RE: Date three months ago (sort of...)

    Oh, I thought this problem was about calculating all rows of the table you were referencing above

    I assume (now) that you have a...

  • RE: Date three months ago (sort of...)

    Could you state more precisely how StartDate and EndDate are calculated? StartDate is always a Saturday, not a Monday...

    It seems to be enough to describe how one of the dates are...

  • RE: Question regarding NULLS

    Then you will also get "0 = NULL"-matches, which is probably not what you want....

  • RE: Get Curent Users PC Name / IP Address

    To run this I needed a minor modification:

    create table #t (detail varchar(255) null)

  • RE: Question regarding NULLS

    You could use

    (x = y or (x is null and y is null)),

    (x != y or (x is null and y is not null) or (x is not null and...

  • RE: Matching one set with another

    Glad you worked it out , it's more complicated than the first problem. I would probably have attempted a similar solution...You might however want...

  • RE: How to realize exclusion on date periods?

    You are probably thinking of something like this:

    select p.* from @PeriodsPossible p

    where not exists

    (select * from @PeriodsUsed u

    where

    (p.StartDate <= u.StartDate and u.StartDate <= p.EndDate)

    or

    (u.StartDate <= p.StartDate and p.StartDate <= u.EndDate)

    )

    It...

  • RE: How to realize exclusion on date periods?

    Try this:

     

    declare @PeriodsUsed table (StartDate datetime, EndDate datetime)

    insert @PeriodsUsed select '2006-05-05', '2006-05-17'

    insert @PeriodsUsed select '2006-05-24', '2006-05-24'

    insert @PeriodsUsed select '2006-06-01', '2006-06-22'

    declare @PeriodsPossible table (StartDate datetime, EndDate datetime)

    insert @PeriodsPossible select '2006-05-01', '2006-05-05'

    insert...

Viewing 15 posts - 151 through 165 (of 414 total)