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)
 Merging Field Values

Author  Topic 

Frankp2112
Starting Member

4 Posts

Posted - 2009-01-22 : 15:31:06
Hi,
I have a simple select statement with two values that me exclusie. So on the output I would like do sometyhing like this:

select value1, value2 - where value1 is null and value2 is not null then insert value2 in the column for value1
from table1

I hope this makes sense -
Can anyone point me in the right direction to solve this problem.

Thanks

Frank

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-01-22 : 15:36:25
[code]select
isnull(value1,value2),
value2
from
yourtable[/code]
Go to Top of Page

Skorch
Constraint Violating Yak Guru

300 Posts

Posted - 2009-01-22 : 16:34:02
If you're looking to update your table:

UPDATE YourTable
SET value1 = value2
WHERE value1 IS NULL
AND value2 IS NOT NULL
Go to Top of Page
   

- Advertisement -