Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of aggregate functions

Is there a way to fetch list of aggregate functions supported by a dbms using jdbc metadata or running any dbms specific query?

like image 604
AMAN MANOCHA Avatar asked Nov 14 '22 22:11

AMAN MANOCHA


1 Answers

On SQL Server you can query XML which is in installation directory:

DECLARE @xml XML
SELECT @xml = x.y
FROM OPENROWSET( BULK 'C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlToolsData\1033\SQLCommonObjects.xml', SINGLE_BLOB ) x(y)

;WITH XMLNAMESPACES( 'http://tempuri.org/SqlCommonObjects.xsd' AS ns )
SELECT
Category.Name.value('ns:DisplayName[1]', 'VARCHAR(MAX)') [Category],
[Function].Name.value('ns:Name[1]', 'VARCHAR(MAX)') [Function],
[Function].Name.query('for $p in ns:Parameters/ns:Parameter return
concat($p/ns:Name[1],",")').value('.', 'VARCHAR(MAX)') Parameters

FROM @xml.nodes('//ns:Category[ns:DisplayName="Aggregate Functions"]')
AS Category(Name)
CROSS APPLY Category.Name.nodes('ns:Objects/ns:Function') [Function](Name)

Where after BULK statement you should give your folder(difference mainly is Program Files" and "Program_Files(x86)" and SQL server version (100 is 2008 in example)

like image 57
Dalex Avatar answered Dec 19 '22 13:12

Dalex