sql - What is wrong with the syntax on this case statement? -


i trying insert values temp table via cursor , if have period on end, remove period. here code having syntax issues with.

while @@fetch_status = 0 begin     case select charindex('.',reverse(@category))           when 1         insert #category values (substring(@category,1,len(@category)-1))) end; 

what doing incorrectly here? i'm open more efficient answers know how solve way.

case yields expression, not statement. looking if statement.

as better way this: scrap cursor , use insert ... select ... charindex('.', reverse(category)) = 1 statement.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -