Skip to content

Instantly share code, notes, and snippets.

@MarkPryceMaherMSFT
Created April 17, 2025 10:18
Show Gist options
  • Save MarkPryceMaherMSFT/e91bfd9c3bbd15412667dedceec4a652 to your computer and use it in GitHub Desktop.
Save MarkPryceMaherMSFT/e91bfd9c3bbd15412667dedceec4a652 to your computer and use it in GitHub Desktop.
script to show if the databases are for a lakehouse or warehouse
DECLARE @command varchar(8000)
declare @i int =1;
declare @d int =0;
select @d = max(database_id) from sys.databases;
declare @dbname nvarchar(128);
set @command = '';
while(@i < @d)
begin
set @dbname = '';
select @dbname = name from sys.databases where database_id = @i
--select @i, @dbname
if len(@dbname) > 0
begin
set @command = @command + 'SELECT ''' + @dbname + ''' as [dbname], DATABASEPROPERTYEX(''' + @dbname + ''', ''Edition'') as [Type] UNION '
end
set @i= @i +1
end
set @command = left(@command, len(@command) - 5)
print @command;
exec(@command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment