How To Alter User-Defined Table Types in SQL Server

I cannot use ALTER to modify the type nor can I drop and recreate it since it is being referenced by existing Stored Procedures. That means, reference must be removed first. In this post, We will learn how to alter User-Defined Table types in SQL Server. Example Case: Let’s say we have multiple stored procedure Read more about How To Alter User-Defined Table Types in SQL Server[…]

How To Get Row Count For All Tables In SQL Server Database

Recently, I was working in analyzing a healthcare database where one simple task was to identify the big tables in terms of “Number of records”. So. I needed to get the row count for each tables in a SQL Server Database. There are many way to get this data. See the below T-SQL scripts: 1. Read more about How To Get Row Count For All Tables In SQL Server Database[…]

How to Track Stored Procedure, Function, View changes in SQL Server

Do you want to track the changes made on database objects like Stored Procedures, Views, Functions? SQL Server supports DDL Triggers that can be used to accomplish this task. SQL Server DDL Triggers is a special kind of trigger that fire in response to Data Definition Language (DDL) statements – CREATE, ALTER, DROP (Table, Function, Read more about How to Track Stored Procedure, Function, View changes in SQL Server[…]

How To Create And Schedule Job Using SQL Server Agent

In this post, we walk through the step by step process of creating and scheduling a job using SQL Server Management Studio.   What is SQL Server Agent ? SQL Server Agent is a component of Microsoft SQL Server which allows the database administrator (DBA) to schedule jobs and handles other automated tasks such as database backups Read more about How To Create And Schedule Job Using SQL Server Agent[…]

How to search a specific text in a SQL Server Stored Procedures, Functions, Views or Triggers

As a DB developer, I often needed to find a stored procedures, functions, views and triggers  that contains a specific piece of text string. For an example, say I want to find any Stored Procedures, Views or Functions that contains a text ‘codemog’. So, How to search a specific text in a SQL Server Stored Procedures,Views or functions Read more about How to search a specific text in a SQL Server Stored Procedures, Functions, Views or Triggers[…]

How to Design Memory Optimize Database using SQL Server In-Memory OLTP

‘In-Memory OLTP’ also known as ‘Hekaton’ and ‘In-Memory Optimization’ is in-memory processing technology that allows you to get most out of SQL Server for your transactional workloads. This feature was introduced with SQL Server 2014 release. This post demonstrates the usage of In-Memory OLTP feature with examples. Create A Database 1 2 — Create a Read more about How to Design Memory Optimize Database using SQL Server In-Memory OLTP[…]

SQL Server: Error – ‘The operation ‘AUTO_CLOSE’ is not supported with databases that have a MEMORY_OPTIMIZED_DATA filegroup.’

The operation ‘AUTO_CLOSE’ is not supported with databases that have a MEMORY_OPTIMIZED_DATA filegroup. You are getting this error because your database set to AUTO_CLOSE ON, which is the default setting for any database in SQL Server. If you are trying to create a memory-optimized file group or data file to use In-Memory OLTP feature of SQL Server, you Read more about SQL Server: Error – ‘The operation ‘AUTO_CLOSE’ is not supported with databases that have a MEMORY_OPTIMIZED_DATA filegroup.’[…]

Different types of keys in SQL Server

What is Key in SQL? SQL Keys are logical database objects that play a very important role in database. Strictly speaking, a KEY is a constraint or rule that is used for data consistency and accuracy, to maintain uniqueness, to create relationships between database object and optimization purposes etc. For Example: A NOT NULL constraint is a rule that Read more about Different types of keys in SQL Server[…]

Table Variables in SQL Server

In Previous post Temporary Tables in SQL Server, we learnt what is temporary tables and how they are used for storing data temporarily. There is an another database object which can be used for same called Table Variables. In this post, we will discuss what are temporary tables when to use them in details. What are Table Variables? Read more about Table Variables in SQL Server[…]

Best practices of writing stored procedure

In Previous post  “Stored Procedure in MS SQL Server”, we learnt about the stored procedure basics and the benefits and flexibility it provides. Now, It’s time to learn the best practices to write well crafted, good performance tuned and concise stored procedures. I’m listing some of the best practices that must be followed every time you write Stored Read more about Best practices of writing stored procedure[…]