select @mystring=REPLACE(@mystring,name,value) from @tab
We don't sort tables. The entire relational world is based on the concept that absolutely no assumptions can ever be made on the physical order of rows in a table. Among other advantages, this frees RDBMS systems to place physical rows however it needs them. So "sort a table" is meaningless. We only sort result sets.
If you want an action to apply to one particular row, you must clearly identify that row. In this simple case, you can change your statement to:
select @mystring=REPLACE(@mystring,name,value) from @tab where name = @mystring
But your statement is more complex than it needs to be. Why do you even need the REPLACE?
select @mystring=value from @tab where name = @mystring
TommCatt
In theory, there is no difference between theory and practice. In practice, there is.