goransaler
IS-IT--Management
hello
If i have a table like this
id Actstart Actend Activity
1 12:00 13:00 test1
2 15:15 test2
3 13:00 15;00 test3
4 15:00 test4
and the Actstart and Actend are datetime
and i
use this query
SELECT ID, Actstart, Actend, Activity, CASE WHEN EXISTS
(SELECT *
FROM Activity
WHERE Actend IS NULL) THEN '*' ELSE ' ' END + ' ' + Activity AS Activact FROM Activity
WHERE (Actend IS NULL)
i get
2 15:15 test2 *test2
4 15:00 test4 *test4
i get only the ones whith null in Actend
How do i do to get all ones and the one with <NULL>
in Actend will have a * first in the result of Activact and the other ones will have space first
like this
1 12:00 13:00 test1 test1
2 15:15 test2 *test2
3 13:00 15;00 test3 test3
4 15:00 test4 *test4
Ps I also have a question about if i want the Activact
to only contain 20 letter and the Activity field contain maybe 100
Thanks for any help
If i have a table like this
id Actstart Actend Activity
1 12:00 13:00 test1
2 15:15 test2
3 13:00 15;00 test3
4 15:00 test4
and the Actstart and Actend are datetime
and i
use this query
SELECT ID, Actstart, Actend, Activity, CASE WHEN EXISTS
(SELECT *
FROM Activity
WHERE Actend IS NULL) THEN '*' ELSE ' ' END + ' ' + Activity AS Activact FROM Activity
WHERE (Actend IS NULL)
i get
2 15:15 test2 *test2
4 15:00 test4 *test4
i get only the ones whith null in Actend
How do i do to get all ones and the one with <NULL>
in Actend will have a * first in the result of Activact and the other ones will have space first
like this
1 12:00 13:00 test1 test1
2 15:15 test2 *test2
3 13:00 15;00 test3 test3
4 15:00 test4 *test4
Ps I also have a question about if i want the Activact
to only contain 20 letter and the Activity field contain maybe 100
Thanks for any help