Hi

I wonder how I do to remove usersid from 1915 to 1945 for example in MS Sql?

Delete from [dbo].[user] where user ID = 1915 to userID 1945

When i add that i get this message:

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'to'.
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'to'.

Can someone please tell me what is wrong?

Recommended Answers

All 2 Replies

Delete from User Where UserId >= 1915 and UserId <= 1945

There is also a BETWEEN operator you could use.

Also you can write:

DELETE FROM User WHERE UserId BETWEEN 1915 AND 1945
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.