Extend SQL with Dynamic Evaluation at Runtime Using C# Expression


 Download
* PRO Version unlocked for the current month

-- Evaluate dynamically expression in T-SQL
DECLARE @tableFormula TABLE (
   Formula VARCHAR(255), X INT, Y INT, Z INT
)

INSERT  INTO @tableFormula VALUES ('x+y*z', 1, 2, 3 ), 
                                  ('(x+y)*z', 1, 2, 3 )
-- SELECT 7
-- SELECT 9
SELECT SQLNET::New(Formula)
              .ValueInt('x', X)
              .ValueInt('y', Y)
              .ValueInt('z', Z).EvalInt()
FROM @tableFormula

Amazing performance, outstanding support!

 Read More Success Story



Share your experience. We love to hear from you: info@zzzprojects.com

Evaluate dynamic arithmetic/math expression in SQL

Make the impossible now possible. Evaluate C# expression in SQL to overcome limitations.

  • Allow trusted users to create report field and filter
  • Consume Web Service
  • Replace text in template with String Interpolation
-- CREATE test
DECLARE @table TABLE ( X INT, Y INT, Z INT )
INSERT  INTO @table VALUES  ( 2, 4, 6 ),  ( 3, 5, 7 ), ( 4, 6, 8 )

-- Result: 14, 22, 32
DECLARE @sqlnet SQLNET = SQLNET::New('x*y+z')
SELECT  @sqlnet.ValueInt('x', X)
               .ValueInt('y', Y)
               .ValueInt('z', Z)
               .EvalInt()
FROM    @table

Split text with delimiter

Improve performance and capability for splitting text with an easy to use split function and LINQ expressions.

  • Split text with multiple delimiters
  • Split text using a regular expression
  • Include row index
-- CREATE test
DECLARE @t TABLE (Id INT , Input VARCHAR(MAX))
INSERT  INTO @t VALUES  ( 1, '1, 2, 3; 4; 5' ), ( 2, '6;7,8;9,10' )

-- SPLIT with many delimiters: ',' and ';'
DECLARE @sqlnet SQLNET = SQLNET::New('Regex.Split(input, ",|;")')

SELECT  *
FROM    @t AS A
        CROSS APPLY ( SELECT    *
                      FROM      dbo.SQLNET_EvalTVF_1(@sqlnet.ValueString('input', Input))
                    ) AS B

Use regular expression in SQL Server

Use Regex flexibility to overcome “LIKE” and “PATHINDEX” limitations.

  • IsMatch
  • Match
  • Matches
  • Replace
  • Split
DECLARE @customer TABLE ( Email VARCHAR(255) )

INSERT  INTO @customer
VALUES  ( 'info@zzzprojects.com' ),
        ( 'invalid.com' ),
        ( 'sales@zzzprojects.com' )

DECLARE @valid_email SQLNET = SQLNET::New('Regex.IsMatch(email, 
@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")')

-- SELECT 'invalid.com'
SELECT * FROM @customer WHERE @valid_email.ValueString('email', Email).EvalBit() = 0

Replace xp_cmdshell with restrictive alternative

Avoid enabling xp_cmdshell and compromising your SQL Server and use instead a more restrictive solution.

  • Impersonate Context
  • Improve maintainability
  • Improve readability
  • Improve security
-- REQUIRE EXTERNAL_ACCESS permission
DECLARE @sqlnet SQLNET = SQLNET::New('
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

var dir = new DirectoryInfo(path);
return dir.GetFiles("*.*")
          .Select(x => new { x.FullName, FileContent = File.ReadAllText(x.FullName) })
          .OrderBy(x => x.FullName)')
          .Impersonate()

-- SELECT FullName, FileContext FROM DesktopFiles ORDER BY Fullname
EXEC dbo.SQLNET_EvalResultSet @sqlnet

 View More Features

Test our Outstanding Support

We usually answer within the next business day, hour, or minutes!


Contact Us

Email our team for any questions. We love to hear from you!

info@zzzprojects.com

Wiki

Consult our complete documentation to help you getting started.

Wiki

Forum

Visit the forum to report issues, ask questions, and propose new features.

Forum

Open Source

Access the source of the library you're using to understand better its logic.

GitHub

Pricing


Eval SQL.NET is a safe, flexible and scalable solution to perform all dynamic operations.

Change "Mission Impossible" code to easy task and reduce your development cost and time.

  • Improve performance over UDF & TVF
  • Increase maintainability over complex SQL
  • Increase readability over complex SQL

SQL developer has waited so long to get an Eval Function. It's now possible and easy to evaluate code dynamically.


Every month, a FREE trial of the PRO version is available to let you evaluate all its features without limitations.

FREE PRO
Maximum Characters 50 Unlimited
Commercial License
Support & Upgrades (1 year)


* Contact us (sales@zzzprojects.com) for Quote, payment method alternative, or major bundle discount when purchasing more than one product (or you already bought one).