none
how to auto execute T4 generated sql script against sql server

    Question

  • I create T4 template to generate sql Stored Procedure (both run-time and design-time). And I call the template in my Windows Form application (C#) to generate the Stored Procedure. What I really need is to call the T4 template in my application to generate the sql Stored Procedure script and run it to create or deploy the Stored Procedure into SQL Server. Is there any way to do that?

    I used to use CodeSmith, in CodeSmith there is CodeSmith.BaseTemplates.ScriptUtility.ExecuteScript() can do that.
    Is there samilar solution in T4 can do that?

    Thanks,
    Tao


    Tao

    Thursday, November 19, 2015 2:27 AM

All replies

  • Hi BigTao,

    Thank you for posting in MSDN forum.

    >> Is there samilar solution in T4 can do that?

    Please check the following link about how to use T4 to generate CRUD stored procedures:

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jiayi Li


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.

    Friday, November 20, 2015 6:51 AM
    Moderator
  • Hi Jiayi,

    Thank you for the response. I read the article but I didn't find the solution for my issue. I am still looking for solution.

    Tao


    Tao

    Friday, November 20, 2015 8:27 PM
  • Hi Tao,

    I will involve some experts to help you handle this issue.

    Thank you for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.

    Monday, November 23, 2015 7:56 AM
    Moderator