(gr*********@yahoo.com) writes:
But I forgot to say that I have more than 1 parameter to pass in this
SQL statement.
@parm1,
@parm2,
@parm3
update table1
set field1=getdate() ,
field2=parm2,
field3=parm3,
if @param1=3
If I take a complete guess what you might be thinking, this could be what
you are looking for:
UPDATE tbl
SET field1 = getdate()
WHERE field2 = CASE @param1 WHEN 2 THEN @param2 ELSE field2 END
AND field3 = CASE @param1 WHEN 3 THEN @param3 ELSE field3 END
Look up the CASE expression in Books Online to understand what is going
on here.
If this does not help, please post:
o CREATE TABLE statement for your table.
o INSERT statements with sample data.
o The desired result given the sample.
o A short description of the underlying problem you are trying to solve.
--
Erland Sommarskog, SQL Server MVP,
es****@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp