Giter Site home page Giter Site logo

tsqlt-helper's Introduction

tSQLtHelper

tSQLtHelper is build with MSBuild.Sdk.SqlProj and .NET 6.

ConvertIntoInserts

This procedure converts @Query for given table into single insert command with many lines of values.

Usage

DECLARE @insertsCommand NVARCHAR(max);

EXEC tSQLtHelper.ConvertIntoInserts
    @TableName = 'dbo.invoice',
    @Query = 'SELECT inv_id, inv_type, inv_cust_id, inv_amount, inv_error FROM dbo.invoice',
    @Result = @insertCommand OUTPUT;

EXEC sp_executesql @insertsCommand;

where @insertsCommand is nicely formatted SQL command, which can be used inside tSQLt test.

INSERT INTO dbo.invoice (inv_id, inv_type, inv_cust_id, inv_amount, inv_date, inv_error) VALUES
    (1, 'FV ',          'ABCDE12345',  100.00, '2021-11-27', NULL),
    (2, 'FV1',   'Zażółć gęślą jaźń',   -1.00, '2021-11-28', NULL),
    (3, 'FV2', 'qwerty asdfgh zxcvb', 1234.56, '2021-11-29', '?'),
    (4, 'A  ',          'ABCDE12345',    0.00,         NULL, 'An ERROR occurred');

tsqlt-helper's People

Contributors

cagrin avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

thesqlguru

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.