External Email - Exercise Caution
April, The script selects all of the unique values in Objects.ObjectName. In order to use the query in an INSERT, you would need to get the ObjectID. Because the query only returns 1 id for each unique object name (because of the HAVING COUNT(*) = 1 statement), I can use the MAX() function to get the id.

INSERT INTO PackageList (PackageID, ID, TableID, LoginID)
(SELECT {packageID}, MAX(ObjectID), 108, '{loginid}' FROM Objects GROUP BY ObjectName HAVING COUNT(*) = 1)

Change the contents of the curly brackets with your package id and your username.


On Tue, Jun 23, 2020 at 9:31 AM April Brown <[log in to unmask]<mailto:[log in to unmask]>> wrote:
External Email - Exercise Caution
I just took that data scrubbing class (which was great) and one of the scripts Chad gave was this:

Select ObjectName, Count(*)
From Objects
Group by ObjectName
Having Count(*) = 1

It seems entirely possible to get this list of records into a Package in TMS but I don’t know how to do it.  I already created the package I wanted to add the records to in TMS because I thought it would be easier than creating it in SQL. I thought it might be an Insert Into statement but I have never used one of those before.

Thanks,

April Brown
Registrar
The Charles Hosmer Morse Museum of American Art
Phone: (407) 645-5311  x. 105  |   Fax: (407) 647-1284
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.morsemuseum.org%2F&amp;data=02%7C01%7CTMSUSERS%40si-listserv.si.edu%7C71cf00521b964a647fa708d8186a325d%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637286191672964458&amp;sdata=GiMLTS%2FptNYdAeX92dcO%2BFNq1%2Bx0IDivdizjoQQYELc%3D&amp;reserved=0<https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.morsemuseum.org%2F&amp;data=02%7C01%7CTMSUSERS%40si-listserv.si.edu%7C71cf00521b964a647fa708d8186a325d%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637286191672964458&amp;sdata=GiMLTS%2FptNYdAeX92dcO%2BFNq1%2Bx0IDivdizjoQQYELc%3D&amp;reserved=0>

To unsubscribe, send an email to [log in to unmask]<mailto:[log in to unmask]> with the following commands in the body of the email:

signoff TMSUSERS

// eoj

You will receive a confirmation that your subscription has been removed.

To unsubscribe, send an email to [log in to unmask] with the following commands in the body of the email:

     signoff TMSUSERS

     //  eoj


You will receive a confirmation that your subscription has been removed.