I'm passing myVariable into a stored procedure. Inside my stored procedure I want to store myVariable into MyTable.myField. MyTable.myField has a default value. If myVariable is null, I want to use myField's DEFAULT value. The following code doesn't work
What's the correct syntax to store myVariable (OR myField's default value if myVariable is null) into MyTable.myField? Thanks, and have a great day?
Code:
UPDATE MyTable SET myField = ISNULL(myVariable, DEFAULT) WHERE myID = 1