Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Is it possible to rename output data?


Is it possible to rename output data?

Author
Message
andrey_kondor
andrey_kondor
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 3
Hello,

I'm retrieving data using where statement, and do get data from table as expected. My question is, is it possible to rename that data?

My table has list of IP addresses, and I want to either add name or completely rename what is displayed.

Is it possible to do this using SQL queries?

Thanks!
pietlinden
pietlinden
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2178 Visits: 12518
Could you give an example of what you mean by "rename output data"? Do you mean aliasing column names so they display as something other than their original names in the table?

SELECT FName AS FirstName
FROM MyTable;



or did you mean to modify/overwrite column data?
andrey_kondor
andrey_kondor
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 3
Thanks for the reply.

I'm queuing specific data from column called Node Alias, for example:

NodeAlias = '101.101.101.101' or NodeAlias = '102.102.102.102' etc.

So, my reporting works, but I want to rename what is viewed in report (if 101.101.101.101, then name is "UniqueName" or add to the name "101.101.101.101 - Unique Name).

Hope it makes sense.
pietlinden
pietlinden
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2178 Visits: 12518
I'm queuing specific data from column called Node Alias, for example:

NodeAlias = '101.101.101.101' or NodeAlias = '102.102.102.102' etc.

So, my reporting works, but I want to rename what is viewed in report (if 101.101.101.101, then name is "UniqueName" or add to the name "101.101.101.101 - Unique Name).

Rename what? a column? Or is this a new textbox that you want in your report? You can set the visibility of the textbox based on an expression, if you want.
Doug J.
Doug J.
SSC-Enthusiastic
SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)

Group: General Forum Members
Points: 129 Visits: 938
Do you mean something like this:

SELECT CASE NodeAlias WHEN '101.101.101.101' THEN 'UniqueName' ELSE 'Larry' END
FROM MyTable



or

SELECT NodeAlias + ' - ' + CASE NodeAlias WHEN '101.101.101.101' THEN 'UniqueName' ELSE 'Larry' END
FROM MyTable



-Doug



http://xkcd.com/327/
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search