Tag Archives: CTE

Overview of the SQL Update statement

In this article, we’ll walk-through the SQL update statement to modify one or more existing rows in the table.    After reading this article, you’ll understand the following topics covering how to use a simple SQL update statement on multiple columns … Continue reading

Posted in SQL | Tagged , , , , | Leave a comment

T-SQL to check Data and Log Files are on same drive or not

The below query help us in finding the physical existence of data and log files are on same drive or not of all the database in a SQL Instance. ;WITH LogCTE AS  (  SELECT DISTINCT LD.Database_Name  FROM  (  SELECT DB_NAME(database_id) AS [Database_Name], LEFT(Physical_Name, 1) AS [Drive_Letter] FROM sys.master_files WHERE type_desc = ‘LOG’ AND database_id > 4  ) AS LD   INNER JOIN    sys.master_files mf     ON LD.Drive_Letter = LEFT(mf.physical_name, 1) and mf.name=LD.Database_Name  WHERE  … Continue reading

Posted in T-SQL, Uncategorized | Tagged , , | Leave a comment