You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you so much for the variable sharing discussion in #1733.
I have been trying to figure out if I can select into a scalar in one cell and then use it in another. Maybe I need to rethink my approach, but I am trying to build a sort of "SQL Runbook" where one updates a cell that sets scalar values and then later scripts use those values to get to the data you're looking for later.
Imagine in something like SSMS land I would do this:
declare @searchparm varchar(24)
select @searchparm ='something%'select*from [someSchema].[someTable] where [someField] like @searchparm
I wanted to try to separate this out as part of a runbook/dcoumentation style notebook but could not figure out how to share the scalar variable among cells
but it was unclear to me if that value could be reused in a later SQL cell
This did not work:
#!sql-somedbselect*from [someSchema].[someTable] where [someField] like @resulttouselater
I also tried declaring and selecting into a scalar in one cell and then using in a later cell and that said i needed to declare the scalar. I dont know if the sql kernel is hanging onto this.
I'm trying to figure out what is supported from source, but still wrapping my head around what's going on in there. my guess is that these commands execute in entirely different sessions and it is the SQL kernel doing us a favor and getting stuff into a .NET object to be looked at later when you use --name ?
Thanks and I hope I've provided enough information.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Thank you so much for the variable sharing discussion in #1733.
I have been trying to figure out if I can select into a scalar in one cell and then use it in another. Maybe I need to rethink my approach, but I am trying to build a sort of "SQL Runbook" where one updates a cell that sets scalar values and then later scripts use those values to get to the data you're looking for later.
Imagine in something like SSMS land I would do this:
I wanted to try to separate this out as part of a runbook/dcoumentation style notebook but could not figure out how to share the scalar variable among cells
I tried something like
but it was unclear to me if that value could be reused in a later SQL cell
This did not work:
I also tried declaring and selecting into a scalar in one cell and then using in a later cell and that said i needed to declare the scalar. I dont know if the sql kernel is hanging onto this.
I'm trying to figure out what is supported from source, but still wrapping my head around what's going on in there. my guess is that these commands execute in entirely different sessions and it is the SQL kernel doing us a favor and getting stuff into a .NET object to be looked at later when you use --name ?
Thanks and I hope I've provided enough information.
Beta Was this translation helpful? Give feedback.
All reactions