Created
March 27, 2012 01:15
-
-
Save jasonamyers/2211425 to your computer and use it in GitHub Desktop.
MS CRM: Select Non-email Attachments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
DocumentBody, | |
ObjectId, | |
FileName, | |
CONVERT(varchar(255), ObjectId) + '_' + CONVERT(varchar(255), Filename) AS SaveAsFileName | |
FROM | |
FilteredAnnotation | |
WHERE | |
IsDocument = 1 AND | |
(objecttypecode = 1 or -- Account Note Attachments | |
objecttypecode = 2 or -- Contact Note Attachments | |
objecttypecode = 3 or -- Opportunity Note Attachments | |
objecttypecode = 4 or -- Lead Note Attachments | |
objecttypecode = 4212 or -- All Task Note Attachments | |
objecttypecode = 4201 or -- All Appointment Note Attachments | |
objecttypecode = 4210) -- All Phone Call Note Attachments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment