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

Need help Expand / Collapse
Author
Message
Posted Monday, April 8, 2013 3:03 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, May 5, 2013 11:56 PM
Points: 12, Visits: 29
Hello,
I need syntax to get the all the values of one employee from the employee table, in a single column of the another table .....
Post #1439713
Posted Monday, April 8, 2013 3:13 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 7:23 AM
Points: 5,074, Visits: 11,852
This is not easy without knowing more about your data and table structures.

Please follow the link in my signature to see how to post easily consumable DDL and sample data.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1439714
Posted Tuesday, April 9, 2013 7:56 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:32 PM
Points: 13,455, Visits: 12,318
andrewalex.r (4/8/2013)
Hello,
I need syntax to get the all the values of one employee from the employee table, in a single column of the another table .....


Why in the world do you want to smash all your data together into a single column in a different table? There is generally no good reason for something like that.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1440336
Posted Tuesday, April 9, 2013 3:00 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 8:43 AM
Points: 820, Visits: 1,175
Phil & Sean both are right but you can use something like this..

Insert into Table2 (col3)
Select col1 + ' ' + col2 from table1

Post #1440575
Posted Tuesday, April 9, 2013 3:04 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:32 PM
Points: 13,455, Visits: 12,318
dwivedi.neeraj (4/9/2013)
Phil & Sean both are right but you can use something like this..

Insert into Table2 (col3)
Select col1 + ' ' + col2 from table1



dwivedi.neeraj's approach will work pretty much. Keep in mind that you probably need to wrap each column with an ISNULL or the entire results will be NULL.

Insert into Table2 (col3)
Select isnull(col1, '') + ' ' + isnull(col2, '') from table1



_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1440577
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse