I have a column which looks like
Quarter
-------
Q1 2012
Q2 2012
Q1 2013
and I want
Quarter
-------
Q1
Q2
Q1
Here's what I've come with:
UPDATE TABLE [WA Products Sales].[dbo].[WA_Sales_Products]
SET
Quarter = REPLACE (Quarter, SUBSTRING(Quarter, 1, CHARINDEX(' ', Quarter)-1)
Which returns
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'TABLE'.
Any help would be appreciated.
TABLEkeyword is needed? Are the brackets [] correct?Quarter = SUBSTRING(Quarter, 1, CHARINDEX(' ', Quarter)-1)Quarter = SUBSTRING(Quarter, 1, CHARINDEX(' ', Quarter)-1)producesMsg 537, Level 16, State 2, Line 6 Invalid length parameter passed to the LEFT or SUBSTRING function.