I do not know if this is even possible. I have a stored procedure, and a user defined function that I created. I would like to call the function from within the procedure in a select statement using the output from the function to create a row in the results. Here is the stored procedure.Select PartNum, Min, Max, Available, SalesSample, PendingSale, Notes From dbo.DomeStock
That works just fine. What I would like it to be is something like this.Select PartNum, Min, Max, Available, SalesSample, PendingSale, Notes, execute 'sort' =GetTripForce PartNum From dbo.DomeStock
I am trying to get the results from the function GetTripForce to show up in a column named 'sort'.I have debugged the function and it reliably returns the number I am looking for from the data. I just dont know how to apply the results of the function to the data that is returned. The end result I am looking for is to use the data returned from the function as a sorting mechanism. Currently I am ordering by the PartNum which is alphanumeric. The order in which it sorts is not what the end user wants. Here is some sample data the way it sorts at the moment.PartNumF06085F06085NF08240F10340NFD06085FD06085NThe desired results with the same data would bePartNumF06085F06085NFD06085FD06085NF08240F10340NThe sort should be first on the preceding letters (there can be up to four), the second sort should be on the first two numbers, and the third sort on the remaining three or four numbers.If there is a better way to sort the results I am all ears!I am new to writing SQL statements, and I am open to all suggestions.Thanks