REGD SMALL QUERY OUTPUT

  • I HAVE A QUERY WHICH GIVES THE OUTPUT

    1 BELTSVILABC

    2 BELTSVILABC_DEF

    3 BELTSVIL ABC_GHI

    4

    so i have 10 records in this way what all i need is a blank records between this.....

    like

    1 BELTSVIL ABC

    2

    3 BELTSVIL ABC_DEF

    4

    5 BELTSVIL ABC_GHI

    6

    7 BEL...

    is there anyway so that i can get the output in SSMS in siusch a way plz let me know thanks in advance

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • create table #tmp(iden int identity(1,2) , id int, value varchar(15))

    create table #tmp1(iden int identity(2,2) , id int, value varchar(15))

    insert into #tmp values( 1 , 'a')

    insert into #tmp values( 2 , 'b')

    insert into #tmp values( 3 , 'c')

    insert into #tmp values( 4 , 'd')

    insert into #tmp1 values( -999 , ' ')

    insert into #tmp1 values( -999 , ' ')

    insert into #tmp1 values( -999 , ' ')

    insert into #tmp1 values( -999 , ' ')

    select case when id=-999 then '' else cast(id as varchar(15)) end as id ,value from (

    select * from #tmp

    union

    select * from #tmp1

    ) a order by iden asc

    may be this help you ...

    [font="Calibri"]Raj[/font]
  • Dfine tat works but i dont have any id column there in my select statement ...let me show u what exactly i am doing

    select a.center,a.type,

    count(case when status = 'IN' then a.master_id else NULL end) as 'P',

    count (case when status = 'HOLD' then a.master_id else NULL end) as 'H',

    'section1' as section,getdate() as updated_date into #temp1

    from table1 a(nolock), table2 b(nolock)

    where a.master_id = b.master_id

    and a.status in ( 'IN' , 'HOLD' )

    and a.center is NOT NULL

    group by a.center,a.type

    i need to get the output of this with a blank after each record...can we do that .....

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

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

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