none
u-sql user function without return value

    Question

  • Hi,

     I want to abstract a independent logic into a function, which will take input do some logic and save result in table. Is there a way to do this in U-sql. Or i have to return resultset and then save it form main table. For me logic and saving is together and I don't want to call save from calling procedure.

    Thanks

    Monday, August 20, 2018 4:06 AM

All replies

  • If you want a function to execute on a particular value to transform it or generate a total independent value, you can use user defined functions. If you are not looking for this, please explain more to help you better
    Monday, August 20, 2018 6:53 PM
    Moderator
  • I don't want to create a C# function. I want a U-sql function which takes a input data set, apply some logic on input and then insert new resultset(after logic) in table and doesn't return any value to calling function. I want to have it in a function in terms of code re usability, since this functionality is needed from multiple Stored procedures and I don't want each stored procedure to have logic to get data from my function and then save it. Since logic and saving is a single common step, i want to have it in function. 

    looks like this is not possible in pure U-sql function. since U-Sql expects function to return value and functions can't Insert into table and Functions can't call stored procedure.

    Thanks


    • Edited by guru v Tuesday, August 21, 2018 12:27 PM
    Tuesday, August 21, 2018 12:41 AM