The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

sqlAccessType="DynamicSQL" Vs. "StoredProcedures"

Last post 04-17-2008, 5:48 AM by pritcham. 2 replies.
Sort Posts: Previous Next
  •  04-16-2008, 1:14 PM 8911

    sqlAccessType="DynamicSQL" Vs. "StoredProcedures"

    When using SQLServer with sqlAccessType="StoredProcedure" default values that are set in the database are not applied because NULL is being set to the parameter in the generated stored procedures and it is not excluded from the INSERT when null.

    Because excluding columns with "database default values" that are passed in NULL to the SP would make the SP to complicated.  Are you able to update the script that generates the SP to extract the database default value and supply it in the SP argument list.

    Code:
    ALTER PROCEDURE [dbo].[proc_LoanApplicationInsert]
    (
    	@AppUserGUID uniqueidentifier,
    	@LoanApplication_Id int = NULL output,
    	@Market_Id int,
    	@Community_Id int = 0         --- Defaulted to 0
                    @InsertDate = GETDATE()     --- Default to Current Date:  Put the default value here instead of NULL
    ...
    }
    Well just a thought.  I have a workaround now by just using DynamicSQL.  This is nice because it only passed columns that are dirty.
  •  04-17-2008, 4:53 AM 8924 in reply to 8911

    Re: sqlAccessType="DynamicSQL" Vs. "StoredProcedures"

    This has been ask for before. We might do this for SQL Server for starters but right now we have so many items in the hopper to get ES2008 released. We will put it in our TRAC system and see about working it into a maintenance release, I agree it would be very nice.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  04-17-2008, 5:48 AM 8927 in reply to 8911

    Re: sqlAccessType="DynamicSQL" Vs. "StoredProcedures"

    Hi

    Good idea - I'm fairly sure you don't need to figure out what the default value is though, you can just use "@Community_Id int = DEFAULT" for example (can't test as I'm not at my SQL box)

    Hope that helps

    Martin

View as RSS news feed in XML