2011-10-03 (first published: 2008-03-27)
6,934 reads
2011-10-03 (first published: 2008-03-27)
6,934 reads
Handling the paging of results in T-SQL has been a challenge for a long time. Robert Cary presents an interesting technique in this article.
2010-05-08 (first published: 2009-03-11)
41,596 reads
As a SQL Server DBA you should know that your code is stored in syscomments by default. While most DBAs use version control systems, there are times you might want to look through the code on the server for comparison purposes. Robert Cary brings us an article on how you can do this in 2000 and 2005.
2008-01-07 (first published: 2007-01-22)
8,390 reads
This script will quickly generate DML to search all the tables in the current database for a given string. It could be modified to execute the generated code if desired. If you are running this in a
2007-01-23 (first published: 2007-01-04)
2,947 reads
This function was originally contributed by other visitors. Below is an example of a set based approach to the problem. This script requires a numbers table (see SqlServerCentral article http://www.sqlservercentral.com/columnists/mcoles/2547.asp for more details)Please note that this code is uses SQL2005 featuresEnjoy!Robert Caryhttp://tsqlland.blogspot.com
2006-10-20 (first published: 2006-09-18)
546 reads
SQL Server does a great job of handling concurrency & ensuring that users can make changes in multi-user systems without conflict. However there are times a strict calling order is needed.
2006-10-17
19,833 reads
Want to really level up your SQL game? I mean, go from good to great? This March...
By Steve Jones
We published an article recently at SQL Server Central on Tally Tables in Fabric...
By James Serra
In today’s data-driven world, organizations need the ability to analyze and act on data...
Comments posted to this topic are about the item Dynamic T-SQL Script Parameterization Using...
The state-of-the-art FARE Labs Environmental Testing Laboratory provides a comprehensive variety of testing services...
I'm running some restoration activity as part of a rehearsal to prepare for an...
I created a new sequence in SQL Server 2022 with this code.
CREATE SEQUENCE myseqtest START WITH 1 INCREMENT BY 1; GOI want to use this to insert some data from another table into a new table with this sequence. Which of these queries shows the way to do this efficiently?
-- 1 INSERT dbo.NewMonthSales (SaleID, saleyear, salemonth, currSales) SELECT NEXT VALUE FOR myseqtest , ms.saleyear , ms.salemonth , ms.currMonthSales FROM dbo.MonthSales AS ms; GO -- 2 INSERT dbo.NewMonthSales (SaleID, saleyear, salemonth, currSales) SELECT NEXT VALUE , ms.saleyear , ms.salemonth , ms.currMonthSales FROM dbo.MonthSales AS ms, myseqtest; GO --3 DECLARE mycurs CURSOR FOR SELECT ms.saleyear , ms.salemonth , ms.currMonthSales FROM dbo.MonthSales AS ms DECLARE @yr INT, @mn INT, @sales NUMERIC(10,2) FETCH NEXT FROM mycurs INTO @yr, @mn, @sales WHILE @@FETCH_STATUS = 0 BEGIN INSERT dbo.NewMonthSales (SaleID, saleyear, salemonth, currSales) SELECT NEXT VALUE FOR myseqtest , @yr , @mn , @sales FETCH NEXT FROM mycurs INTO @yr, @mn, @sales ENDSee possible answers