|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Inserting row into view???case? Example would be: case when status = 'Fall-Off' then insert (select statement) else 'normal line' end I currently have this all posted from two days ago and I am under the gun to get this figured out, so I apologize if I seem to be clogging up space. So I thought to reword the question and see if it makes more sense written this way. Here is an example of the data that the code produces: 401844, ATL, Completed, National Vision, Inc, 2006-06-29, 2006, 6, Full-Time, 20.00, 15600.0, Atlanta-Perm, 15600.00, .00 NULL 401777, ATL, fall off, Cooper Lighting, 2006-06-29, 2006, 6, Full-Time, 20.00, 14000.0, Atlanta-Perm, 14000.00, -14000.00, 2006-06-30 401845, ATL, Completed, Angelica Textiles, 2006-06-29, 2006, 6, Full-Time, 20.00, 12000.0, Atlanta-Perm, 12000.00, .00, NULL 401778, ATL, Completed, Triumph Motorcycles, 2006-06-29, 2006, 6, Full-Time, 25.00, 15000.0, Atlanta-Perm, 15000.00, .00, NULL 401846, ATL, fall off, MedQuest Associates, 2006-06-29, 2006, 7, Full-Time, 25.00, 11000.0, Atlanta-Perm, 11000.00, -11000.00 2006-07-24 401780, ATL, Completed, Perma Fix, 2006-06-29, 2006, 6, Full-Time, 20.00, 936000.0, Atlanta-Perm, 18000.00, .00, NULL This is what I am trying to create: 401844, ATL, Completed, National Vision, Inc, 2006-06-29, 2006, 6, Full-Time, 20.00, 15600.0, Atlanta-Perm, 15600.00 401777, ATL, fall off, Cooper Lighting, 2006-06-29, 2006, 6, Full-Time, 20.00, 14000.0, Atlanta-Perm, 14000.00 401777, ATL, fall off, Cooper Lighting, 2006-06-30, 2006, 6, Full-Time, 20.00, 14000.0, Atlanta-Perm, -14000.00 (created by the insert to view) 401845, ATL, Completed, Angelica Textiles, 2006-06-29, 2006, 6, Full-Time, 20.00, 12000.0, Atlanta-Perm, 12000.00 401778, ATL, Completed, Triumph Motorcycles, 2006-06-29, 2006, 6, Full-Time, 25.00, 15000.0, Atlanta-Perm, 15000.00 401846, ATL, fall off, MedQuest Associates, 2006-06-29, 2006, 7, Full-Time, 25.00, 11000.0, Atlanta-Perm, 11000.00 401846, ATL, fall off, MedQuest Associates, 2006-07-24, 2006, 7, Full-Time, 25.00, 11000.0, Atlanta-Perm, -11000.00 (created by the insert to view) 401780, ATL, Completed, Perma Fix, 2006-06-29, 2006, 6, Full-Time, 20.00, 936000.0, Atlanta-Perm, 18000.00 Thank you Ted Locke Ted
CASE is an EXPRESSION, you cannot do that. Try instead IF ...... INSERT statement ELSE .......... Show quote "Ted Locke" <tlo***@solomonedwards.com> wrote in message news:%23kEVC$vtGHA.5084@TK2MSFTNGP04.phx.gbl... > This is kind of a repost. Is it possible to insert data into a view using > case? > Example would be: > case when status = 'Fall-Off' then insert (select statement) else 'normal > line' end > > I currently have this all posted from two days ago and I am under the gun > to get this figured out, so I apologize if I seem to be clogging up space. > So I thought to reword the question and see if it makes more sense written > this way. > > > Here is an example of the data that the code produces: > 401844, ATL, Completed, National Vision, Inc, 2006-06-29, 2006, 6, > Full-Time, 20.00, 15600.0, Atlanta-Perm, 15600.00, .00 NULL > 401777, ATL, fall off, Cooper Lighting, 2006-06-29, 2006, 6, Full-Time, > 20.00, 14000.0, Atlanta-Perm, 14000.00, -14000.00, 2006-06-30 > 401845, ATL, Completed, Angelica Textiles, 2006-06-29, 2006, 6, Full-Time, > 20.00, 12000.0, Atlanta-Perm, 12000.00, .00, NULL > 401778, ATL, Completed, Triumph Motorcycles, 2006-06-29, 2006, 6, > Full-Time, 25.00, 15000.0, Atlanta-Perm, 15000.00, .00, NULL > 401846, ATL, fall off, MedQuest Associates, 2006-06-29, 2006, 7, > Full-Time, 25.00, 11000.0, Atlanta-Perm, 11000.00, -11000.00 2006-07-24 > 401780, ATL, Completed, Perma Fix, 2006-06-29, 2006, 6, Full-Time, 20.00, > 936000.0, Atlanta-Perm, 18000.00, .00, NULL > > This is what I am trying to create: > 401844, ATL, Completed, National Vision, Inc, 2006-06-29, 2006, 6, > Full-Time, 20.00, 15600.0, Atlanta-Perm, 15600.00 > 401777, ATL, fall off, Cooper Lighting, 2006-06-29, 2006, 6, Full-Time, > 20.00, 14000.0, Atlanta-Perm, 14000.00 > 401777, ATL, fall off, Cooper Lighting, 2006-06-30, 2006, 6, Full-Time, > 20.00, 14000.0, Atlanta-Perm, -14000.00 (created by the insert to view) > 401845, ATL, Completed, Angelica Textiles, 2006-06-29, 2006, 6, Full-Time, > 20.00, 12000.0, Atlanta-Perm, 12000.00 > 401778, ATL, Completed, Triumph Motorcycles, 2006-06-29, 2006, 6, > Full-Time, 25.00, 15000.0, Atlanta-Perm, 15000.00 > 401846, ATL, fall off, MedQuest Associates, 2006-06-29, 2006, 7, > Full-Time, 25.00, 11000.0, Atlanta-Perm, 11000.00 > 401846, ATL, fall off, MedQuest Associates, 2006-07-24, 2006, 7, > Full-Time, 25.00, 11000.0, Atlanta-Perm, -11000.00 (created by the insert > to view) > 401780, ATL, Completed, Perma Fix, 2006-06-29, 2006, 6, Full-Time, 20.00, > 936000.0, Atlanta-Perm, 18000.00 > > Thank you > Ted Locke > Cool thank you, I will try that...
I will repost my results. Show quote "Uri Dimant" <u***@iscar.co.il> wrote in message news:ud%237aJwtGHA.5032@TK2MSFTNGP04.phx.gbl... > Ted > > CASE is an EXPRESSION, you cannot do that. > > Try instead > > IF ...... > INSERT statement > ELSE > ......... > > > "Ted Locke" <tlo***@solomonedwards.com> wrote in message > news:%23kEVC$vtGHA.5084@TK2MSFTNGP04.phx.gbl... >> This is kind of a repost. Is it possible to insert data into a view >> using case? >> Example would be: >> case when status = 'Fall-Off' then insert (select statement) else 'normal >> line' end >> >> I currently have this all posted from two days ago and I am under the gun >> to get this figured out, so I apologize if I seem to be clogging up >> space. So I thought to reword the question and see if it makes more sense >> written this way. >> >> >> Here is an example of the data that the code produces: >> 401844, ATL, Completed, National Vision, Inc, 2006-06-29, 2006, 6, >> Full-Time, 20.00, 15600.0, Atlanta-Perm, 15600.00, .00 NULL >> 401777, ATL, fall off, Cooper Lighting, 2006-06-29, 2006, 6, Full-Time, >> 20.00, 14000.0, Atlanta-Perm, 14000.00, -14000.00, 2006-06-30 >> 401845, ATL, Completed, Angelica Textiles, 2006-06-29, 2006, 6, >> Full-Time, 20.00, 12000.0, Atlanta-Perm, 12000.00, .00, NULL >> 401778, ATL, Completed, Triumph Motorcycles, 2006-06-29, 2006, 6, >> Full-Time, 25.00, 15000.0, Atlanta-Perm, 15000.00, .00, NULL >> 401846, ATL, fall off, MedQuest Associates, 2006-06-29, 2006, 7, >> Full-Time, 25.00, 11000.0, Atlanta-Perm, 11000.00, -11000.00 2006-07-24 >> 401780, ATL, Completed, Perma Fix, 2006-06-29, 2006, 6, Full-Time, 20.00, >> 936000.0, Atlanta-Perm, 18000.00, .00, NULL >> >> This is what I am trying to create: >> 401844, ATL, Completed, National Vision, Inc, 2006-06-29, 2006, 6, >> Full-Time, 20.00, 15600.0, Atlanta-Perm, 15600.00 >> 401777, ATL, fall off, Cooper Lighting, 2006-06-29, 2006, 6, Full-Time, >> 20.00, 14000.0, Atlanta-Perm, 14000.00 >> 401777, ATL, fall off, Cooper Lighting, 2006-06-30, 2006, 6, Full-Time, >> 20.00, 14000.0, Atlanta-Perm, -14000.00 (created by the insert to view) >> 401845, ATL, Completed, Angelica Textiles, 2006-06-29, 2006, 6, >> Full-Time, 20.00, 12000.0, Atlanta-Perm, 12000.00 >> 401778, ATL, Completed, Triumph Motorcycles, 2006-06-29, 2006, 6, >> Full-Time, 25.00, 15000.0, Atlanta-Perm, 15000.00 >> 401846, ATL, fall off, MedQuest Associates, 2006-06-29, 2006, 7, >> Full-Time, 25.00, 11000.0, Atlanta-Perm, 11000.00 >> 401846, ATL, fall off, MedQuest Associates, 2006-07-24, 2006, 7, >> Full-Time, 25.00, 11000.0, Atlanta-Perm, -11000.00 (created by the insert >> to view) >> 401780, ATL, Completed, Perma Fix, 2006-06-29, 2006, 6, Full-Time, 20.00, >> 936000.0, Atlanta-Perm, 18000.00 >> >> Thank you >> Ted Locke >> > > |
|||||||||||||||||||||||