SELECT INTO variables
Being able to SELECT INTO variables (and/or list of variables) would make life much easier.
Please and thanks.
Chris
-
Comment actionsOfficial comment
Hi Chris,
thanks for your request. I would like to better understand the context of your use case. Do you have an example you could share which illustrates the current situation?
Thanks
Niklas
-
Hi Niklas,
One example:
DECLARE string @OrigResAns;
DECLARE string @OrigSegmentStatus;
DECLARE string @NewResPartyID;
DECLARE string @OrigRSeg_ID;
DECLARE string @OrigResAnPID;
DECLARE string @OrigVersion;SELECT seg.ResAnS_ID,
seg.ResAnS_Status,
seg.ResPar_ID,
seg.RSeg_ID,
per.ResAnP_ID,
anl.ResAn_Version
INTO #OrigSeg
FROM ReP_Snowflake_App.Reserving_Analysis_Segment seg
JOIN ReP_Snowflake_App.Reserving_Analysis anl
ON anl.ResAn_ID = seg.ResAn_ID
JOIN ReP_Snowflake_App.Reserving_Analysis_Period per
ON per.ResAnP_ID = anl.ResAnP_ID
WHERE seg.ResAnS_ID = ResAnsId
LIMIT 1
WITHOUT RETURN;@OrigResAns = SELECT ResAnS_ID FROM #OrigSeg LIMIT 1;
@OrigSegmentStatus = SELECT ResAnS_Status FROM #OrigSeg LIMIT 1;
@NewResPartyID = SELECT ResPar_ID FROM #OrigSeg LIMIT 1;
@OrigRSeg_ID = SELECT RSeg_ID FROM #OrigSeg LIMIT 1;
@OrigResAnPID = SELECT ResAnP_ID FROM #OrigSeg LIMIT 1;
@OrigVersion = SELECT ResAn_Version FROM #OrigSeg LIMIT 1;It would be better to have
SELECT seg.ResAnS_ID,
seg.ResAnS_Status,
seg.ResPar_ID,
seg.RSeg_ID,
per.ResAnP_ID,
anl.ResAn_Version
INTO @OrigResAns, @OrigSegmentStatus, @NewResPartyID, @OrigRSeg_ID,
@OrigResAnPID, @OrigVersion
FROM ....Chris
Please sign in to leave a comment.
Comments
2 comments