Overview


Understanding the concept

All communication with the Microsoft SQL Server occurs through one single Stored Procedure. It is possible to have several configuration with different procedures, but the standard is one single procedure.
We would recommend that you start with a simple query so that you can see what happens. For example: SELECT 'Hello world' as Data

Output variables

@ResponseDataMode - Decide the layout of the data
@ResponseHttpStatus - The http status code, default is 200
@ResponseContentType - The content type. This is automatically set by the @ResponseDataMode, but can be overrided.
@ResponseDebugID - Used for debugging. If this value has been set, a new procedure will be called after the request is processed.

ResponseDataMode

The standard mode is JSON, please note that single and multiple tables are handled differently.

Other modes:

Json1: The default behaviour if one table are returned. Multiple objects inside one array. [{data="value"},{data="value"}]
Json2: The default behaviour if two or more tables are returned.
httpredirect: Required column are "Url". The client will be redirected to the url specified in the first table, the first row and the column "Url", using serverside redirecting.
html: Required column are "html". The output are built using the data from the first table, the first row, and the column "html". The final output can be a result using several columns and several tables.
json: Required column are "json". The output are built using the data from the first table, the first row and the column "json". The final output can be a result using several columns and several tables.

ResponseHttpStatus

Standard is 200. Use 404 for "File not found". It is important that web.config has this value: <httpErrors existingResponse="PassThrough" />

ResponseContentType

This value will automatically be set based on the ResponseDataMode. You can override the ResponseContentType by setting this value.

ResponseDebugID

If you set this value to other than null, a new Stored Procedure will be called after the request are build with more debug values. Debug information can be very useful when you build new projects. One of the elements that can be logged is the complete response back to the user. Remember that there can be a lot of log-data if you have traffic-intensive sites. You should decide if you should turn the logging off before you go live.

Last updated: 26 nov 2015

Give us feedback

AngularJS <-> Microsoft SQL

Exchange data between your AngularJS application and your Microsoft SQL Server