IF UPDATE(@column_name)
am 03.08.2007 18:44:41 von Ben Wrigley
I would like to know if it is possible to use a variable to use with
the IF UPDATE(column) statement. Only, the column should be a variable
[e.g. IF UPDATE(@column_name)] which should be substituted at run-time
with the real column name.
TIA
Re: IF UPDATE(@column_name)
am 03.08.2007 20:58:33 von Hugo Kornelis
On Fri, 03 Aug 2007 09:44:41 -0700, ben@jammin.co.uk wrote:
>I would like to know if it is possible to use a variable to use with
>the IF UPDATE(column) statement. Only, the column should be a variable
>[e.g. IF UPDATE(@column_name)] which should be substituted at run-time
>with the real column name.
>
>TIA
Hi ben,
That's not possible. You might want to look at COLUMNS_UPDATED()
function instead.
Or better yet, explain here what you're trying to do and why you think
that a dynamic IF UPDATE(xxx) would help you. There's a good chance that
there's a better way to do it!
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Re: IF UPDATE(@column_name)
am 03.08.2007 21:00:31 von David Portas
wrote in message
news:1186159481.367058.24370@o61g2000hsh.googlegroups.com...
>I would like to know if it is possible to use a variable to use with
> the IF UPDATE(column) statement. Only, the column should be a variable
> [e.g. IF UPDATE(@column_name)] which should be substituted at run-time
> with the real column name.
>
> TIA
>
Not possible. UPDATE() can only ever refer to one table. Why wouldn't you
know the names of the columns in your table?
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).as px
--