Date and Time Calculations Made Easy with EOMONTH, DATEDIFF, and DATEADD
Learn how to work with dates and calculate particular dates or elapsed time periods with some of the functions available in SQL Server.
2025-05-09
2,713 reads
Learn how to work with dates and calculate particular dates or elapsed time periods with some of the functions available in SQL Server.
2025-05-09
2,713 reads
2025-05-07
431 reads
I know SQL cursors exist, but I am not sure how or why to use them. Can you provide a SQL cursor example? Can you give any guidance on when to use a SQL Server cursor?
2025-05-07
In a previous topic we discussed how to pass parameters into a stored procedure, but another option is to pass parameter values back out from a stored procedure. One option for this may be that you call another stored procedure that does not return any data, but returns parameter values to be used by the calling stored procedure.
2025-05-02
2025-04-23
407 reads
I have a lot of SQL update queries where I need to make IF/ELSE types of decisions. In some cases, I am using a cursor but looping through thousands of rows for update takes a long time. I also use some dynamic SQL to handle some query parameter decision making. Is there a better alternative?
2025-04-23
See how ISNULL and COALESCE behave in different situations and ensure you know which one to pick when.
2025-04-18
4,941 reads
Learn how to use the UPDATE statement, along with a few things to be aware of when changing data.
2025-04-11
1,589 reads
2025-04-09
1,805 reads
A short look at the differences in UNION and UNION ALL in a SELECT query.
2025-04-07
4,235 reads
You can find the slides of my session on the €100 DWH in Azure...
By Steve Jones
This value is something that I still hear today: our best work is done...
By gbargsley
Have you ever received the dreaded error from SQL Server that the TempDB log...
Hi everyone I am writing an SP where there is logic inside the SP...
Comments posted to this topic are about the item Planning for tomorrow, today -...
We have a BI-application that connects to input tables on a SQL Server 2022...
I try to run this code on SQL Server 2022. All the objects exist in the database.
CREATE OR ALTER VIEW OrderShipping AS SELECT cl.CityNameID, cl.CityName, o.OrderID, o.Customer, o.OrderDate, o.CustomerID, o.cityId FROM dbo.CityList AS cl INNER JOIN dbo.[Order] AS o ON o.cityId = cl.CityNameID GO CREATE OR ALTER FUNCTION GetShipCityForOrder ( @OrderID INT ) RETURNS VARCHAR(50) WITH SCHEMABINDING AS BEGIN DECLARE @city VARCHAR(50); SELECT @city = os.CityName FROM dbo.OrderShipping AS os WHERE os.OrderID = @OrderID; RETURN @city; END; goWhat is the result? See possible answers