General information
Forum:
Microsoft SQL Server
Environment versions
SQL Server:
SQL Server 2005
the columns is logical, the field name is mon_1,Mon_2 ans so on.
each row have a year number to show the year belong.
the following statement i tryed but dose not works:-
SELECT [year],
NULLIF(CHARINDEX('F', CAST(mon_1 AS CHAR(1)) + CAST(mon_2 AS CHAR(1)) + CAST(mon_3 AS CHAR(1)) + CAST(mon_4 AS CHAR(1)) + CAST(mon_5 AS CHAR(1)) + CAST(mon_6 AS CHAR(1)) + CAST(mon_7 AS CHAR(1)) + CAST(mon_8 AS CHAR(1)) + CAST(mon_9 AS CHAR(1)) + CAST(mon_10 AS CHAR(1)) + CAST(mon_11 AS CHAR(1)) + CAST(mon_12 AS CHAR(1))) - 1, -1)
FROM mumonth
the result i get as follows
2004 null
2005 null
2006 null
2007 null
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only