Tutorial by Examples: n

The column text may change upon the horizontal resizing of a column. There are three methods to accomplish this: Method NameMaximum Length of Headingset_short_text10set_medium_text20set_long_text40 The following example shows usage of all three. A column object is declared and instantiated as a re...
The following method call enables usage of many advanced features such as sorting, filtering, and exporting data. alv->get_functions( )->set_all( ).
This method increases readability by giving consecutive rows alternating background color shading. alv->get_display_settings( )->set_striped_pattern( if_salv_c_bool_sap=>true ).
By default, when an ALV is displayed, the title at the top is just the program name. This method allows the user to set a title of up to 70 characters. The following example shows how a dynamic title can be set that displays the number of records displayed. alv->get_display_settings( )->set_l...
Suppose you have a parentView into which you want to insert a new subView programmatically (eg. when you want to insert an UIImageView into a UIViewController's view), than you can do it as below. Objective-C [parentView addSubview:subView]; Swift parentView.addSubview(subView) You can also...
CSS .bordered { border-image: linear-gradient(to right, red 20%, green 20%, green 40%, blue 40%, blue 60%, maroon 60%, maroon 80%, chocolate 80%); /* gradient with required colors */ border-image-slice: 1; } HTML <div class='bordered'>Border on all sides</div> The above ex...
Formats results of SELECT query as JSON text. FOR JSON PATH clause is added after query: SELECT top 3 object_id, name, type, principal_id FROM sys.objects FOR JSON PATH Column names will be used as keys in JSON, and cell values will be generated as JSON values. Result of the query would be an a...
FOR JSON PATH enables you to control format of the output JSON using column aliases: SELECT top 3 object_id as id, name as [data.name], type as [data.type] FROM sys.objects FOR JSON PATH Column alias will be used as a key name. Dot-separated column aliases (data.name and data.type) will be gen...
WITHOUT_ARRAY_WRAPPER option enables you to generate a single object instead of the array. Use this option if you know that you will return single row/object: SELECT top 3 object_id, name, type, principal_id FROM sys.objects WHERE object_id = 3 FOR JSON PATH, WITHOUT_ARRAY_WRAPPER Single obje...
FOR JSON clause ignores NULL values in cells. If you want to generate "key": null pairs for cells that contain NULL values, add INCLUDE_NULL_VALUES option in the query: SELECT top 3 object_id, name, type, principal_id FROM sys.objects FOR JSON PATH, INCLUDE_NULL_VALUES NULL values in...
Wraps returned JSON array in additional root object with specified key: SELECT top 3 object_id, name, type FROM sys.objects FOR JSON PATH, ROOT('data') Result of the query would be array of JSON objects inside the wrapper object: { "data":[ {"object_id":3,&qu...
Automatically nests values from the second table as a nested sub-array of JSON objects: SELECT top 5 o.object_id, o.name, c.column_id, c.name FROM sys.objects o JOIN sys.columns c ON o.object_id = c.object_id FOR JSON AUTO Result of the query would be array of JSON objects: [ { &...
If you need some complex JSON structure that cannot be created using FOR JSON PATH or FOR JSON AUTO, you can customize your JSON output by putting FOR JSON sub-queries as column expressions: SELECT top 5 o.object_id, o.name, (SELECT column_id, c.name FROM sys.columns c WHERE o...
WHERE clause filters only those rows that satisfy some condition: SELECT * FROM sys.objects WHERE type = 'IT'
ORDER BY clause sorts rows in the returned result set by some column or expression: SELECT * FROM sys.objects ORDER BY create_date
GROUP BY clause groups rows by some value: SELECT type, count(*) as c FROM sys.objects GROUP BY type You can apply some function on each group (aggregate function) to calculate sum or count of the records in the group. typecSQ3S72IT16PK1U5
HAVING clause removes groups that do not satisfy condition: SELECT type, count(*) as c FROM sys.objects GROUP BY type HAVING count(*) < 10 typecSQ3PK1U5
TOP clause returns only first N rows in the result: SELECT TOP 10 * FROM sys.objects
OFFSET FETCH clause is more advanced version of TOP. It enables you to skip N1 rows and take next N2 rows: SELECT * FROM sys.objects ORDER BY object_id OFFSET 50 ROWS FETCH NEXT 10 ROWS ONLY You can use OFFSET without fetch to just skip first 50 rows: SELECT * FROM sys.objects ORDER BY obj...
SELECT statement can be executed without FROM clause: declare @var int = 17; SELECT @var as c1, @var + 2 as c2, 'third' as c3 In this case, one row with values/results of expressions are returned.

Page 516 of 1088