selecting/creating new row

  • how could we?

    there is a row called TOT and if the value of it is = to 'errl'

    if this is true we want to add a row called Rcode with a value of 00001.

    thanks alot,

    matt

  • we got it thanks,

    in a view:

    'rcod' = CASE when TOT = 'errl' then '0001' END

  • You might try something like this:

    create table testit (rowname char(10), rowvalue char(10))

    insert into testit values('TOT','errl')

    insert into testit values('TOT','errl')

    insert into testit values('TOT','err2')

    select * from testit

    insert into testit select 'Rcode','00001' from (select distinct rowname,rowvalue from testit where rowname = 'TOT' and rowvalue = 'errl') a

    select * from testit

    drop table testit

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

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

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