Requirement - I have to extract a lot of data out of our ERP database for prospective customer SARs under GDPR.
Assume the Temporary Table is something like the following:
SQL
createtable#GDPR_Temp(Customervarchar(12),Origin_TableVarchar(15),Datatext,Date_Readdatetime)
The Origin_Table field will be the table name queried.
The Data field will be the flat pipe-delimited text export of the data.
Example Origin Table:
SQL
selectrtrim(isnull(customer,'')),rtrim(isnull(address_ref,'')),rtrim(isnull(addr_desc,'')),rtrim(isnull(contact,'')),rtrim(isnull(title,'')),rtrim(isnull(initials,'')),rtrim(isnull(full_name,'')),rtrim(isnull(organisation,'')),rtrim(isnull(pobox,'')),rtrim(isnull(address,'')),rtrim(isnull(city,'')),rtrim(isnull(county,'')),rtrim(isnull(country,'')),rtrim(isnull(postcode,'')),rtrim(isnull(...