Avatar of Mauro Cazabonnet
Mauro Cazabonnet
Flag for United States of America asked on

SQL Consolidate rows

I'm trying to consolidate the rows of this query

select CASE WHEN [type_desc] = 'ROWS' THEN [physical_name] ELSE NULL END as [database_path], CASE WHEN [type_desc] = 'LOG' THEN [physical_name] ELSE NULL END as [log_path] from sys.master_files 
WHERE [database_id] = 13

Open in new window

database_path      log_path
E:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\Exchange_2013.mdf      NULL
NULL      L:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Data\Exchange_2013_log.ldf

Should look like this

database_path                                                                                                                              log_path
E:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\Exchange_2013.mdf      L:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Data\Exchange_2013_log.ldf
Any help much appreciated

Microsoft SQL ServerSQL

Avatar of undefined
Last Comment
Vitor Montalvão

8/22/2022 - Mon
Vitor Montalvão

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Mauro Cazabonnet

Vitor Montalvão

Correction: "it will repeat log files if you have more than one data file"
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck