SQL : Relevance for know collation, for multi instances

Hi all (sorry for my english)
I want to do an analysis for know some information SQL server.

i have un problem, i want to know collation language for each instance SQL.
I know how to know how find SQL

q: ((names of parent key of it) of keys “Setup” of keys (values of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL” of native registry as string) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server” of native registry)
A: MSSQL11.BIGFIX

if i want to know all multi instance i put :slight_smile:
concatenation “;” of ((names of parent key of it) of keys “Setup” of keys (values of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL” of native registry as string) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server” of native registry)
That give me all instance.

if i put full keypath for collation:
q: value “Collation” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.BIGFIX\setup” of native registry
A: SQL_Latin1_General_CP1_CI_AS
All is ok

But my instance SQL can have other name or mutli.

How can i conctatenate :
value “Collation” of keys
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server"
+
((names of parent key of it) of keys “Setup” of keys (values of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL” of native registry as string) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server” of native registry)
+
"\Setup” of native registry)

thanks for you help

I do other test :

q: (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server” & ((names of parent key of it) of keys “Setup” of keys (values of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL” of native registry as string) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server” of native registry) & “\setup”)
E: A singular expression is required.

That not work too

@zesteph

You might consider an it clause, to catch the different key and value information at the different layers. You will also have to leave the subkeys as plural, to allow for more than one. It’s a bit complicated. Here is sample code that will probably work for you.

q: (name of it, values "Collation" of keys "setup" of it) of keys of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\" of native registry 
A: MSSQL14.MSSQLSERVER, SQL_Latin1_General_CP1_CI_AS
2 Likes

YES TOP !!!
Thanks a lot @brolly33 :ok_hand:

1 Like