Let’s say you have a SQL Query that uses IN and you want to execute it using Dapper. Your query looks something like this: Here’s how you’d execute that with Dapper: Then you’d call it like this: There are two key things to notice about this: You have to exclude the parentheses. I specified one … Read more C# – How to use IN with Dapper
When you right-click a table in SSMS, you can “Select Top 1000 Rows” and “Edit Top 200 Rows.” You can change how many rows are returned by changing the defaults. Tools SQL Server Object Explorer Change the values under Table and View Options Change these values to whatever makes sense in your situation. Note: if … Read more SSMS – Change how many rows are returned by SELECT Top 1000 Rows
Problem You’re trying to save a table change in SSMS and you get the error message: Saving changes is not permitted. The changes that you have made require the following tables to be dropped and re-created. You have either made changes to a table that can’t be re-created or enabled the option Prevent saving changes … Read more SSMS – How to turn off “Prevent saving changes that require table to be re-created”
Problem When I execute a SQL query I’m getting the following error: Conversion failed when converting date and/or time from character string. The query is using ORDER BY with CASE with a passed in parameter called @OrderBy. Solution Use a separate CASE statement for each possible value (instead of one CASE with multiple WHENs).
Problem You have a SQL query like this: While executing this you get the following error: ‘CREATE/ALTER PROCEDURE’ must be the first statement in a query batch Solution The error message says it all: the CREATE PROCEDURE statement cannot be executed after other queries in the same batch of queries. The solution is to execute … Read more ‘CREATE/ALTER PROCEDURE’ must be the first statement in a query batch
How do you check for new records in a database and react to the new data? You really only have two options: Poll for changes every X seconds Use query notifications to be notified when new data is inserted In this article I’ll show you how to configure query notifications so that your application receives … Read more Event-driven .NET: How to use query notifications in SQL Server to monitor database changes
Problem When entering the sa password while installing SQL Server you get the following error: “The specified sa password does not meet strong password requirements.“ Solution If the computer is on a domain Go to Administrative Tools / Domain Security Policy :: Security Settings | Account Policies | Password Policy Set “Minimum password length” = Not … Read more The specified sa password does not meet strong password requirements