I have made an SQL function that calculates different data and it looks something like this:
Declare @parameter1 float, @parameter2 float, @parameter3 float, @parameter4 float
SET @parameter1 = 3
SET @parameter1 = 5
SET @parameter1 = 7
SET @parameter1 = 9
dbo.SqlFuntion(@parameter1, @parameter2, @parameter3, @parameter4)
Now this works just fine, my challenge is that I want my parameters to be retrieved from a database table instead of declaring them manually.
So I want something like:
Select name, age, postal, weight from TableValues where ID = 1234
dbo.SqlFuntion(name, age, postal, weight)
Can anyone tell me how this can be done, without declaring anything?
anythingthis is going to be tough, if you insist on not declaring variables you need to put value selection logic into the function itself; though it may very well be you will need to declare variables there then - but that largely depends on what you do with those values exactly in your function