Our Blogs
SQL Server Error Warning: Fatal error occurred at date and time. Note the error and time, and contact your system administrator
The error message "Warning: Fatal error %d occurred at %S_DATE. Note the error and time, and contact your system administrator" is a general error message that can be caused by various issues. Here are a few steps you can take to troubleshoot the error: Check the SQL...
The IDENTITY function can only be used when the SELECT statement has an INTO clause.
The error message "The IDENTITY function can only be used when the SELECT statement has an INTO clause" occurs when an IDENTITY function is used in a SELECT statement without an INTO clause. This error occurs because the IDENTITY function is used to insert a new...
Map disks to volumes on your Windows instance
List NVMe volumes You can find the disks on your Windows instance using Disk Management or Powershell. List NVMe disks using Disk Management You can find the disks on your Windows instance using Disk Management. To find the disks on your Windows instance Log in to...
How to read Snowflake data from SQL Server
To read data from a Snowflake database into SQL Server, you can use the following methods: Use the SQL Server Integration Services (SSIS) to create a package that transfers data from Snowflake to SQL Server. Use the Snowflake Data Provider for SQL Server to create a...
How to prevent SysAdmins from accessing specific tables in SQL Server
There are several ways to prevent sysadmins from reading data from specific databases in SQL Server, but one common approach is to use database roles and permissions. Create a new role: Create a new role, such as "db_restricted_reader" with SELECT permissions on the...
How to import JSON file into SQL Server table
There are several ways to import a JSON file into a SQL Server table, including using built-in functions, using third-party tools, or writing a custom script. Here is an example of how to import a JSON file into a SQL Server table using the built-in OPENJSON function:...
How to hide a stored procedure in a stored procedure in SQL Server
There are a few ways to hide a stored procedure in a stored procedure in SQL Server, but one common approach is to use dynamic SQL. Dynamic SQL allows you to generate and execute T-SQL statements at runtime, which can be used to hide the underlying stored procedure....
How to export SQL Server data to JSON file
There are several ways to export SQL Server data into a JSON file, including using built-in functions, using third-party tools, or writing a custom script. Here is an example of how to export SQL Server data into a JSON file using the built-in FOR JSON function:...
How to determine Included non-clustered indexes in SQL Server
Included indexes are a type of non-clustered index in SQL Server that include columns that are not part of the index key. These included columns allow the index to cover more queries and reduce the need for additional index lookups. Here are a few ways to determine...
How to compare multiple tables in SQL Server
In SQL Server, you can use the sp_help and sp_columns system stored procedures to compare the table structure of multiple tables. sp_help: The sp_help stored procedure returns information about the table, such as the name, owner, and columns. EXEC sp_help 'table1'...
Hidden Gems for Developers in SQL Server
SQL Server has many features and functionalities that may not be well-known or widely used by many. Here are a few hidden gems in SQL Server that you may find useful: The OUTPUT clause: This clause allows you to return the values of the inserted, deleted, or updated...
Encrypting Table values in SQL Server
There are several methods to encrypt table values in SQL Server. One of the most common methods is to use built-in encryption functions such as ENCRYPTBYPASSPHRASE and DECRYPTBYPASSPHRASE. Here's an example of how to encrypt the values in a table column called...
Encrypting Data at Rest with TDE in SQL Server
Transparent Data Encryption (TDE) is a feature in SQL Server that allows you to encrypt the entire database, including the data and log files, to protect sensitive data from unauthorized access. Here's an example of how to implement TDE at the database level using the...
Difference between Primary and Unique Key in SQL Server
A primary key is a column or set of columns in a table that uniquely identifies each row in the table. A primary key cannot contain null values and must have a unique value for each row. It is used to enforce the integrity of the data and to create a link between...
Best Practices using INNER JOIN in SQL Server
This is the most commonly used type of join. It returns only the rows that have matching values in both tables. The syntax for an inner join is: SELECT column1, column2 FROM table1 JOIN table2 ON table1.column = table2.column; Real-life example: A retail store has a...
Best Practices of using LEFT JOIN in SQL Server
LEFT JOIN: This type of join returns all the rows from the left table and the matching rows from the right table. If there is no match, the result will contain NULL values. The syntax for a left join is: <!-- wp:paragraph --> <p>SELECT column1, column2</p>...
Best Practices of using FULL OUTER JOIN in SQL Server
FULL OUTER JOIN: This type of join returns all the rows from both tables, whether there is a match or not. If there is no match, the result will contain NULL values. The syntax for a full outer join is: SELECT column1, column2 FROM table1 FULL OUTER JOIN table2 ON...
Best Practices for using RIGHT JOIN in SQL Server
RIGHT JOIN: This type of join returns all the rows from the right table and the matching rows from the left table. If there is no match, the result will contain NULL values. The syntax for a right join is: SELECT column1, column2 FROM table1 RIGHT JOIN table2 ON...
Best Practices for querying large datasets in SQL Server
When querying large tables, it's important to follow best practices to ensure optimal performance: Use indexes: Create indexes on the columns that are frequently used in WHERE clauses and JOIN conditions. This will allow the database engine to quickly locate the data...
Best Practices for Object Naming Convention in SQL Server
There are several best practices for object naming conventions in SQL Server: Use meaningful and descriptive names: Object names should be clear, meaningful, and descriptive. Avoid using generic or abbreviated names. Use consistent naming conventions: Establish a...