Table Record - Delete
Delete a ServiceNow table record using SQL Server
- See SQLHTTP easy setup for ServiceNow
- See API Call documentation for parameter values and other information
- Create the stored procedure documented below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
CREATE PROCEDURE usp_ServiceNow_Table_Record_Delete( @Profile nvarchar(100), @TableName varchar(MAX), @Sys_id varchar(50), @Response nvarchar(MAX) OUTPUT, @StatusCode int OUTPUT, @StatusDescription nvarchar(MAX) OUTPUT) AS DECLARE @URL nvarchar(MAX) DECLARE @QueryString varchar(MAX) DECLARE @UserName nvarchar(4000) DECLARE @Password nvarchar(4000) DECLARE @HTTPSessionID uniqueidentifier SET @URL = SQLHTTP.net.AuthParam(@Profile, 'Domain') EXEC SQLHTTP.net.UrlBuilder @URL OUTPUT, @Profile, 'api', 'now', 'table', @TableName, @Sys_id EXEC SQLHTTP.net.HTTPSession @HTTPSessionID OUTPUT SET @UserName = SQLHTTP.net.AuthParam(@Profile, 'UserName') SET @Password = SQLHTTP.net.AuthParam(@Profile, 'Password') EXEC SQLHTTP.net.BasicAuthHeader @HttpSessionID, @UserName, @Password EXEC SQLHTTP.net.HTTPRequest @HttpSessionID, @URL = @URL, @Method = 'DELETE', @Accept = 'application/xml', @StatusCode = @StatusCode OUTPUT, @StatusDescription = @StatusDescription OUTPUT, @Response = @Response OUTPUT GO |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
DECLARE @Response nvarchar(MAX) DECLARE @StatusCode int DECLARE @StatusDescription nvarchar(MAX) EXEC usp_ServiceNow_Table_Record_Delete @Profile = 'My ServiceNow', @TableName = 'incident', @Sys_id = '9e098c630f72030041ea06ace1050e1d', @Response = @Response OUTPUT, @StatusCode = @StatusCode OUTPUT, @StatusDescription = @StatusDescription OUTPUT SELECT @StatusCode AS StatusCode, @StatusDescription AS StatusDescription |
1 2 3 4 5 |
StatusCode StatusDescription ----------- ------------------- 204 No Content |
IMPORTANT DISCLAIMER
CODE/SQL ON THESE PAGES ARE PROVIDED AS-IS AND ARE AVAILABLE FOR ILLUSTRATIVE PURPOSES ONLY.
USERS ARE REQUIRED TO ABIDE BY THE TERMS AND CONDITIONS FOR USING REFERENCED THIRD PARTY WEBSITES AND/OR APIs FROM THEIR RESPECTIVE WEBSITES. WE DO NOT CONDONE ANY VIOLATION OF THIRD PARTY WEBSITES AND/OR APIs TERMS AND CONDITIONS USING OUR SOFTWARE.
USERS SHALL BE SOLELY RESPONSIBLE AND BE SOLELY LIABLE FOR VIOLATION OF ANY RULES SPECIFIED BY THIRD PARTIES FOR USING THEIR WEBSITES AND/OR APIs, OR INFRINGEMENT OF RIGHTS OF SUCH THIRD PARTIES.