Re: [SQL] best way to swap two records (computer details)

2005-03-23 Thread Gary Stainburn
On Wednesday 23 March 2005 5:26 pm, you wrote: > On Friday 18 March 2005 7:54 pm, you wrote: > > > My question is what's the best way to swap settings between the > > > two computer records and swap any software installed? Ideally > > > I'd like it in the form of a function where I can pass the tw

Re: [SQL] best way to swap two records (computer details)

2005-03-23 Thread Michael Long
> On Friday 18 March 2005 4:32 pm, you wrote: >> How about a user defined function ??? >> >> CREATE OR REPLACE FUNCTION harwareupdate(integer, integer) RETURNS >> BOOLEAN AS ' >> >> update pieces set p_name = \'LSALES1\', p_location = \'Mike >> Haley\', p_site = \'L\' where p_id = $1; >> >>

Re: [SQL] best way to swap two records (computer details)

2005-03-23 Thread Gary Stainburn
On Friday 18 March 2005 4:32 pm, you wrote: > How about a user defined function ??? > > CREATE OR REPLACE FUNCTION harwareupdate(integer, integer) RETURNS > BOOLEAN AS ' > > update pieces set p_name = \'LSALES1\', p_location = \'Mike > Haley\', p_site = \'L\' where p_id = $1; > > update pie

Re: [SQL] best way to swap two records (computer details)

2005-03-23 Thread Gary Stainburn
On Friday 18 March 2005 7:54 pm, you wrote: > > My question is what's the best way to swap settings between the two > > computer records and swap any software installed? Ideally I'd like > > it in the form of a function where I can pass the two p_id's and > > return a boolean reflecting success (t

Re: [SQL] best way to swap two records (computer details)

2005-03-18 Thread PFC
My question is what's the best way to swap settings between the two computer records and swap any software installed? Ideally I'd like it in the form of a function where I can pass the two p_id's and return a boolean reflecting success (true) or fail (false). I'd say something like that

Re: [SQL] best way to swap two records (computer details)

2005-03-18 Thread Greg Patnude
How about a user defined function ??? CREATE OR REPLACE FUNCTION harwareupdate(integer, integer) RETURNS BOOLEAN AS ' update pieces set p_name = \'LSALES1\', p_location = \'Mike Haley\', p_site = \'L\' where p_id = $1; update pieces set p_name = \'SPARE\', p_location = \'spare\', p_

[SQL] best way to swap two records (computer details)

2005-03-18 Thread Gary Stainburn
Hi folks. I have a table called pieces which contain every piece of hardware and software within my company. Each piece has an owner attribute which points to another piece which - funnily enough - owns it. For example records for CPU, motherboard, HDD, O/S, and applications will all be owned