YOU SHOULD NOT MODIFY A CONTENT DATABASE USING SQL
Even reading from the content databases is not considered good practice, you may cause locks which will cause SharePoint to fail.
The moment you change anything in a SharePoint database (except the usage ones) your SharePoint installation becomes unsupported.
Loop through the pages/files using PowerShell and check them in, but don't use SQL.
Read: Support for changes to the databases that are used by Office server products and by Windows SharePoint Services and yes it applies to 2010.
An example of checking in a file using Powershell could be:
$web = Get-SPWeb http://sharepoint
$file = $web.GetFile("Shared Documents/MyDoc.docx")
$file.CheckIn("Checked in using PowerShell", [Microsoft.SharePoint.SPCheckinType]::MajorCheckIn)