August 27, 2017 at 12:23 am
Comments posted to this topic are about the item Column name assignment
August 27, 2017 at 12:24 am
Simple one to start the week, thank you.
...
August 28, 2017 at 2:55 am
Funny question π
August 28, 2017 at 5:27 am
That was a very simple one to start the week. Thanks.
August 28, 2017 at 6:07 am
Nice, simple question to start the week on, thanks Avinash
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
βlibera tute vulgaris exβ
August 28, 2017 at 7:02 am
Nice back to basics question. I am shocked that at this time 21% of the people responding missed this.
_______________________________________________________________
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/
August 28, 2017 at 7:15 am
I don't know that it is a basic question (though I got it right). I'm sorry to hear that it's deprecated. I came across this method of aliasing a few months ago and for some things at least prefer it over the AS 'alias name' method.
August 28, 2017 at 7:27 am
RonKyle - Monday, August 28, 2017 7:15 AMI don't know that it is a basic question (though I got it right). I'm sorry to hear that it's deprecated. I came across this method of aliasing a few months ago and for some things at least prefer it over the AS 'alias name' method.
I didn't even notice in the posted answer that it stated this is deprecated. That is interesting....it is not in the link provided. I have never heard this is deprecated. Anybody else?
_______________________________________________________________
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/
August 28, 2017 at 7:42 am
Sean Lange - Monday, August 28, 2017 7:27 AMRonKyle - Monday, August 28, 2017 7:15 AMI don't know that it is a basic question (though I got it right). I'm sorry to hear that it's deprecated. I came across this method of aliasing a few months ago and for some things at least prefer it over the AS 'alias name' method.I didn't even notice in the posted answer that it stated this is deprecated. That is interesting....it is not in the link provided. I have never heard this is deprecated. Anybody else?
I didn't know, but just found it.
https://docs.microsoft.com/en-us/sql/database-engine/deprecated-database-engine-features-in-sql-server-2016
A string enclosed in quotation marks used as a column alias for an expression in a SELECT list:
'string_alias' = expression
Alternatives:
expression [AS] column_alias
expression [AS] [column_alias]
expression [AS] "column_alias"
expression [AS] 'column_alias'
column_alias = expression
August 28, 2017 at 7:47 am
column_alias = expression
I thought this was what the question was asking about. It's a very fine point between a string alias and this. But this is what I use, so I guess I'm clear to continue it after all.
August 28, 2017 at 8:39 am
Sean Lange - Monday, August 28, 2017 7:02 AMNice back to basics question. I am shocked that at this time 21% of the people responding missed this.
I've never used that aliasing method and I don't research the questions before answering (I like to go with what I know at that moment), and I suspect theres some others that might have missed it for that reason also, not sure why you'd be shocked by that tho.
August 28, 2017 at 8:47 am
Luis Cazares - Monday, August 28, 2017 7:42 AMSean Lange - Monday, August 28, 2017 7:27 AMRonKyle - Monday, August 28, 2017 7:15 AMI don't know that it is a basic question (though I got it right). I'm sorry to hear that it's deprecated. I came across this method of aliasing a few months ago and for some things at least prefer it over the AS 'alias name' method.I didn't even notice in the posted answer that it stated this is deprecated. That is interesting....it is not in the link provided. I have never heard this is deprecated. Anybody else?
I didn't know, but just found it.
https://docs.microsoft.com/en-us/sql/database-engine/deprecated-database-engine-features-in-sql-server-2016A string enclosed in quotation marks used as a column alias for an expression in a SELECT list:
'string_alias' = expression
Alternatives:expression [AS] column_alias
expression [AS] [column_alias]
expression [AS] "column_alias"
expression [AS] 'column_alias'
column_alias = expression
LOL I didn't even think about the string as an alias as I always just ignore those silly things. I was afraid that alias = column was being deprecated and I was in for a long update process as that is my preferred method of aliasing. Thanks for finding that.
_______________________________________________________________
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/
August 28, 2017 at 8:56 am
I don't like that it's deprecated, as I like to see all the column names on the left, but I understand this can be confusing. I would prefer if they remove this they allow:
select
'FullName' for firstname + lastname,
CustomerID
from Customers
August 28, 2017 at 9:16 am
Steve Jones - SSC Editor - Monday, August 28, 2017 8:56 AMI don't like that it's deprecated, as I like to see all the column names on the left, but I understand this can be confusing. I would prefer if they remove this they allow:
select
'FullName' for firstname + lastname,
CustomerID
from Customers
To be fair Steve it is ONLY the single quotes portion that has been deprecated. It isn't needed and causes confusion IMHO.
This is still perfectly legal.
select
FullName = firstname + lastname
, CustomerID
from Customers
_______________________________________________________________
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/
August 28, 2017 at 9:40 am
Sean Lange - Monday, August 28, 2017 9:15 AMSteve Jones - SSC Editor - Monday, August 28, 2017 8:56 AMI don't like that it's deprecated, as I like to see all the column names on the left, but I understand this can be confusing. I would prefer if they remove this they allow:
select
'FullName' for firstname + lastname,
CustomerID
from CustomersTo be fair Steve it is ONLY the single quotes portion that has been deprecated. It isn't needed and causes confusion IMHO.
This is still perfectly legal.
select
FullName = firstname + lastname
, CustomerID
from Customers
I wish they would deprecate using single quotes in a column alias at all. I see that <expression> [AS] 'column_alias' has not been deprecated. I generally do not use delimiters in my column aliases unless required and I only ever use the square brackets [] as the delimiters.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
Viewing 15 posts - 1 through 15 (of 18 total)
You must be logged in to reply to this topic. Login to reply