Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6097277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:01:30+00:00 2026-05-23T13:01:30+00:00

The stored procedure below isn’t catching the proper conditions. If I submit both images,

  • 0

The stored procedure below isn’t catching the proper conditions. If I submit both images, it writes both images properly. If I upload 1 image and leave one blank, it saves the blank as null overwriting the existing data. And finally, if I leave both blank, it saves both blank overwriting the existing data. Any help would be great. Thanks.

STORED PROC

ALTER PROCEDURE fstage.spUpdateCMSTrendLanding

(
@TrendLandingText nvarchar(max),
@TrendGuideLandingImage1 nvarchar(max),
@TrendGuideLandingImage2 nvarchar(max)

)

AS
BEGIN

SET NOCOUNT ON;

IF @TrendGuideLandingImage1 IS NULL AND @TrendGuideLandingImage2 IS NULL
    BEGIN
        UPDATE fstage.staticCMS SET TrendGuideLanding = @TrendLandingText;
    END

If (@TrendGuideLandingImage1 IS NOT NULL) AND (@TrendGuideLandingImage2 IS NOT NULL) 
    BEGIN
        UPDATE fstage.staticCMS SET TrendGuideLanding = @TrendLandingText, TrendGuideLandingImage1=@TrendGuideLandingImage1, TrendGuideLandingImage2=@TrendGuideLandingImage2;
    END

If (@TrendGuideLandingImage1 IS NOT NULL) AND (@TrendGuideLandingImage2 IS NULL)
    BEGIN
        UPDATE fstage.staticCMS SET TrendGuideLanding = @TrendLandingText, TrendGuideLandingImage1=@TrendGuideLandingImage1;
    END

If (@TrendGuideLandingImage2 IS NOT NULL) AND (@TrendGuideLandingImage1 IS NULL)
    BEGIN
        UPDATE fstage.staticCMS SET TrendGuideLanding = @TrendLandingText, TrendGuideLandingImage2=@TrendGuideLandingImage2;
    END

END
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:01:31+00:00Added an answer on May 23, 2026 at 1:01 pm

    Your NULLs are empty strings. Not database NULL values. Empty string is a value.

    This means the code always uses the same condition

    Add this at the top of the proc:

    SELECT 
      @TrendGuideLandingImage1 = NULLIF(@TrendGuideLandingImage1, ''),
      @TrendGuideLandingImage2 = NULLIF(@TrendGuideLandingImage2, '')
    

    Or add defaults and don’t set the parameter in client code

    ALTER PROCEDURE fstage.spUpdateCMSTrendLanding
        @TrendLandingText nvarchar(max),
        @TrendGuideLandingImage1 nvarchar(max) = NULL,
        @TrendGuideLandingImage2 nvarchar(max) = NULL
    AS
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the below Stored procedure, i am returning a row if all the conditions
I am using the stored procedure below for the select command of a SqlDataSource,
I am trying to establish upper / lower bound in my stored procedure below
my stored procedure is like below, select T.TranNo,(Select Accountname from Accountable where AccountCode =T.tranAccountCode)
I have got the below stored procedure to return the list of Id, parentId
I am having the below statement from stored procedure. It's giving Insufficient Privileges. But
When making an HttpWebRequest within a CLR stored procedure (as per the code below),
I have ADO.Net code as below, that calls a stored procedure. Within the stored
I have a question about stored procedures in Oracle. Below is the stored procedure
Does anybody know how to do this syntax below in mysql? Without Stored Procedure,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.