Results for "t-sql"
10 / 184 posts
Added columns in a table by dynamic ways
IF OBJECT_ID('AddedDynamicColumn','P') IS NOT NULL BEGIN DROP PROC AddedDynamicColumn END GO CREATE PROCEDURE AddedDynamicColumn AS BEGIN SELECT ED.empid,E…
How to get first date of given date or month.
Get First date of month: SELECT DATEFROMPARTS(YEAR(GETDATE()), MONTH(GETDATE()), 1) AS FirstDayOfCurrentMonth Create function for that IF NOT EXISTS (SELEC…
How to one series with comma separate(any Delimiter) value split into in rows
If we have one series with comma separate(any Delimiter) value and we want split into in rows, I have create function for that: IF OBJECT_ID('TF_SplitSerie…
How to Two series with comma separate(any Delimiter) value split into in rows respectively
If we have two series with comma separate(any Delimiter) value and we want split into in rows, I have create function for that: IF OBJECT_ID('TF_SplitTwoSe…
Use of Apply(Cross and Outer) operator in SQL server
APPLY operator joins two table expressions. Also, I'll show how it differs from regular JOINs. Operator: CROSS APPLY Similar: INNER JOIN When to Use: Use a…
How to find table column information by using SQL query
Comprehensive Guide to Fetching Table and Column Metadata with SQL Server Stored Procedures When working with databases, understanding the structure of tab…
UNION, UNION All, INTERSECT, EXCEPT used in SQL Server
UNION : The UNION operator is used to combine the result sets of two or more SELECT statements into a single result set. It removes duplicate rows from the…
What is View in SQL server
A view is a virtual table based on the result-set of an SQL statement. A view contains rows and columns, just like a real table. IF OBJECT_ID('ViewTable','…
ANY and ALL operators used in SQL
The ANY operator: returns a boolean value as a result returns TRUE if any of the sub-query values meet the condition Any means that the condition will be t…
Split full name into first name and last name in SQL
Split full name into first name and last name : SELECT EmployeeName, CASE WHEN CHARINDEX(' ', EmployeeName) > 0 -- Check if there is a space (indicating…