I was trying to alter an example and can't seem to get past a problem decaring a new variable.
I created a table in Tempdb to mess with.
Use tempdb
Create Table Test
(
OfferID VarChar(10),
OfferName VarChar(12),
IsActive int
)
Insert Into Test Values('Offer01','March',0)
Insert Into Test Values('Offer02','April',0)
Insert Into Test Values('Offer03','May',1)
Thanks
John Fuhrman
Code:
Update Test
Declare @Next Int
Set @Next = dbo.fnGetNumbers(OfferID)+1;
Set OfferID = 'Offer' + 1
Where OfferID = (Select Max(dbo.fnGetNumbers(OfferID)) from Test)
Result:
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'Declare'.
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near '='.
I created a table in Tempdb to mess with.
Use tempdb
Create Table Test
(
OfferID VarChar(10),
OfferName VarChar(12),
IsActive int
)
Insert Into Test Values('Offer01','March',0)
Insert Into Test Values('Offer02','April',0)
Insert Into Test Values('Offer03','May',1)
Thanks
John Fuhrman