?
Solved

Need to create new output column

Posted on 2014-03-26
3
Medium Priority
?
173 Views
Last Modified: 2014-03-26
I need to create a new output column in a query that will be used as a index.  I    can not use the existing field for security reasons (Col A)  So I must generate a new column (Col B)
Lets say that Col A is a Social Security Number and a call center person can not see it so we will create a new field Col B.  Later internally we will re associate the records.

Col A exists in the table Col B does not.  I can not modify the table

How can I create a query to do this.  A stored procedure will be ok as long as it produces a result set that I can see and export

Example

TableX

Col A           Col B
163777439     1
163777439     1
163777439     1
163777439     1
163777439     1
163777439     1
718108418     2
718108418     2
718108418     2
918233645     3
918233645     3
418323022     4
418323022     4
418323022     4
418323022     4
418434193     5
418434193     5
418434193     5
418434193     5
0
Comment
Question by:Charles Baldo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 39957778
So ... is the point of the 1, 2, 3, 4, 5 numbers in Column B just to have a 'placeholder' to Column A?

If so, and you want it in a query, meaning the 1, 2, 3, 4, 5 won't be stored in a table, you can just use a RANK statement, sorted by whatever floats your boat...

SELECT ColA, RANK() OVER (ORDER BY ColA) as ColB
FROM YourTable
0
 

Author Closing Comment

by:Charles Baldo
ID: 39957790
Thank You
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 39957794
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question