how use replace in exec statement in sql server 2008

wowone

New Member
I have a stored proc, say, "call_Me" with few parameters:\[code\]Declare @Greet varchar(100) = 'Hi ||User||'Exec Call_Me 1,'something', @Greet --parameters: bit, string, string\[/code\]during the call, I want to be able to replace the \[code\]||User||\[/code\]bit with something else. normally, in a select statement, I would do this: \[code\]select 1, 'something', Replace(@Greet, '||User||', u.Username) from UserTable\[/code\]which works fine, But today, for the first time, I am trying to use it in exec statement, the error says its expecting select, I tried adding select in every possible (and sensible) way but it just didnt seem to work out.How can I use a replace during an execute statement call?Many thanks in advance!
 
Top