ODBC guide

Upload an attachment


Upload a file and attach it to a specific record. ParentSysId refers to the parent record's sys_id (table_sys_id) where the attachment will be linked. Provide the target TableName, the ParentSysId, the desired FileName as it appears in ServiceNow, and the local SourceFilePath.

-- Upload and attach local file to a 'incident' record 
SELECT * FROM upload_attachment 
WITH(
  TableName='incident',
  --below is sys_id from 'incident' table where you like to attach uploaded file
  ParentSysId='62304320731823002728660c4cf6a7e8',
  FileName='dump_saved.png',
  SourceFilePath='c:\temp\dump_saved.png'
)