|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to concatenate two text columnsHi all,
I have a two text columns in my table with more than 100,000 rows. I want to create a third text column with the data from text column 1 + text column 2. Is there an easy way to concatenate two text fields? Thanks Raju maybe you can export the 2 columns into excel
eg. first column is in cell A1, second column is in cell B1 at C1 you type this formula =A1&B1, then copy this formula till the end of the row, then you import it back to your table. Susanna Show quote "Raju" wrote: > Hi all, > > > > I have a two text columns in my table with more than 100,000 rows. > > I want to create a third text column with the data from text column 1 + text > column 2. > > > > Is there an easy way to concatenate two text fields? > > > > Thanks > > Raju > > > If you created a third column in your table you use an UPDATE statement
to do this like: UPDATE Sometable SET col3 = ISNULL(col1,'') + ISNULL(col2,'') or in a view you could use the almost same syntax like: SELECT ISNULL(col1,'') + ISNULL(col2,'') as col3 THE ISNULL(col1,'') syntax is related to the issue that in some cases the attributes could be NULL rather than just an empty or regular string and this would lead to a NULL result concatenating the two values together. HTH, Jens Suessmeyer. |
|||||||||||||||||||||||