Set Command in UDF

  • i want to use Set Datefirst 1 statement in UDF but when i create the UDF it gives error invalid use of Set Command how can i use set command in UDF


    Rohit

  • You cannot, of course.

    Even if you could change a setting like that in a UDF, you still wouldn't be able to use any functions that depend upon the setting, as they are, due to that very setting, nondeterministic. 



    --Jonathan

  • that means you can not use Set Commnads in UDF so any can make me available limitations od UDF cause i use them exetensively


    Rohit

  • R,

    Techically, you can the Update DML statement in a UDF, but it can't affect any tables outside the udf.

    If you wanted to do that you'd have to write like so:

     

    Update t 

    set column1=f.column1     

    from table1 t 

    JOIN function() f on t.ID = f.ID

     

    Signature is NULL

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply