I also too the function route
create function uf_mixed (@p_col varchar(max))
returns varchar(max)
as
begin
declare @lgth int, @ctr int, @found varchar(1), @v_col varchar(max), @nxt int
select @lgth = LEN(@p_col), @ctr = 1, @found = 'x', @nxt = 0
if @lgth > 0
begin
select @v_col = upper(SUBSTRING(@p_col,1,1))
select @ctr = @ctr + 1
while (@ctr <= @lgth)
begin
select @found = SUBSTRING(@p_col,@ctr,1)
if @found = ' ' select @nxt = @ctr+1
if @nxt = @ctr
select @v_col = @v_col + upper(SUBSTRING(@p_col,@ctr,1))
else
select @v_col = @v_col + lower(SUBSTRING(@p_col,@ctr,1))
select @ctr = @ctr + 1
end
end
return(@v_col)
end
go
update Import_Data_Filter set Location = dbo.uf_mixed(Location)