December 4, 2017 at 9:04 pm
Comments posted to this topic are about the item Assigning Result Set Column Names
December 4, 2017 at 9:59 pm
Nice one, Harsha.
particularly enjoyed reading some of the incorrect answers...
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
December 4, 2017 at 10:59 pm
I'll fess up to answering it wrong. That's what I get for not paying attention. Thanks for the question!
December 5, 2017 at 1:26 am
Ken Wymore - Monday, December 4, 2017 10:59 PMI'll fess up to answering it wrong. That's what I get for not paying attention. Thanks for the question!
Me too. Should have read the question. Didn't see that it was about the column names, rather than the values.
December 5, 2017 at 2:21 am
Can't say I'm a fan of trick questions (ie I got it wrong due to answering on the basis of the data returned not the column name). 😉
But given the trick, the correct answer is "none of the above" as the first column name is "scripts" not "Scripts" :-p
December 5, 2017 at 8:30 am
Not a fan of trick questions.
December 5, 2017 at 8:37 am
Not sure why people think this was a trick question. The question is pretty clear. "What will be the column names of the result sets from this code in the SSMS grid?" You just needed to read the question. That being said it seemed a little overly complicated and it took me quite a while to figure out what the point of the question was. But in the end it was a decent question.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 5, 2017 at 9:30 am
I'm a newbie, so I learned a couple of things from this question. For example, I didn't realize that I could use SELECT the same way SET is used. (Although, if I change the lines that are supposed to be assigning a value to a variable to SET, I get an error, thus alerting me to the problem. So, I think I'll keep using set.)
The question prompted me to do further research, and I found this helpful page that let me know that using SELECT to assign values is not a part of ANSI standards, but it can be used to assign values to multiple variables at the same time :
https://www.mssqltips.com/sqlservertip/1888/when-to-use-set-vs-select-when-assigning-values-to-variables-in-sql-server/
Thanks for the question of the day, and for prompting me to look further into using SELECT in new ways!
December 5, 2017 at 9:44 am
Data_Cat - Tuesday, December 5, 2017 9:30 AMI'm a newbie, so I learned a couple of things from this question. For example, I didn't realize that I could use SELECT the same way SET is used. (Although, if I change the lines that are supposed to be assigning a value to a variable to SET, I get an error, thus alerting me to the problem. So, I think I'll keep using set.)The question prompted me to do further research, and I found this helpful page that let me know that using SELECT to assign values is not a part of ANSI standards, but it can be used to assign values to multiple variables at the same time :
https://www.mssqltips.com/sqlservertip/1888/when-to-use-set-vs-select-when-assigning-values-to-variables-in-sql-server/Thanks for the question of the day, and for prompting me to look further into using SELECT in new ways!
Set can only be used to set a single parameters value where Select can set multiple parameters at one time. Set will throw an error if you use a query and it returns multiple rows, but select will just assign the last value from the select statement. They are both very useful but behave a little differently.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 6, 2017 at 6:35 am
Not a trick question, but a good question! Thanks!
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply