Created
April 17, 2025 10:18
-
-
Save MarkPryceMaherMSFT/e91bfd9c3bbd15412667dedceec4a652 to your computer and use it in GitHub Desktop.
script to show if the databases are for a lakehouse or warehouse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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