evaluating statement within a parameter for stored procedure
am 03.04.2008 20:30:50 von bucky3
Is is possible to do something like this? (I don't know what the
proper terminology is... evaluating statement inline??)
exec pr_foo @param = 'a' + 'b'
exec pr_foo @param = getdate()
I wasn't able to get this to work. I know I can use a local variable
do all the manipulation, then pass the local variable, but I was
wondering if there was a way to do it inline.
Re: evaluating statement within a parameter for stored procedure
am 03.04.2008 23:29:24 von Erland Sommarskog
bucky3 (bucky3@mail.com) writes:
> Is is possible to do something like this? (I don't know what the
> proper terminology is... evaluating statement inline??)
>
> exec pr_foo @param = 'a' + 'b'
> exec pr_foo @param = getdate()
>
> I wasn't able to get this to work. I know I can use a local variable
> do all the manipulation, then pass the local variable, but I was
> wondering if there was a way to do it inline.
No, you cannot pass expressions as actual parameters in T-SQL. Only
constants and variables.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx
Re: evaluating statement within a parameter for stored procedure
am 04.04.2008 01:05:07 von bucky3
On Apr 3, 1:29 pm, Erland Sommarskog wrote:
> No, you cannot pass expressions as actual parameters in T-SQL. Only
> constants and variables.
OK thanks.