microsoft / microsoft/sql-server-samples

NodeJs express4-tedious - Stored Procedure for SELECT to return response as JSON

Open
#605 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
11.2k
Forks
9.1k
Avg merge
2d 7h
Merged PRs (30d)
14

Description

Couldn't show the response in JSON while using a stored procedure.

I'm using express4-tedious to fetch results. It works fine if I use the select query but if I use the same with the stored procedure I don't know how to bind it in JSON.

The response screen is blank as I couldn't get the results.

var tediousExpress = require('express4-tedious');
var TYPES = require('tedious').TYPES;
var router = express.Router();
router.get('/:id', function (req, res) {
    req.sql("exec GETDataOfEmployee @id")
    .param('id', req.params.id, TYPES.VarChar)
    .exec(res)
});

Any suggestions would be of great help.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown Express route and the express4-tedious .exec(res) call, then compare its stored-procedure behavior with the select-query case described in the issue. Verify how the returned rows are exposed and whether the response is serialized as JSON; done means the route returns the stored procedure results instead of a blank response.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, node.js, sql
Domain
api, backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.