Introduction In this blog post, we will see How to find the Datatype and Properties of a Variable and Columns of a Table. The Easy method for this Question is, using SQL_VARIANT_PROPERTY Function. SQL_VARIANT_PROPERTY The SQL_VARIANT_PROPERTY Function returns the base datatype and other basic information like Precision, Scale, Total bytes, Collation and Maximum Length. SYNTAX… Continue reading How to Know the Datatype and Properties of a Variable and Columns of a Table
Tag: On Premises
Easy Like Search to find Table, View, Stored Procedure and Function Names in SQL Server
Introduction In this blog post, will see how can we easily find or search Table, View and Stored Procedure, Function names in SQL Server. SQL Script for Sample Table, View, SP, Function Creation -- Sample Table Creation CREATE TABLE TestTable ( TestTable_key INT IDENTITY(1,1) NOT NULL, TestTable_Name VARCHAR(100) NOT NULL ); GO -- Sample View… Continue reading Easy Like Search to find Table, View, Stored Procedure and Function Names in SQL Server
ON and OFF IntelliSense within Session in SSMS
Introduction In this blog post, we will see how to Switch ON or OFF IntelliSense within Session Level in SSMS (SQL Server Management Studio). Refresh, Enable and Disable IntelliSense Feature in SSMS (SQL Server Management Studio) works commonly for all sessions. But here, we will see how to Enable or Disable IntelliSense within Session level in… Continue reading ON and OFF IntelliSense within Session in SSMS
Import CSV and TXT Files as Tables in SQL Server
Introduction In this blog post, we are going to look how can we import .csv and .txt files as tables in SQL Server and some of the possible errors to avoid in this process. Import .csv and .txt files as Tables in SQL Server .csv file ( Comma Delimited ) .csv file .txt file (… Continue reading Import CSV and TXT Files as Tables in SQL Server
Single Digit Special Characters used between SELECT and FROM in SQL Server
Introduction In this blog post, we are going to see what are the single digit special characters we can use between SELECT and FROM in SQL Server. Yup, many of us would guess and say '*' (Asterisk) . Yes, of course it's right and it will be our first answer. But What if my question… Continue reading Single Digit Special Characters used between SELECT and FROM in SQL Server
To Fetch Formatted Time from Date time in SQL Server
Introduction In this blog post, we will see How to format the time part from Date time in SQL Server. Here, we have mentioned some of the common and easy methods to achieve this. To Fetch Formatted Time from Date time Method 1 - CONVERT SQL Script SELECT GETDATE() AS INPUT, CONVERT(VARCHAR(5),GETDATE(),108) AS EXPECTED_OUTPUT; Image… Continue reading To Fetch Formatted Time from Date time in SQL Server
Truncate Extra Decimal Places to Exact Scale in SQL Server
Introduction In this blog post, we are going to see How we can Truncate Extra Decimal Places to Exact Scale in SQL Server. We can also say this as, Scale Only Round Off and Non-value Round Off. Method 1 - Using ROUND() SQL Script --Method 1 - Using ROUND() DECLARE @Test_Table AS TABLE (Test_Column DECIMAL(20,5));… Continue reading Truncate Extra Decimal Places to Exact Scale in SQL Server
Top 20 Poor Performing Queries in SQL Server
Introduction In this Blog post, we are going to see How to find the Top 20 Worst Performing Queries in SQL Server. We can use the below query as Query Performance Insight/Monitor that is common for both On-premises SQL Database and Azure SQL Database. SQL Script SELECT TOP 20 ObjectName = OBJECT_SCHEMA_NAME(qt.objectid,DBID) + '.' +… Continue reading Top 20 Poor Performing Queries in SQL Server
Listing Comma Separated Columns instead of ‘*’ in SQL Server
Introduction In any scenarios, if we need to explicitly list out all the column names of a table instead of using '*', we can use like below Script- Sample SQL Script IF(OBJECT_ID('TestEmp') IS NOT NULL) DROP TABLE [TestEmp]; CREATE TABLE dbo.[TestEmp] ( TestEmp_Key INT IDENTITY(1,1) NOT NULL, EmpName VARCHAR(100) NOT NULL, Age INT NULL, [Address] VARCHAR(100)… Continue reading Listing Comma Separated Columns instead of ‘*’ in SQL Server
Counting Number of Occurrences of a Particular Word inside the String Using T-SQL
Introduction In this blog post, we will see how can we easily find the number of occurrences of a Particular Word inside the String Using T-SQL. Check our previous post for Finding Number of Occurrences of a Particular Character in the String. Finding Number of Occurrences of a Particular Word inside the String LOGIC The… Continue reading Counting Number of Occurrences of a Particular Word inside the String Using T-SQL