EdHubbard
4th February 2005, 18:04
I would be grateful if somebody out there could help me with a bit of SQL to do the actual copying of the user defaults in table from one user to another.
I have the bare bones of the session ready but when I come to actually writing the select statement I am at a loss.

I have defined my user.f and user.t form variables as externs.....

db.retry.point()
select ttadv990.*
from ttadv990 for update
where ttadv990._compnr = 000
and ttadv990.user = :user.f


Thanks

shaboo
4th February 2005, 19:14
I believe something like this should work.

db.retry.point()
select ttadv990.*
from ttadv990 for update
where ttadv990._compnr = 000
and ttadv990.user = :user.f
selectempty
|Source User doesn't exist
selectdo
ttadv990.user = :user.t
db.insert(tttadv990, db.retry)
commit.transaction()
endselect

NPRao
4th February 2005, 20:36
db.retry.point()
select ttadv990.*
from ttadv990
where ttadv990._compnr = 000
and ttadv990.user = :user.f
selectdo
ttadv990.user = user.t
if db.insert(tttadv990, db.retry, db.return.dupl) <> EDUPL then
commit.transaction()
else
abort.transaction()
|* if the user defaults exist and you dont want to overwrite
endif
commit.transaction()
endselect

EdHubbard
5th February 2005, 00:23
This does exactly as I needed


Thanks

Ed