fsprojects / fsprojects/FSharp.Data.SqlClient

Document usage of STRING_SPLIT with IN instead of Table-Valued Parameters

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

Nobody has claimed this yet.

docs up-for-grabs
Dominant language
F#
Stars
206
Forks
66
PR merge metrics
No merged PRs in 30d

Description

It seems the consensus on using IN is to explicitly use table-valued parameters, requiring defining types and putting your query in a stored procedure. There's a much easier way that abstracts away the TVP stuff that I suggest should be added to the documentation: Use STRING_SPLIT. Example:

    DECLARE @param varchar(1000) = @commaSeparatedList
    SELECT Col1 FROM MyTable
    WHERE Col2 IN (
      SELECT value FROM STRING_SPLIT(@param, ',')
    )

(It has to be declared to avoid the same error as described in #309.)

Contributor guide

Open the contributing guide

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

The issue points to documentation about using IN and table-valued parameters, plus related issue #309; start by finding that section. Add the STRING_SPLIT example and declaration guidance shown here, using the linked SQL Server reference. Done when the documentation clearly explains this alternative.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.