• MSSQL int to nvarchar

    If you need to convert/cast a database integer field to an nvarchar on a Microsoft SQL Server, you should use the convert function. In this example we cast the number 4343 to an nvarchar: Example to convert an int field (field_int) to a nvarchar field: Result from the query:

  • MSSQL datediff in seconds

    The following command on a Microsoft SQL Server calculates the difference in seconds between two datetimes: Example query: Result: If you need the result as a text and also want to add 3 digits after the seconds you can use the following example: Result:

  • HTTP header CSV type

    The right HTTP header content-type for CSV files is the following: The complete HTTP header: In PHP you should use for an CSV file download the following lines at the start of the file: In C#/ASP .Net you use the following code in the code behind file:

  • Oracle top 1 record

    To select the top 1 records from an oracle database, you filter with the where statement on rownum = 1: If you want to select top 10 records from the table you use the following statement:

  • Javascript string in (includes)

    Here a quick example how in javascript the includes function on an string works. In other programming language its also known as “in” or “contains” function. Output:

  • JS multiline string

    In Javascript you can create an multiline string with the following char: `