Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 2nd, 2004, 06:26 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Codes to Add Descriptions to Data

Hi All,

It is me again. :-) Here is what I want to do, but not sure if it is possible. Need your professional advices.

I have a database table(Health_Table) that I extracted from a mainframe. In this table, the ONLY data I have is:

Health_ID Deduction_Amount
02BEE 10.00
03BEA 20.00

The problem with this is I know what each Health_ID stands for by heart. However, if I give this report to someone else, they will not be able to figure it out. Therefore, my question is, can I create an additional field(such as Health_ID_Description) in this table, AND then write some codes(or stored procedures) in SQL to add in the descriptions? If it is possible, do you have any idea how?

If it is NOT possible, is the only solution is to create MY OWN table with the descriptions and link Health_table and my table together?

Thank you for your help!!! :-)

Leon
 
Old June 2nd, 2004, 06:47 PM
Authorized User
 
Join Date: Jun 2003
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If there are only a handful - use a CASE statement inside your SQL - however; if there are more then create a table with the id as the key and a description field. You may need to add dates and/or a different primary key depending on if they ID's map to different names or get deleted.

_________________________
Joe Horton
Database Developer / Software Engineer
WISHA/Legal Services Software Development
Department of Labor and Industries
Voice (360) 902-5928 fax (360) 902-6200
 
Old June 3rd, 2004, 04:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Leon (It is me again;)),

That is possible. But it depends on the volume of data in the table.

If I am right, as you say
Quote:
quote:the ONLY data I have is
You can open the table in EM and manually add a field Health_Desc and add data to these two records. And there on if any new record is to be added you can put the description for that too from the client app or using stored procs.

If the volume of data is huge and ant alteration to this table would affect the live apps or something to that effect, you can always go for the second option that you suggested. Create another table and heelp the same HEALTH_ID as reference there, and add health description to that correspondingly and then you got to make changes in all places where you generate reports using Health_Table, to use the HEALTH_DESC table too.

You can decide which one is comfortable and does not affect the existing setup much.

But I would always suggest you to go for the first solution, considering the Integrity and maintenance factors in the future.

Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 3rd, 2004, 10:29 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Joe and ViJay for your advise! I think the solution i'll have to use is to create a new table with a Health_ID and Health_Description colunm. The reason is, I have only 10 different Health_ID. But when I run a query against the mainframe, I get thousands of employees data, each with a Health_ID associated with them.

Thanks again!

Leon



 
Old June 3rd, 2004, 10:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote: The reason is, I have only 10 different Health_ID. But when I run a query against the mainframe, I get thousands of employees data, each with a Health_ID associated with them.
I dont understand, why you want to have a new table having this as a reason.

That doesn't matter, whatever the number of employees records be associated with Health_ID, but still you can alter the table to add one more field as description and populate data for those 10 records. As I see no other changes needed after this.

In case you create another table, then you got to make join with this new table just for the sake of getting the description. If such things were already done, then you got to recode them.

Anyways the call is yours.;)
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 3rd, 2004, 12:33 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Vijay,

that was what I meant, alter the Health_table to add one more column for the description (since I only have 10 records or Helath_ID). Then when I get the employee records(which is about 13,000 records), I can link them with the Health_table to get the description. In this case, the Health_Table serves as a 'key' table. Make sense?

Thanks again!

Leon

 
Old June 4th, 2004, 04:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes. Makes sense.

Quote:
quote:I think the solution i'll have to use is to create a new table with a Health_ID and Health_Description colunm. The reason is, I have only 10 different Health_ID. But when I run a query against the mainframe, I get thousands of employees data, each with a Health_ID associated with them.
Seeing this I thought you were going for a new table just for the sake of having Description. Thats why the confusion.

Cheers!

_________________________
-Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to download sample codes Beginning ASP Data ckm2003 Wrox Book Feedback 1 November 2nd, 2007 07:56 AM
Template descriptions SoC Dreamweaver (all versions) 1 December 6th, 2004 04:47 PM
Adding descriptions to values in functions katsarosj VB.NET 5 August 17th, 2004 03:47 PM
Import Field Descriptions Mitch SQL Server 2000 0 September 15th, 2003 02:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.