October 15, 2021 at 12:00 am
Comments posted to this topic are about the item Concatenating Dynamic SQL
October 15, 2021 at 6:13 am
The answer should be: I get the two statements concatenated together, not the strings are concatenated, because there is no execution!
Have a nice day,Christoph
October 15, 2021 at 6:33 am
What Christoph said ^^
None of the answers provided apply... has anyone even proof-read them??
October 15, 2021 at 7:46 am
Yeah, I think I'll sit this one out for a bit...
October 15, 2021 at 9:19 am
Yes, I had to try it out to prove to myself that "SELECT @sql" wasn't some underhand feature I didn't know about but of course I got the 2 query strings concatenated. ..
ALSO bugged no-one checked this before posting
At the end of most articles is a small blurb called a person's signature which exists to provide information about how to get in touch with the person posting, including their email address, phone number, address, or where they're located. Signatures have become the graffiti of computers. People put song lyrics, pictures, philosophical quotes, even advertisements in them. (Note, however, that advertising in your signature will more often than provoke negative responses until you take it out.)
October 15, 2021 at 12:32 pm
NOTA. None of the above
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
October 15, 2021 at 1:29 pm
Email had "Select @SQL" on the site it said "EXEC (@SQL). In first case you get 2 statements concatenated into one, in second case you get 2 separate recordsets. None of the options is a good answer.
October 15, 2021 at 2:43 pm
None of the answers are correct.
October 15, 2021 at 2:48 pm
Question as is: I execute this code on SQL Server 2019. Each of the tables has one row in it. What happens?
DECLARE @SQL NVARCHAR(4000);
SET @SQL = 'SELECT mystring FROM TableA;';
SET @SQL += 'SELECT mystring FROM TableB;';
EXEC(@SQL)
Based on the current text of the question above there should be an answer available that says something like, "Two results sets are returned, one with the mystring value(s) from TableA and another with the mystring value(s) from TableB." The only answer close is "I get the strings from TableA and TableB concatenated together" but while this is close it's still incorrect since the result sets aren't concatenated; they'd be returned as two separate result sets not one concatenated together.
-
October 15, 2021 at 6:52 pm
Glad to see that I'm not alone in my confusion here! None of the answers fit the actual situation. As I expected, I got a result set from each table.
LinkedIn: https://www.linkedin.com/in/sqlrv
Website: https://www.sqlrv.com
October 15, 2021 at 7:23 pm
It is unfortunate that the problem text in the email for which the final answer is correct and the text of the problem on the answer page, and for which no answer is correct, do not match. Poor editing as mentioned. Maybe someone will correct the answer page.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply