Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Is it possible to rename output data? Expand / Collapse
Author
Message
Posted Friday, December 13, 2013 9:48 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, December 14, 2013 6:05 AM
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!
Post #1522928
Posted Friday, December 13, 2013 9:57 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Yesterday @ 6:57 PM
Points: 578, Visits: 3,776
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?
Post #1522929
Posted Friday, December 13, 2013 10:18 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, December 14, 2013 6:05 AM
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.
Post #1522930
Posted Friday, December 13, 2013 11:47 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Yesterday @ 6:57 PM
Points: 578, Visits: 3,776
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.
Post #1522931
Posted Friday, January 03, 2014 3:18 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Yesterday @ 3:35 PM
Points: 83, Visits: 466
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/
Post #1527741
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse