dbTalk Databases Forums  

IF UPDATE(@column_name)

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss IF UPDATE(@column_name) in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ben@jammin.co.uk
 
Posts: n/a

Default IF UPDATE(@column_name) - 08-03-2007 , 11:44 AM






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


Reply With Quote
  #2  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: IF UPDATE(@column_name) - 08-03-2007 , 01:58 PM






On Fri, 03 Aug 2007 09:44:41 -0700, ben (AT) jammin (DOT) co.uk wrote:

Quote:
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


Reply With Quote
  #3  
Old   
David Portas
 
Posts: n/a

Default Re: IF UPDATE(@column_name) - 08-03-2007 , 02:00 PM



<ben (AT) jammin (DOT) co.uk> wrote

Quote:
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/m...S,SQL.90).aspx
--




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.