944,105 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Unsolved
  • Views: 953
  • MS SQL RSS
Nov 8th, 2009
0

Delete Rows

Expand Post »
Hi

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

sql Syntax (Toggle Plain Text)
  1. 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?
Last edited by peter_budo; Nov 15th, 2009 at 4:39 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kaddolas is offline Offline
1 posts
since Nov 2009
Nov 8th, 2009
0
Re: Delete Rows
MS SQL Syntax (Toggle Plain Text)
  1. DELETE FROM User WHERE UserId >= 1915 AND UserId <= 1945

There is also a BETWEEN operator you could use.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Nov 10th, 2009
0
Re: Delete Rows
Also you can write:
MS SQL Syntax (Toggle Plain Text)
  1. DELETE FROM User WHERE UserId BETWEEN 1915 AND 1945
Reputation Points: 26
Solved Threads: 44
Posting Whiz in Training
mail2saion is offline Offline
247 posts
since Apr 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Smart Searches
Next Thread in MS SQL Forum Timeline: is there a way to make an image data type as index?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC