Grant Fritchey

Grant Fritchey is a SQL Server MVP with over 20 years’ experience in IT including time spent in support and development. Grant has worked with SQL Server since version 6.0 back in 1995. He has developed in VB, VB.Net, C# and Java. Grant has authored books for Apress and Simple-Talk, and joined Red Gate as a Product Advocate in January 2011. Find Grant on Twitter @GFritchey or on his blog as the Scary DBA.

Blog Post

I’m a Pain

Or maybe I’m misreading that I’m supposed to be helping to alleviate pain. Either way, next Thursday, June 17, I’ll be...

2010-06-10

549 reads

Blogs

SQL Server Performance – What IT Leaders Need to Know

By

IT leaders have a lot on their plates! Budgets, staffing, security, uptime, and keeping...

FREE Window Functions Course (This Month Only!)

By

Want to really level up your SQL game? I mean, go from good to great? This March...

Tally Table Alternatives: #SQLNewBlogger

By

We published an article recently at SQL Server Central on Tally Tables in Fabric...

Read the latest Blogs

Forums

Dynamic T-SQL Script Parameterization Using Python

By omu

Comments posted to this topic are about the item Dynamic T-SQL Script Parameterization Using...

Multiple Sequences

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Multiple Sequences

Using SQL Server Stored Procedures with the Django ORM

By omu

Comments posted to this topic are about the item Using SQL Server Stored Procedures...

Visit the forum

Question of the Day

Multiple Sequences

In SQL Server 2022, I run this code:

CREATE SEQUENCE myseqtest START WITH 1 INCREMENT BY 1;
GO
CREATE TABLE NewMonthSales
  (SaleID    INT
  , SecondID int
 , saleyear  INT
 , salemonth TINYINT
 , currSales NUMERIC(10, 2));
GO
INSERT dbo.NewMonthSales
  (SaleID, SecondID, saleyear, salemonth, currSales)
SELECT
  NEXT VALUE FOR myseqtest
, NEXT VALUE FOR myseqtest
, ms.saleyear
, ms.salemonth
, ms.currMonthSales
FROM dbo.MonthSales AS ms;
GO
SELECT * FROM dbo.NewMonthSales AS nms
Assume the dbo.MonthSales table exists. If I run this, what happens?

See possible answers