Sample code for 30+ languages & platforms
SQL Server

Example: Http.GetUrlPath method

Demonstrates the GetUrlPath method.

Chilkat SQL Server Downloads

SQL Server
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @success int
    SELECT @success = 0

    DECLARE @http int
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @url nvarchar(4000)
    SELECT @url = 'https://example.com/folder/page?lang=en&sort=asc#section2'
    EXEC sp_OAMethod @http, 'GetUrlPath', @sTmp0 OUT, @url
    PRINT @sTmp0

    -- Output:

    -- /folder/page

    EXEC @hr = sp_OADestroy @http


END
GO