1. Other SQL clauses

    Article: AN0001885Updated: 10.06.2020

    CASE in SELECT clause:

    • CAST(0 AS BIT) AS Escalated
    • CASE WHENt.escalate = 1 then '\ImagesData\all icons\exclamation.png' else '' end AS Escalated
    • '415-' + convert( varchar, t.id) AS FullId
    •  ISNULL( t.[deadline] , CONVERT(Datetime, '9999-012-31 00:00:00', 120)) AS Order_date

    Conversion of the date in format date and time to a simple date:

    • CONVERT(DATE, h.date, 101) date

    Function returning id of current user:

    • {{ loginuser.id }}

    Function returning id of a given class:

    • {{:class.class_code.id:}}

    We will use this function if the query should return e.g. fullId of a record, that we want to use in an URL link in a certain query column. Instead of example '415-' + convert( varchar, t.id) AS FullId, which we can see above, we would use e.g. '{{:class.server.id:}}-' + convert( varchar, s.id). This will ensure portability.

    Comment:

    • /*  comment  */
×