Forum Replies Created

Viewing 13 posts - 16 through 29 (of 29 total)

  • RE: Split comma separate single row into multiple rows

    Drew is right! you can follow Jeff Moden[/url]'s article[/url] about the tally table. It is a very good article and helps me a lot. You can check that out if...

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: DateDiff to HH:MM format question

    try this one..

    declare @startDate datetime

    declare @endDate datetime

    set @startDate = '2011-12-22 15:20:00.000'

    set @endDate = '2011-12-22 16:03:09.000'

    select convert(varchar(30), (datediff(mi, @startDate, @endDate) / 60))

    + ':' +

    convert(varchar(30), (datediff(mi, @startDate, @endDate) % 60))

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: Please help with a simple query, I need to group data in a certain way (example available)

    select ID,

    (case when [Large] > 0 then 'Yes' else 'No' end)[Large],

    (case when [Small] > 0 then 'Yes' else 'No' end)[Small]

    from ##TableName a

    pivot

    (

    count(Size)

    for Size in ([Large], [Small])

    ) b

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: Time Computation Challenge

    Hi Cadavre!

    Thank you very much for your response I just read it by now and tried to run all the possible scenarios specially where I was stuck, like if the...

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: Time Computation Challenge

    ok my apology, here is what i've made so far

    declare @startTime datetime = '2011-12-09 07:31 AM'

    declare @endTime datetime = '2011-12-09 4:31 PM'--540 mins

    select datediff(mi, @startTime, @endTime) -

    sum

    (

    case when...

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: Time Computation Challenge

    I don't have code yet, that is what I am thinking of, so I it is open to all approaches just to arrive with the solution.

    Thanks for your cooperation! 🙂

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: Time Computation Challenge

    Im stuck with the condition if the @startTime or @endTime is in between the BreakTimeFrom and BreakTimeTo.

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: Compare two records of the same table

    can you try this?

    declare @a varchar(255) = ''

    select @a = @a + Col1 + Col2 + Col3 + ';'

    from

    (

    select 'A'[Col1], 'B'[Col2], 'ABC'[Col3]

    union all

    select 'A', 'B', 'CDE'

    union all

    select 'A', 'B',...

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: Need Script to create log file

    try to look for Change Data Capture(cdc) feature of Sql Server. This would be efficient than creating triggers for each table especially when you have lots of table to be...

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: AGGREGATE

    Walang Anuman Sir! ^_^,

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: AGGREGATE

    (case when) statement is not supported in access.

    can u try this?

    select Category,

    sum(iif(left(Barcode, 1) in ('M', 'D'), Qty, 0)[Regular],

    sum(iif(left(Barcode, 1) in ('A', 'B'), Qty, 0)[Sales],

    from SalesDetail

    group by Category

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: AGGREGATE

    another solution...

    select Category,

    sum(case when left(Barcode, 1) in ('M', 'D') then Qty else 0 end)[Regular],

    sum(case when left(Barcode, 1) in ('A', 'B') then Qty else 0 end)[Sales]

    from SalesDetail

    group by Category

    "Often speak with code not with word,
    A simple solution for a simple question"

  • RE: Msg 207, Level 16, State 1 Invalid column name

    Is there trigger associated with this table?

    "Often speak with code not with word,
    A simple solution for a simple question"

Viewing 13 posts - 16 through 29 (of 29 total)