2025-09-03
1,899 reads
2025-09-03
1,899 reads
We've all heard that definitive statement: "Avoid using cursors." But, in my opinion, what really should be conveyed is: "Avoid using row-by-row operations when possible."
2016-09-09 (first published: 2015-06-01)
13,568 reads
Exploring some differences between using cursors, local fast forward cursors and using set logic.
2016-11-11 (first published: 2015-02-03)
17,304 reads
Cursors are considered by many to be the bane of good T-SQL. What are the best ways to avoid iterative T-SQL and to write queries that look and perform beautifully? In the next part of an ongoing series, we look at ways to efficiently retrieve recently modified data.
2014-06-02
7,056 reads
In this article, we provide a simple way to get a comma delimited list from a table of entries without having to use a CURSOR or a WHILE loop to read through the table.
2012-09-28 (first published: 2011-03-21)
34,376 reads
Cursors provide a means of processing through a set of records row-by-row. However, many companies have a policy against using cursors in their SQL Server standards. This article examines the problem with cursors and alternatives to using them.
2010-09-01
5,122 reads
This article depicts how to approach row by row updates needed in a salary table. It might not directly let you increase your salary, but it could help you at review time.
2009-11-26
42,784 reads
Sometimes cursors are necessary when executing queries in SQL Server, but most of the time they can be avoided entirely. This article shows where cursors can traditionally be used, and how you can use features packaged in SQL Server 2005 to avoid them.
2009-03-19
5,627 reads
Should we really avoid cursors? See how to rewrite code to avoid cursors and also analyze the implications.
2011-05-27 (first published: 2009-01-01)
23,247 reads
2010-06-23 (first published: 2008-12-24)
37,400 reads
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...
By Chris Yates
Artificial intelligence is no longer a distant concept. It is here, embedded in the...
We have a BI-application that connects to input tables on a SQL Server 2022...
At work we've been getting better at writing what's known as GitHub Actions (workflows,...
Comments posted to this topic are about the item The Tightly Linked View
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