Forum Replies Created

Viewing 15 posts - 601 through 615 (of 1,114 total)

  • RE: Time Calculation

    Welcome !:)

  • RE: Time Calculation

    Robert,

    Latest code is below.

    select Phoneno,

    'Cost' = Sum(Cost),

    Sum(convert(int,substring(Duration,1,2))) as Hours,

    Sum(convert(int,substring(Duration,4,2))) as Minutes,

    Sum(convert(int,substring(Duration,7,2))) as Seconds,

    'CalculatedSeconds' = case when Sum(convert(int,substring(Duration,7,2))) /60 >= 1

    ...

  • RE: Time Calculation

    I have tested for some more data.

    insert into CallCost

    select '9841145768','00:55:00',1

    union all

    select '9841145768','01:00:05',1

    union all

    select '9841145768','00:05:00',1

    The above code works fine.

    Phone Number Cost ...

  • RE: Time Calculation

    Try out this query and let me know.

    create table CallCost

    (

    Phoneno varchar(10),

    Duration varchar(15),

    Cost numeric(8,2)

    )

    insert into CallCost

    select '9841645768','00:20:15',20

    union all

    select '9841645768','00:00:15',1

    union all

    select '9940272484','00:55:01',60

    union all

    select '9940272484','00:01:15',2

    union all

    select '9940272484','00:10:15',10

    union all

    select '9841645768','00:00:55',1

    union all

    Query:

    select Phoneno,

    Sum(Cost),

    Sum(convert(int,substring(Duration,1,2))) as...

  • RE: eliminating duplicates

    Jeff,

    Heh... this all reminds me of another of my favorite 4 letter acronyms... RTFS!!!!!

    what do you mean by RTFS ?

  • RE: Congratulations to Our New MVPs

    Jeff and Michael,

    My hearty congrats !

  • RE: eliminating duplicates

    rbarryyoung,

    I am eagerly expecting your article.

  • RE: Merging more rows into single row

    Any ideas ?

  • RE: Return largest value of two columns in the same row

    Please don't post the same question twice.

  • RE: eliminating duplicates

    I never used this kind of coding in my queries.

    Jeff,

    If you explain a little bit more on rbarry's logic,it would be helpful for me.

    CHAR((2*Count(*)) + (CASE Sex When 'M' Then...

  • RE: Archetype Records

    I didn't find exact information about it.

  • RE: eliminating duplicates

    rbarryyoung,

    I have executed the part of your query. I am very surprised about your coding skill. Really, it is awesome code.

    I just executed the below part only.

    Select Name , Age,...

  • RE: Temporary Table problem

    I have executed the below query, It executed without error message.

    declare @strTable varchar(50)

    declare @strQuery nvarchar(100)

    Select @strTable = '#tmp1'

    select @strQuery = 'select * into ' + @strTable + ' from...

  • RE: Finding the position of a particular char in a string

    Ahmad,

    Try out this one,which is very faster than Loop.

    Declare @String varchar(40)

    Select @String = 'Tata Consultancy Limited'

    select N,substring(@String,N,1)

    from Tally

    where N <= len(@String)

    and substring(@String,N,1) = ''

    Output:

    N ...

  • RE: vtable

    Thanks Jeff and prabodh.

    So far as "vtables" go, are you talking about "Table Variables"?

    No.

    I understood the difference between =NULL,ISNULL and SET ANSIL NULL ON/OFF after reading the below article.

    http://www.sqlservercentral.com/articles/Basic+Querying/understandingthedifferencebetweenisnull/871/

    In...

Viewing 15 posts - 601 through 615 (of 1,114 total)