Skip to main content

Posts

Master SQL Server: 7 Beginner-Friendly Lessons by Professor Airton

  Learn SQL Server in a simple and practical way with the 7 amazing lessons taught by the talented professor Airton, who works at our company Autocom3. And the best part: the content is completely free and you have permission to share it freely! If you're just starting your journey in the world of SQL Server, you can't miss this opportunity to learn from an expert. The lessons have been carefully prepared to meet the needs of beginners and cover everything from basic concepts to more advanced topics. Here are some of the topics covered in the lessons: Introduction to SQL Server: Get to know the environment and essential tools. Fundamental SQL commands: Learn the key commands for data manipulation. Table creation and relationships: Understand how to create and manage tables in SQL Server. Advanced querying: Explore advanced query features to obtain accurate information. Functions and stored procedures: Use functions and stored procedures to automate tasks and improve performance...

How to change the recovery model from FULL to SIMPLE in all databases in sql server

Yes, it is possible to use a SQL query to change the recovery model of all databases on a SQL Server server to "SIMPLE". To do this, you can use the following query: EXEC sp_msforeachdb 'USE [?]; IF DATABASEPROPERTYEX(''?'', ''recovery'') = ''FULL'' ALTER DATABASE [?] SET RECOVERY SIMPLE;' This query uses the SQL Server function sp_msforeachdb to iterate through all databases on the server and changes the recovery model of all databases that use the "FULL" model to "SIMPLE". Note that this query should be run with care and you should back up your databases before running this query as changing your recovery model may affect your ability to recover data in case of server failures. I hope this helps!

How to check all databases that are using the recovery model as "FULL" in the SQL SERVER database.

To verify all databases on a SQL Server server that are using the "FULL" transaction log recovery model and have a pending full transaction log backup, you can use the following query: SELECT name AS 'Nome do banco de dados' FROM sys.databases WHERE recovery_model_desc = 'FULL' AND name NOT IN ('master', 'tempdb', 'model', 'msdb') AND database_id NOT IN (     SELECT DISTINCT database_id FROM msdb.dbo.backupset     WHERE type = 'L' AND is_copy_only = 0 AND backup_finish_date IS NULL ) order by name and to check the ones that are simple, just change it to SIMPLE SELECT name AS 'Nome do banco de dados' FROM sys.databases WHERE recovery_model_desc = 'SIMPLE' AND name NOT IN ('master', 'tempdb', 'model', 'msdb') AND database_id NOT IN (     SELECT DISTINCT database_id FROM msdb.dbo.backupset     WHERE type = 'L' AND is_copy_only = 0 AND backup_finish_date IS NULL ) order...

How to Create LDF from MDF

If you only have the MDF and it is healthy, you can attach it to your SQL Server. SQL Server will create the database from the .MDF and will create the .LDF for you. Try the following: USE MASTER EXEC sp_attach_single_file_db @dbname = 'YourBank', @physname = 'MDF location'   Microsoft recommends not using this procedure anymore, as it will possibly be discontinued. You can get the same result through CREATE DATABASE with the FOR ATTACH parameter.   USE MASTER CREATE DATABASE MeuBanco ON (NAME='FileLogicalName', FILENAME='FileLocation') FOR ATTACH_REBUILD_LOG IMPORTANT: The wizard does not work, only via script.

Visual Studio 2022 - Run-time Exception System.BadImageFormatException

I had this problem in visual studio 2022 after taking an application that was originally using the .net 35 framework and change it to .net 4.8. After this change, the application compiles without errors, but throws this error at runtime: System.BadImageFormatException was unhandled Message: An unhandled exception of type 'System.BadImageFormatException' occurred in Unknown Module. Additional information: Could not load file or assembly 'TimersXP.exe' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. SOLUTION: Change the APP.CONFIG file, leaving the <STARTUP> section with the 4.0 framework only. After that, I did a CLEAR on the project and a BUILD. And the app.config has been changed to: BEFORE: <startup>     <supportedRuntime version="v2.0.50727"/>     <supportedRuntime version="v4.0"/> </startup> LATER: I removed the line <supportedRuntime ve...