<indexterm><primary>sql</primary></indexterm> \r
<programlisting language="sql">\r
CREATE TABLE students (\r
- student_id int, barcode text, last_name text, first_name text, program_number text, program_name text,\r
- email text, address_type text, street1 text, street2 text, city text, province text, country text, \r
- postal_code text, phone text, profile int, ident_type int, home_ou int, \r
- claims_returned_count int DEFAULT 0, usrname text, net_access_level int DEFAULT 2, password text\r
+ student_id int, barcode text, last_name text, first_name text, program_number text, \r
+ program_name text, email text, address_type text, street1 text, street2 text, \r
+ city text, province text, country text, postal_code text, phone text, profile int, \r
+ ident_type int, home_ou int, claims_returned_count int DEFAULT 0, usrname text, \r
+ net_access_level int DEFAULT 2, password text\r
); \r
</programlisting>\r
<para>Note the <varname>DEFAULT</varname> variables. These allow you to set default for your library or to populate required fields if you data allows \r
<para>Insert records from the staging table into the <link linkend="actor.table.usr">actor.usr</link> Evergreen table:</para>\r
<programlisting language="sql">\r
INSERT INTO actor.usr (\r
- profile, usrname, email, passwd, ident_type, ident_value, first_given_name, family_name, day_phone, \r
- home_ou, claims_returned_count, net_access_level) \r
- SELECT profile, students.usrname, email, student_id, ident_type, student_id, first_name, last_name, \r
- phone, home_ou, claims_returned_count, net_access_level \r
+ profile, usrname, email, passwd, ident_type, ident_value, first_given_name, \r
+ family_name, day_phone, home_ou, claims_returned_count, net_access_level) \r
+ SELECT profile, students.usrname, email, student_id, ident_type, student_id, \r
+ first_name, last_name, phone, home_ou, claims_returned_count, net_access_level \r
FROM students;\r
</programlisting> \r
</step>\r
\r
-- Create staging table.\r
CREATE TABLE students (\r
- student_id int, barcode text, last_name text, first_name text, program_number text, program_name text, \r
- email text, address_type text, street1 text, street2 text, city text, province text, country text, \r
- postal_code text, phone text, profile int, ident_type int, home_ou int, \r
- claims_returned_count int DEFAULT 0, usrname text, net_access_level int DEFAULT 2, password text\r
+ student_id int, barcode text, last_name text, first_name text, program_number text, \r
+ program_name text, email text, address_type text, street1 text, street2 text, \r
+ city text, province text, country text, postal_code text, phone text, profile int, \r
+ ident_type int, home_ou int, claims_returned_count int DEFAULT 0, usrname text, \r
+ net_access_level int DEFAULT 2, password text\r
); \r
\r
\r
--Insert records from the staging table into the actor.usr table.\r
INSERT INTO actor.usr (\r
- profile, usrname, email, passwd, ident_type, ident_value, first_given_name, family_name, day_phone, \r
- home_ou, claims_returned_count, net_access_level) \r
- SELECT profile, students.usrname, email, student_id, ident_type, student_id, first_name, last_name, \r
- phone, home_ou, claims_returned_count, net_access_level FROM students;\r
+ profile, usrname, email, passwd, ident_type, ident_value, first_given_name, family_name, \r
+ day_phone, home_ou, claims_returned_count, net_access_level) \r
+ SELECT profile, students.usrname, email, student_id, ident_type, student_id, first_name, \r
+ last_name, phone, home_ou, claims_returned_count, net_access_level FROM students;\r
\r
--Insert records from the staging table into the actor.usr table.\r
INSERT INTO actor.card (usr, barcode) \r