Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Creating a Table by combining two exisisting ones
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Noe
Starting Member

USA
3 Posts

Posted - 10/23/2012 :  11:53:23  Show Profile  Reply with Quote
Hi,

I need to create a new table.

The "New Table" is the combination of the "employee" and "Personnel" tables where the Personnel Table.

When combining the tables, I need to keep the information from the "Personnel" Table and add the missing fields or records not found on the "Personnel" table.

A big issue is that the "Employee" Table has the name of the employee in one field while the "Personnel" table has it broken down into 3 fields.

Could you please help me?

Thank you, Noe

Please see below the two tables, their fields and the Table I need to get from their combination:

Employee.................Personnel...............New Table

EmployeeNumber......EmployeeNumber.....EmployeeNumber
EmployeeName.........LastName...............LastName
Title........................FirstName..............FirstName
BuildingCode............MiddleInitial...........MiddleInitial
District....................Job Title................Job Title
..............................Location Code.........Location Code
..............................District..................District

jimf
Flowing Fount of Yak Knowledge

USA
2875 Posts

Posted - 10/23/2012 :  12:07:04  Show Profile  Reply with Quote
I don't see any difference between the Personnel table and the new table.

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

Noe
Starting Member

USA
3 Posts

Posted - 10/23/2012 :  13:15:06  Show Profile  Reply with Quote
Jim, The fields look similar but the tables do not contain the same records. I left out the fields I do not need.

The name of the employee in one table is contained in one field while on the other table the name of theemployee is broken down into 3 fields(name, middle initial, and last name).

I am trying add the records not found in the "Personnel" table together with those ones in the personnel table into a new table.

One issue is how to break the employee name into three fields.

Originally posted by jimf

I don't see any difference between the Personnel table and the new table.

Jim

Edited by - Noe on 10/23/2012 13:20:04
Go to Top of Page

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1834 Posts

Posted - 10/23/2012 :  14:11:36  Show Profile  Reply with Quote
Breaking names apart is a notoriously difficult thing to do. As examples:
"David Henry Thoreau" simple enough; First Middle and Last
"Ludwig von Beethoven" not so simple; First and Last
"John Smith Senior" Actually a last name or a designator?

=================================================
We are far more concerned about the desecration of the flag than we are about the desecration of our land. -Wendell Berry

Edited by - Bustaz Kool on 10/23/2012 14:12:20
Go to Top of Page

Noe
Starting Member

USA
3 Posts

Posted - 10/23/2012 :  15:37:18  Show Profile  Reply with Quote
Bustaz, I do not mean any disrespect: I need help or guidance and you are not doing either one with your comment.
quote:
Originally posted by Bustaz Kool

Breaking names apart is a notoriously difficult thing to do. As examples:
"David Henry Thoreau" simple enough; First Middle and Last
"Ludwig von Beethoven" not so simple; First and Last
"John Smith Senior" Actually a last name or a designator?

=================================================
We are far more concerned about the desecration of the flag than we are about the desecration of our land. -Wendell Berry

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 10/23/2012 :  18:27:04  Show Profile  Reply with Quote
quote:
Originally posted by Noe

Bustaz, I do not mean any disrespect: I need help or guidance and you are not doing either one with your comment.
quote:
Originally posted by Bustaz Kool

Breaking names apart is a notoriously difficult thing to do. As examples:
"David Henry Thoreau" simple enough; First Middle and Last
"Ludwig von Beethoven" not so simple; First and Last
"John Smith Senior" Actually a last name or a designator?

=================================================
We are far more concerned about the desecration of the flag than we are about the desecration of our land. -Wendell Berry




Nope he was telling various business cases you need to consider. There's no straight forward way to break the names unless you can guarantee the format (which 90 % of cases you cant)

Otherways you've group them based on their format and apply a different logic for each group

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000