December 29, 2012 at 3:04 pm
ALTER TABLE TRIPS
RENAME COLUMN CODE TO AREA;
I receive this error "INCORRECT SYNTAX NEAR RENAME" RENAME HAS A RED LINE UNDER IT, I AM USING SQL EXPRESS 2008.
THANKS
December 29, 2012 at 3:17 pm
Try:
EXEC sp_rename 'Trips.Code', 'Area', 'COLUMN'
December 29, 2012 at 5:24 pm
UPDATE TRP_STATS
SET TRIP_ID = TRIP,
FROM TRP_STATS JOIN TRP_DETAILS
ON TRP_STATS.TRP = TRP_DETAILS.TRP;
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'FROM'.
I get these error about all the time what am I doing worng?
Thanks
December 29, 2012 at 5:37 pm
lonhanner (12/29/2012)
UPDATE TRP_STATSSET TRIP_ID = TRIP,
FROM TRP_STATS JOIN TRP_DETAILS
ON TRP_STATS.TRP = TRP_DETAILS.TRP;
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'FROM'.
I get these error about all the time what am I doing worng?
Thanks
Review your aliasing.
Update TRPS
set TRIP_ID = TRPD.TRIP_ID
from TRP_STATS TRPS
INNER JOIN TRP_DETAILS TRPD on TRPS.TRP = TRPD.TRP
Assuming you want to update stats with the TRIP_ID from TRP_DETAILS
December 29, 2012 at 5:37 pm
lonhanner (12/29/2012)
UPDATE TRP_STATSSET TRIP_ID = TRIP[font="Arial Black"], <----<<<< MUST LOOK EYE![/font] 😛
FROM TRP_STATS JOIN TRP_DETAILS
ON TRP_STATS.TRP = TRP_DETAILS.TRP;
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'FROM'.
I get these error about all the time what am I doing worng?
Thanks
--Jeff Moden
Change is inevitable... Change for the better is not.
December 29, 2012 at 5:41 pm
and that's what I get for reading too quickly.
December 29, 2012 at 5:55 pm
JeffRush (12/29/2012)
and that's what I get for reading too quickly.
Actually, the OP should look your post over again, and again, and again. Too many people make the mistake of not aliasing properly. Your post is a healthy reminder. Well done.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 29, 2012 at 6:04 pm
Thanks.
All the aliasing in the world doesn't save you from an errant comma though. 🙂
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply