How do I get SQL server 2008r2 to show me the Errors?

I am running an Insert script that is supposed to insert 13,381 rows into a blank DB from SSMS. Its telling my “Query completed with errors” and is only inserting 13357 rows.

Nothing is showing up in the Error list. How do I locate the mistakes in the script?

  • Cyrillic encoding in C#
  • Converting multiple rows to columns with specified heading
  • 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'
  • Solutions for INSERT OR UPDATE on SQL Server
  • Return value from exec(@sql)
  • how to call scalar function in sql server 2008
  • Thank you!

    One Solution collect form web for “How do I get SQL server 2008r2 to show me the Errors?”

    try this:

    begin try
    
        --your inserts here
    
    end try
    begin catch
        --returns the complete original error message as a result set
        SELECT 
            ERROR_NUMBER() AS ErrorNumber
            ,ERROR_SEVERITY() AS ErrorSeverity
            ,ERROR_STATE() AS ErrorState
            ,ERROR_PROCEDURE() AS ErrorProcedure
            ,ERROR_LINE() AS ErrorLine
            ,ERROR_MESSAGE() AS ErrorMessage
    
        --will return the complete original error message as an error message
        DECLARE @ErrorMessage nvarchar(400), @ErrorNumber int, @ErrorSeverity int, @ErrorState int, @ErrorLine int
        SELECT @ErrorMessage = N'Error %d, Line %d, Message: '+ERROR_MESSAGE(),@ErrorNumber = ERROR_NUMBER(),@ErrorSeverity = ERROR_SEVERITY(),@ErrorState = ERROR_STATE(),@ErrorLine = ERROR_LINE()
        RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState, @ErrorNumber,@ErrorLine)
    end catch
    
    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.