Bug: table-valued function output columns are prompted in the parameter list
bstrautin
Posts: 8 Bronze 2
SQL Prompt suggests the output columns of table-valued functions as as parameter values to the function itself.
For example, with this code, place cursor after "dbo.foo(x" and hit Ctrl-Space. SQL Prompt will suggest "f.x", but it should not, because that will produce dbo.foo(f.x) x, which is invalid.
go<br>create function dbo.foo (@x int)<br>returns @foo table(x int)<br>as<br>begin<br> insert @foo(x) values (1)<br> return<br>end<br>go<br><br>select *<br>from dbo.foo(x) f
Tagged:
Answers
create function dbo.foo (@x int)
returns @foo table(x int)
as
begin
insert @foo(x) values (1)
return
end
go
select *
from dbo.foo(x) f
I think the issue with the code is two things - first that it's interpreting the variables with the @ symbol as users and linking to a user profile for them and second that your line endings may be something it's not expecting. I have removed the @ links and deleted and replaced each line ending (by pressing delete then enter for each) it works for me.
As for your issue, when I put the cursor after the x in this code and press Ctrl+Space it qualifies the x with [f] which it looks like it should. If I don't have the characters afterwards `) f` it suggests XLOCK and nothing else happens.
This is on 10.1.0 on SSMS 18.4.
Am I misunderstanding your issue?
Kind regards,
Alex
Have you visited our Help Center?
Righto I see what you are saying now.
Just to confirm, as I couldn't see it happen in other circumstances, this is only when the entire script is written out and you place the cursor in the specified position and ask for the suggestion right?
I didn't see it occur when normally formatting the entire script or in other circumstances, so just want to make sure of the specific case.
And, in that vein, what is the use-case here? What should it be doing (or just nothing at all)?
Kind regards,
Alex
Have you visited our Help Center?
Thanks for your patience with this issue.
The development team have let me know that, unfortunately, they are not going to address this bug at the moment.
When reviewing bugs the development team take into account the impact it has and the number of users affected and unfortunately we are unable to fix all bugs and have to prioritize fixing the ones that cause the greatest impact.
Thank you for for reporting it to us and your understanding!
Kind regards,
Alex
Have you visited our Help Center?
from Parts p
cross apply dbo.get_children([cursor here, wanting "p.partno", but typing "pa(tab)" gives me "gc.partno"]) gc
Thank you for that example - I have passed it on to see if it changed the verdict, but unfortunately it's still not currently going to be looked at.
Kind regards,
Alex
Have you visited our Help Center?