Vinay Thakur

Blog Post

Select count(*)

Today I was reading(I always read Paul Randal).
http://www.sqlskills.com/BLOGS/PAUL/post/Which-index-will-SQL-Server-use-to-count-all-rows.aspx
I learned that whenever you query select count(*) it will select the the...

2009-10-09

1,942 reads

Blog Post

How Log reader works- replication

Just saw the the answer by michael Hotek for how log reader works on replication: looks very great:http://social.msdn.microsoft.com/Forums/en-US/sqlreplication/thread/d2d2e1c6-01ee-439b-93e8-e31c77c0cd28/Thanks Michael Hotek...

2009-09-03

813 reads

Blog Post

Replication

Hi,Just want to share info about replication script which i generally use. this is good for sql server 2000 Transaction...

2009-09-03

745 reads

Blog Post

Data Type Synonyms

Today on sql server central QOD. very interesting question on Data Type Synonyms...
http://www.sqlservercentral.com/questions/Programming/67390/
We can use the synonyms data type also...

2009-09-02

626 reads

Blog Post

reading.

Reading another great book ( I know its old but good book)...Inside Microsoft sql server 2005: T-SQL QUERYING....by Itzik Ben - Gan.

2009-08-30

1,591 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