Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order By Problem

Status
Not open for further replies.

frmorris

Programmer
Aug 4, 2005
22
US
I am having a problem with my stored procedure. I am trying to get my database to sort the data in desc order using the date. I would like the most recent date to show first. When I use the code below, I get the following error: Error 156: Incorrect syntax near the keyword 'Order'. Thank you for your help in advance.


CREATE PROCEDURE [dbo].[update_tblevent]

( @eventid_1 int,
@event_3 varchar(255),
@date_4 datetime)

AS UPDATE [rrevent].[dbo].[tblevent]

SET
[event] = @event_3,
[date] = @date_4

WHERE
( [eventid] = @eventid_1 )

Order by [date] desc

 
you don't use order by in update statements

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top