dbTalk Databases Forums  

Renaming OutputColumns in DataReader Source

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Renaming OutputColumns in DataReader Source in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Roy Harvey (SQL Server MVP)
 
Posts: n/a

Default Re: Renaming OutputColumns in DataReader Source - 09-24-2008 , 06:41 AM






On Wed, 24 Sep 2008 11:02:28 +0200, "Mike Endys"
<MikeEndy (AT) nospam (DOT) nospam> wrote:

Quote:
I did it by AS keyword... SELECT GLMPUJ AS DocumentNumber FROM
tblSourceTable
That is one of three ways to assign an alias to an output column.

SELECT GLMPUJ AS DocumentNumber

SELECT GLMPUJ DocumentNumber

SELECT AS DocumentNumber = GLMPUJ

As you see in the second example AS is optional. Of the three that is
the one I do not use. That format also provides the annoying behavior
that a comma between two column in a SELECT list results in the former
column receiving the later column's name as an alias. That can be
very confusing.

I think that I have heard that the third format using = is not
standard SQL, but I am not certain. It can be the cleanest to read if
you format your SELECT neatly, as it is always right there up front
even when the expression is long and complicated.

Roy Harvey
Beacon Falls, CT


Reply With Quote
  #12  
Old   
Roy Harvey (SQL Server MVP)
 
Posts: n/a

Default Re: Renaming OutputColumns in DataReader Source - 09-24-2008 , 06:41 AM






On Wed, 24 Sep 2008 11:02:28 +0200, "Mike Endys"
<MikeEndy (AT) nospam (DOT) nospam> wrote:

Quote:
I did it by AS keyword... SELECT GLMPUJ AS DocumentNumber FROM
tblSourceTable
That is one of three ways to assign an alias to an output column.

SELECT GLMPUJ AS DocumentNumber

SELECT GLMPUJ DocumentNumber

SELECT AS DocumentNumber = GLMPUJ

As you see in the second example AS is optional. Of the three that is
the one I do not use. That format also provides the annoying behavior
that a comma between two column in a SELECT list results in the former
column receiving the later column's name as an alias. That can be
very confusing.

I think that I have heard that the third format using = is not
standard SQL, but I am not certain. It can be the cleanest to read if
you format your SELECT neatly, as it is always right there up front
even when the expression is long and complicated.

Roy Harvey
Beacon Falls, CT


Reply With Quote
  #13  
Old   
Roy Harvey (SQL Server MVP)
 
Posts: n/a

Default Re: Renaming OutputColumns in DataReader Source - 09-24-2008 , 06:41 AM



On Wed, 24 Sep 2008 11:02:28 +0200, "Mike Endys"
<MikeEndy (AT) nospam (DOT) nospam> wrote:

Quote:
I did it by AS keyword... SELECT GLMPUJ AS DocumentNumber FROM
tblSourceTable
That is one of three ways to assign an alias to an output column.

SELECT GLMPUJ AS DocumentNumber

SELECT GLMPUJ DocumentNumber

SELECT AS DocumentNumber = GLMPUJ

As you see in the second example AS is optional. Of the three that is
the one I do not use. That format also provides the annoying behavior
that a comma between two column in a SELECT list results in the former
column receiving the later column's name as an alias. That can be
very confusing.

I think that I have heard that the third format using = is not
standard SQL, but I am not certain. It can be the cleanest to read if
you format your SELECT neatly, as it is always right there up front
even when the expression is long and complicated.

Roy Harvey
Beacon Falls, CT


Reply With Quote
  #14  
Old   
Roy Harvey (SQL Server MVP)
 
Posts: n/a

Default Re: Renaming OutputColumns in DataReader Source - 09-24-2008 , 06:41 AM



On Wed, 24 Sep 2008 11:02:28 +0200, "Mike Endys"
<MikeEndy (AT) nospam (DOT) nospam> wrote:

Quote:
I did it by AS keyword... SELECT GLMPUJ AS DocumentNumber FROM
tblSourceTable
That is one of three ways to assign an alias to an output column.

SELECT GLMPUJ AS DocumentNumber

SELECT GLMPUJ DocumentNumber

SELECT AS DocumentNumber = GLMPUJ

As you see in the second example AS is optional. Of the three that is
the one I do not use. That format also provides the annoying behavior
that a comma between two column in a SELECT list results in the former
column receiving the later column's name as an alias. That can be
very confusing.

I think that I have heard that the third format using = is not
standard SQL, but I am not certain. It can be the cleanest to read if
you format your SELECT neatly, as it is always right there up front
even when the expression is long and complicated.

Roy Harvey
Beacon Falls, CT


Reply With Quote
  #15  
Old   
Roy Harvey (SQL Server MVP)
 
Posts: n/a

Default Re: Renaming OutputColumns in DataReader Source - 09-24-2008 , 06:41 AM



On Wed, 24 Sep 2008 11:02:28 +0200, "Mike Endys"
<MikeEndy (AT) nospam (DOT) nospam> wrote:

Quote:
I did it by AS keyword... SELECT GLMPUJ AS DocumentNumber FROM
tblSourceTable
That is one of three ways to assign an alias to an output column.

SELECT GLMPUJ AS DocumentNumber

SELECT GLMPUJ DocumentNumber

SELECT AS DocumentNumber = GLMPUJ

As you see in the second example AS is optional. Of the three that is
the one I do not use. That format also provides the annoying behavior
that a comma between two column in a SELECT list results in the former
column receiving the later column's name as an alias. That can be
very confusing.

I think that I have heard that the third format using = is not
standard SQL, but I am not certain. It can be the cleanest to read if
you format your SELECT neatly, as it is always right there up front
even when the expression is long and complicated.

Roy Harvey
Beacon Falls, CT


Reply With Quote
  #16  
Old   
Roy Harvey (SQL Server MVP)
 
Posts: n/a

Default Re: Renaming OutputColumns in DataReader Source - 09-24-2008 , 06:41 AM



On Wed, 24 Sep 2008 11:02:28 +0200, "Mike Endys"
<MikeEndy (AT) nospam (DOT) nospam> wrote:

Quote:
I did it by AS keyword... SELECT GLMPUJ AS DocumentNumber FROM
tblSourceTable
That is one of three ways to assign an alias to an output column.

SELECT GLMPUJ AS DocumentNumber

SELECT GLMPUJ DocumentNumber

SELECT AS DocumentNumber = GLMPUJ

As you see in the second example AS is optional. Of the three that is
the one I do not use. That format also provides the annoying behavior
that a comma between two column in a SELECT list results in the former
column receiving the later column's name as an alias. That can be
very confusing.

I think that I have heard that the third format using = is not
standard SQL, but I am not certain. It can be the cleanest to read if
you format your SELECT neatly, as it is always right there up front
even when the expression is long and complicated.

Roy Harvey
Beacon Falls, CT


Reply With Quote
  #17  
Old   
Roy Harvey (SQL Server MVP)
 
Posts: n/a

Default Re: Renaming OutputColumns in DataReader Source - 09-24-2008 , 06:41 AM



On Wed, 24 Sep 2008 11:02:28 +0200, "Mike Endys"
<MikeEndy (AT) nospam (DOT) nospam> wrote:

Quote:
I did it by AS keyword... SELECT GLMPUJ AS DocumentNumber FROM
tblSourceTable
That is one of three ways to assign an alias to an output column.

SELECT GLMPUJ AS DocumentNumber

SELECT GLMPUJ DocumentNumber

SELECT AS DocumentNumber = GLMPUJ

As you see in the second example AS is optional. Of the three that is
the one I do not use. That format also provides the annoying behavior
that a comma between two column in a SELECT list results in the former
column receiving the later column's name as an alias. That can be
very confusing.

I think that I have heard that the third format using = is not
standard SQL, but I am not certain. It can be the cleanest to read if
you format your SELECT neatly, as it is always right there up front
even when the expression is long and complicated.

Roy Harvey
Beacon Falls, CT


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.