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.
Author |
Topic |
jayram
Starting Member
47 Posts |
Posted - 2013-02-22 : 15:54:01
|
HelloI have a table with 7 columns like Cumulative_cnt, AX1, AX2, AX3, AX4, AX5, POSi want to find the first AX column with a 'null' and assign that column number to POS as a valuefor e.g. if AX3 has the first null value then POS is assigned a value 3. table is as followsAX1-AX5 are varcharall columns after the first column with a Null is Nullall columns preceding the first column with Null has a valueat least one column has a value and is not null usually AX1 |
|
notmyrealname
98 Posts |
Posted - 2013-02-22 : 16:05:24
|
You could use a computed column for POS.Formula:(case when [AX1] IS NULL then (1) when [AX2] IS NULL then (2) when [AX3] IS NULL then (3) etc... end) |
|
|
|
|
|