Entityframework and MSSQL 2008 - Set sql language RRS feed

  • Question

  • Hi

    I was having a problem executing a stored procedure with EF and found out it was something with the datetime conversion. To execute properly i would need to form my sql like this:

        SqlQuery("SET LANGUAGE GERMAN; EXEC MyStoredProcedure {0}, {1}", arg1, arg2)

    Without the set langauge, the execution would fail. Is there any possibility to set this somewhere, so that i could ommit it? My MSSQL2008 has it's default langauge set to german already.

    Friday, August 31, 2012 8:24 AM


  • Hi,

    A better option could be to use date arg1 and arg2 arguments. I suspect that you pass those values as strings so they are written as a string using the German convention for dates and you need to have the same settings server side so that it is parsed correctly.

    If you pass your data under their native format (ie as date, boolean, decimal etc...) this is done for you and you doesn't depend on server settings....

    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

    • Proposed as answer by Alexander Sun Monday, September 3, 2012 3:21 AM
    • Marked as answer by Alexander Sun Monday, September 10, 2012 7:22 AM
    Friday, August 31, 2012 11:00 AM