troubleshooting Question

SQL Consolidate rows

Avatar of Mauro Cazabonnet
Mauro CazabonnetFlag for United States of America asked on
Microsoft SQL ServerSQL
3 Comments1 Solution138 ViewsLast Modified:
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

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

Vitor Montalvão
IT Engineer
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros