Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - SQL Reference » Using SQL » SQL functions » SQL functions (E-O)



Returns the value of an HTTP header.

HTTP_HEADER( header-field-name )
  • header-field-name   The name of an HTTP header field.




This function returns the value of the named HTTP header field, or NULL if not called from an HTTP service. It is used when processing an HTTP request via a web service.

If a header for the given header-field-name does not exist, the return value is NULL. The return value is also NULL when the function is not called from a web service.

Some headers that may be of interest when processing an HTTP web service request include the following. More information about these headers is available at [external link]

  • Cookie   The cookie value(s), if any, stored by the client, that are associated with the requested URI.

  • Referer   The URL of the page that contained the link to the requested URI.

  • Host   The name or IP of the host that submitted the request.

  • User-Agent   The name of the client application.

  • Accept-Encoding   A list of encodings for the response that are acceptable to the client application.

These special headers are always defined when processing an HTTP web service request:

  • @HttpMethod   Returns the type of request being processed. Possible values include HEAD, GET, or POST.

  • @HttpURI   The full URI of the request, as it was specified in the HTTP request.

  • @HttpVersion   The HTTP version of the request (for example, 1.0, or 1.1).

  • @HttpQueryString   Returns the query portion of the requested URI if it exists.

These special headers allow access to the first line of a client request (also known as the request line).

See also
Standards and compatibility
  • SQL/2003   Vendor extension.


When used within a stored procedure that is called by an HTTP web service, the following example gets the Cookie header value:

SET cookie_value = HTTP_HEADER( 'Cookie' );

When used within a stored procedure that is called by an HTTP web service, the following example returns the value of the first HTTP header.

SET header_name = NEXT_HTTP_HEADER( NULL );
SET header_value = HTTP_HEADER( header_name );