NewbiDoobie
Technical User
I am trying to do something I am not sure can even be done.
I have code which may contain several abbreviations and I need to update it with the correct description from an abbreviations table.
This is the type: W/ oop
W/o oop
Abbreviations table contains these abbreviations:
Abbr Def
W/ With
W/O Without
oop optional oil pan
I need to update the W/ oop = With optional oil pan and the W/o oop = Without optional oil pan.
Here is the code I am trying but I am getting:
Incorrect syntax near 'replace'.
I have code which may contain several abbreviations and I need to update it with the correct description from an abbreviations table.
This is the type: W/ oop
W/o oop
Abbreviations table contains these abbreviations:
Abbr Def
W/ With
W/O Without
oop optional oil pan
I need to update the W/ oop = With optional oil pan and the W/o oop = Without optional oil pan.
Here is the code I am trying but I am getting:
Incorrect syntax near 'replace'.
Code:
declare @rec int,
@type varchar(30),
@Abbr varchar (2),
@Def varchar(60)
declare Repl cursor for select recno, type from dbo.X_OILCAP where type is not null and recno = 90
open Repl
fetch next from Repl into @rec, @type
while @@fetch_status = o
begin
declare replacer cursor for select ABREVIATIO,DEFINITION from AccessSpecs.dbo.ABBR
open relacer
fetch next from replacer into @abbr, @def
while @@fetch_status = 0
begin
replace(@type, @Abbr, @def)
print @type
fetch next from replacer into @abbr, @def
end
deallocate replacer
fetch next from Repl into @rec, @type
end
deallocate Repl