Two result set merging into one column only...!!

  • I am creating a tmp table into a stored procedure in which I have two columns using convert function.

    td= CONVERT(CHAR(8),DATEADD(SECOND,PackageDuration,'0:00:00'),108), ' ',

    -- this column is converting seconds(int) in HH:MM:SS

    tb= CONVERT(CHAR(24),DATEOFRUN,120), ''

    -- this column is displaying date and time of the package run

    Now the problem I am facing is I am getting these two columns in one resultset only.

    i.e. 00:00:00 00 FEB 0000 00:22:36

    Please anybody can help...!! 🙁 🙁

  • Generally I would advise doing the formatting in the presentation layer, but if you have to do it in the query:

    select CONVERT(CHAR(8),DATEADD(SECOND,PackageDuration, 0), 108) + ' ' + CONVERT(CHAR(24), DATEOFRUN, 120)

    └> bt



    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Thanks bteraberry,

    But i got the solution in diff. way. I just wanted time from the second column and I modified it and now it is giving me the result i wanted.

    I used "CONVERT(CHAR(8), DATEOFRUN, 108)" to get only time from datetime column.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply