CodeSmith Community
Your Code. Your Way. Faster!

Custom Stored Procedures are being erased.

Latest post 06-28-2007 10:13 AM by nachobornan. 6 replies.
  • 06-25-2007 7:08 AM

    Custom Stored Procedures are being erased.

    I have a problem with Nettiers version 2.0.1.471. It's easy to reproduce.
     1) Create a table with a column named "colX"
     2) Create a Custom Stored Procedure that specify the name of the "colX" in the order by clause (for example)
     3) Generate and everything will be OK
     4) Drop the column of the table
     5) Regenerate again
    The problem is that the stored procedure is dropped by the generation process. It disappears. Although the stored is wrong and must be corrected, we run the risk to lose very important code in this stored procedures.
    Nettiers in previous versions didn't modify the code of the custom stored.
    I hope that this post serves to fix this bug.

     

    • Post Points: 45
  • 06-28-2007 7:36 AM In reply to

    • ManuX
    • Not Ranked
    • Joined on 06-28-2007
    • Posts 2
    • Points 100

    Re: Custom Stored Procedures are being erased.

    I have exactly the same problem. Two times my custom stored procedures had been deleted on same conditions (Nettiers version 2.0.1.471)

    • Post Points: 35
  • 06-28-2007 8:37 AM In reply to

    Re: Custom Stored Procedures are being erased.

    Are either of you by chance using the same prefix for your custom stored procedures as the nettiers generated procedures?

    -Ryan

    • Post Points: 35
  • 06-28-2007 9:13 AM In reply to

    • ManuX
    • Not Ranked
    • Joined on 06-28-2007
    • Posts 2
    • Points 100

    Re: Custom Stored Procedures are being erased.

    I initially used "_{0}_" as custom store's format string, tried later with "sp_{0}_" and problems repeats.

    I create a "Clients" table with "IdClient", "Name" and "BirthDate" columns. Then i make a custom store named "sp_Clients_Show":

     

    SELECT *

    FROM Clients

    ORDER BY BirthDate

     

    Generate templates (NetTiers 2.0.1.471) and it compiles ok. Then i remove "BirthDate" column from "Clients" table and try to regenerate again.

    This is the awaited error message that appears on Codesmith generation report.

     

    • StoredProcedures.sql
    Error while execution Sql file. System.Data.SqlClient.SqlException: Invalid column name 'BirthDate'.
       en System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       en System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       en System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       en System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       en System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
       en System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
       en System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       en MoM.Templates.CommonSqlCode.ExecuteSqlInFile(String pathToScriptFile, String connectionString)
       en _CodeSmith.NetTiers_cst.Go()
    But then also my custom stored procedure "sp_Clients_Show" has been deleted from database (using SQL 2005). I have tried this several times on different situations and problem persists.
    • Post Points: 65
  • 06-28-2007 9:46 AM In reply to

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 925
    • Points 34,785

    Re: Custom Stored Procedures are being erased.

     With regards to removing a column see if this thread helps... http://community.codesmithtools.com/forums/p/5091/20376.aspx#20376

    hth

    swin 

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 35
  • 06-28-2007 10:09 AM In reply to

    • bgjohnso
    • Top 10 Contributor
    • Joined on 09-15-2005
    • Spokane, WA
    • Posts 765
    • Points 22,535

    Re: Custom Stored Procedures are being erased.

    This is a known issue and was resolved in SVN version 491.  Please get the latest branch from SVN or download one of the nightly builds after 2/19/07.

    http://community.codesmithtools.com/forums/p/5414/21477.aspx#22409

    Ben Johnson
    ------------------------------
     Member of the .NetTiers team
     Visit http://www.nettiers.com
    ------------------------------

    • Post Points: 5
  • 06-28-2007 10:13 AM In reply to

    Re: Custom Stored Procedures are being erased.

    This problem is not related with dropping a column.

    swin:

     With regards to removing a column see if this thread helps... http://community.codesmithtools.com/forums/p/5091/20376.aspx#20376

    hth

     

    The problem is when you drop a column that is being used by a custom stored procedure and the stored became non-compilable. If you re-generate with the stored procedure in this state, this stored is dropped after re-generation ends

    • Post Points: 5
Page 1 of 1 (7 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems