SQL and C# integration.

  • Apologies if it is a silly question, Oracle allows Java to be integrated. Is it possible to integrate C# code with MSSQL?

    Using STGeomFromText function, I would assume it is possible, as when it failed I had .Net related error messages.

    My questions are:

    1. How do you normally integrate C# within MSSQL?

    2. Can one advise good forum / website to search for examples, please?

    What I have:

    I have several docx files I utilise as modules to build one Word docx and populate my data from within MSSQL. At the moment I use Interop.Word and 3rd party solution

    which only capable to generate one invoice in 3 seconds.

    What I am required to deliver:

    To write a code which can be integrated within MSSQL, e.g. stored procedure, to speed up the process, as we need to generate above 2'000 invoices overnight.

    Thank you all in advance.

  • BOR15K (3/9/2015)


    Apologies if it is a silly question, Oracle allows Java to be integrated. Is it possible to integrate C# code with MSSQL?

    Using STGeomFromText function, I would assume it is possible, as when it failed I had .Net related error messages.

    My questions are:

    1. How do you normally integrate C# within MSSQL?

    2. Can one advise good forum / website to search for examples, please?

    What I have:

    I have several docx files I utilise as modules to build one Word docx and populate my data from within MSSQL. At the moment I use Interop.Word and 3rd party solution

    which only capable to generate one invoice in 3 seconds.

    What I am required to deliver:

    To write a code which can be integrated within MSSQL, e.g. stored procedure, to speed up the process, as we need to generate above 2'000 invoices overnight.

    Thank you all in advance.

    Your question is not very clear what you are trying to do but you can use CLR to generate a stored procedure that runs a .NET assembly. I think that is what you are asking about. https://msdn.microsoft.com/en-us/library/ms254963%28v=vs.110%29.aspx

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Thank you for pointing me to CLR - I will look for some examples as well.

    What I need to achieve is to generate Word docx based on MSSQL data, where I do not have one docx template, but multiple docx modules, e.g.

    m_1.docx for invoice header, m_2.docx for invoice comments, m_3.docx for Balance Due and so on.

    Thank you again.

  • Another option here is to use SSIS, where you have instant access to C# via script tasks.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • I agree with Phil. Honestly it somewhat seems like sql is the wrong place for what you are trying to do. This sounds like the kind of thing that belongs in the front end application instead of in sql. Build the word doc in your .net application and use your sql data as a portion of the text.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply