Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't think this is possible in pure T-SQL without using cursors. But with cursors, stuff will usually be very slow. Cursors are processing the table row-by/row, and some people call this "slow-by-slow".</p> <p>But you can create your own aggregate function (see <a href="http://technet.microsoft.com/en-us/library/ms182741.aspx" rel="nofollow">Technet</a> for more details). You have to implement the function using the .NET CLR (e.g. C# or <a href="http://rdotnet.codeplex.com/" rel="nofollow">R.NET</a>).</p> <p>For a nice example see <a href="https://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/" rel="nofollow">here</a>.</p> <p>I think interfacing R with SQL is a very nice solution. Oracle is offering this combo as a <a href="http://www.oracle.com/technetwork/database/options/advanced-analytics/r-enterprise/index.html" rel="nofollow">commercial product</a>, so why not going the same way with SQL Server.</p> <p>When integrating R in the code using the own aggregate functions, you will only pay a small performance penalty. Own aggregate functions are quite fast according to the Microsoft documentation: <a href="http://technet.microsoft.com/en-us/library/ms131075.aspx" rel="nofollow">"Managed code generally performs slightly slower than built-in SQL Server aggregate functions"</a>. And the <a href="http://rdotnet.codeplex.com/" rel="nofollow">R.NET solution</a> seems also to be quite fast by <a href="http://rdotnet.codeplex.com/documentation" rel="nofollow">loading the native R DLL directly in the running process</a>. So it should be much faster than using R over ODBC.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload