-
Notifications
You must be signed in to change notification settings - Fork 22
How to Insert User Terms
skyhit edited this page Mar 5, 2017
·
2 revisions
database common_oltp;
-- Insert Reviewer terms of use for 'twight'
INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id, create_date, modify_date) VALUES (124766, 20704, '2017-02-08 10:00:00.0', '2017-02-08 10:00:00.0');
-- Insert 'Standard Terms for TopCoder Competitions v2.0' for 'wyzmo'
INSERT INTO user_terms_of_use_xref(user_id, terms_of_use_id, create_date, modify_date) VALUES (124856, 21193, '2017-02-08 10:00:00.0', '2017-02-08 10:00:00.0');
- Accept Terms For All Users
DATABASE tcs_catalog;
INSERT INTO user_terms_of_use_xref
SELECT u.user_id, t.terms_of_use_id, CURRENT, CURRENT
FROM user u
JOIN terms_of_use t ON 1=1
LEFT JOIN (SELECT user_id, terms_of_use_id FROM user_terms_of_use_xref) x
ON x.user_id = u.user_id AND x.terms_of_use_id = t.terms_of_use_id
WHERE x.user_id IS NULL;