Problem generating create function statement in sql 2008 r2

Answered Problem generating create function statement in sql 2008 r2

  • Monday, February 04, 2013 10:43 PM
     
     

     A CLR function containing default parameter value in qoutes was added.  Now, when I try to generate a create function statement, the qoutes are stripped from the default parameter value. 

    For instance

    I run this statement to add the function .... CREATE FUNCTION [dbo].[func](@list [nvarchar](max), @delim [nchar](1) = ',')

    when generating create function sql, I get CREATE FUNCTION [dbo].[func](@list [nvarchar](max), @delim [nchar](1) = ,)

    Is this a bug?  If so, is there a fix to this?

All Replies

  • Monday, February 04, 2013 11:14 PM
     
     

    It appears to work correctly in SSMS 2012. I don't have any SSMS 2008 R2 runinng to test on.

    If you do Help About in Management Studio, what version number do you see? If you see 10.50.1600, you have the RTM version, and you could try applying Service Pack2 to see if it helps.

    Then again, this should not have too much importance, I think. At least not if you have your code under version control...


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

  • Tuesday, February 05, 2013 6:10 PM
     
     

    It appears to work correctly in SSMS 2012. I don't have any SSMS 2008 R2 runinng to test on.

    If you do Help About in Management Studio, what version number do you see? If you see 10.50.1600, you have the RTM version, and you could try applying Service Pack2 to see if it helps.

    Then again, this should not have too much importance, I think. At least not if you have your code under version control...


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    I just confirmed it works on 2012.  I tried it on win2k8 r2 sp1 and sp2 and neither worked.  Does this mean this is a bug?

    btw... what dmv is clr table-valued function stored in. 

  • Tuesday, February 05, 2013 6:11 PM
    Moderator
     
     
    Most likely it's a bug. Try searching on Connect first if it was reported and if not and you have a reproducible scenario, try reporting it on Connect.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

  • Tuesday, February 05, 2013 11:05 PM
     
     Answered

    Yes, this is a bug; it can't be the intended behaviour.

    Information about CLR functions are in sys.objects, sys.parameters and also sys.columns, if this is a table-valued functions.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    • Marked As Answer by rgelfand Wednesday, February 06, 2013 9:53 PM
    •