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

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 concatenating three column values into a single co

Author  Topic 

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-08-25 : 08:08:29
iam having a table where i need to update three column values into one column value.

how can i do this

UPDATE EMRUNCODEDMEDICATIONSLKUP SET UNCODED_MEDICATION =

(SELECT (isnull(MEDICATION,'') || ' ' || isnull(STRENGTH,'') || ' ' || isnull(DOSAGE,''))

FROM EMRUNCODEDMEDICATIONSLKUP)

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-08-25 : 08:17:56
SELECT (isnull(MEDICATION,'')+ ' ' + isnull(STRENGTH,'') + ' ' + isnull(DOSAGE,''))
FROM EMRUNCODEDMEDICATIONSLKUP
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-08-25 : 08:18:11
Use + instead of ||

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-08-25 : 08:18:40
NO THIS I HAVE TO UPDATE INTO A NEWLY ADDED COLUMN
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-08-25 : 08:18:46


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-08-25 : 08:20:45
quote:
Originally posted by rajasekhar857

NO THIS I HAVE TO UPDATE INTO A NEWLY ADDED COLUMN


Too difficult

UPDATE EMRUNCODEDMEDICATIONSLKUP
SET NEW_COL=(isnull(MEDICATION,'')+ ' ' + isnull(STRENGTH,'') + ' ' + isnull(DOSAGE,''))


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-08-25 : 08:24:46
working fine thanks iam little bit overthinking rather than going in a smooth way
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-08-25 : 08:27:52
quote:
Originally posted by rajasekhar857

working fine thanks iam little bit overthinking rather than going in a smooth way


Also you are confusing with SQL Server and Oracle queries

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -