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

  • Home
  • SEARCH
  • 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 4591312
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:22:35+00:00 2026-05-21T22:22:35+00:00

I am building a trigger to do some calculations for me. However, I am

  • 0

I am building a trigger to do some calculations for me. However, I am just writing the commands to see if they work for right now and produce error handling. So I have written the following code.

DECLARE @strTotalAssets varchar(8000)

SELECT @strTotalAssets = (SELECT ProjectOther2 FROM
            Project WHERE ProjectID = '00000:')

SELECT 
    CASE
      WHEN RIGHT(value, 1) = 'M' THEN LEFT(value, (LEN(value)-1)) * 1000000
      WHEN RIGHT(value, 1) = 'T' THEN LEFT(value, (LEN(value)-1)) * 1000
      WHEN RIGHT(value, 1) > 0 THEN RETURN 'Error: You forgot to put a mutliplier Value'
      ELSE 'Error'
    END
FROM Split(@strTotalAssets, '|')

The problem I have is that I do not know how to exit the script and return an error. Forgive my ignorance but just starting out at a jr DBA. Hopefully from the code you can see what I am trying to do. Basically if the user forgot to put a letter value which represents a multiplier of Thousands or Millions which means the value returns only an integer then produce an error and tell the user they forgot to put a value.

  • 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-21T22:22:36+00:00Added an answer on May 21, 2026 at 10:22 pm

    You’re looking for GOTO Error. Here’s a quick primer. I only skimmed it quickly, but it looked pretty good for what you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just looking for some opinions/ideas on how best to do this. I'm building an
I have a WSDL which I need to trigger some commands from. I need
Building the same project (without any changes) produces binary different exe-files: some small regions
When building some of my PHP apps, a lot of the functionality could be
I'm building a game that got some moving things all the time, so I'm
I am building this app and I am encountering some issues I haven't seen
I was building a simple carousel list for learning purpose. In some carousel samples,
I want to trigger some code whenever I push out a new version of
Building on How Do You Express Binary Literals in Python , I was thinking
Building a client-side swing application what should be notified on a bus (application-wide message

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.