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 6238651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:15:09+00:00 2026-05-24T11:15:09+00:00

I`m not a SQL programmer, but I have encountered an obstacle during my project

  • 0

I`m not a SQL programmer, but I have encountered an obstacle during my project and have to construct a trigger, which will fire after insert command. The problem is as follows:

I have 3 tables:

dbo. Build

id   (PK, int, not null)
date (smalldatetime, not null)


dbo.TestCase

id   (PK, int, not null)
Name (nvarchar(200), not null)


dbo.TestCaseExecution

id              (PK, int, not null)
build_id        (FK, int, not null)
testcase_id     (FK, int, not null)
passed          (int, null)            //1 or 0
executed        (int, null)            //1 or 0
duration        (real, null)
fail_percentage (real, null)           //null

now, I read data from .xml files and add the data to database via project written in C#. After each build I have to update the database and count fail_percentage for each test basing on ‘passed’ and ‘executed’ values.

fail_percentage = (100)*(1 - (PassNumber/ExecutionNumber))

so I need a trigger, which will:
1. fire after insert command
2. count fail_percentage basing on earlier values e.g.

after reading from file:

id  build_id  testcase_id  passed  executed  duration  fail_percentage
1   1         001          1       1         12:09     null

after trigger:

id  build_id  testcase_id  passed  executed  duration  fail_percentage
1   1         001          1       1         12:09     0

after reading from file:
id  build_id  testcase_id  passed  executed  duration  fail_percentage
1   1         001          1       1         12:09     0
2   2         001          0       1         12:32     null

after trigger:
id  build_id  testcase_id  passed  executed  duration  fail_percentage
1   1         001          1       1         12:09     0
2   2         001          0       1         12:32     50

could anyone give me a hand ?

Thanks in advance,
Artur

  • 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-24T11:15:10+00:00Added an answer on May 24, 2026 at 11:15 am

    ok

    I did it without using triggers, inside my application I store all the needed data in a dictionary:

    • test name as a key value
    • pass value and executed value as a values

    then I count percentage and insert it to the database.

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

Sidebar

Related Questions

I'm not a good SQL programmer, I've got only the basics, but I've heard
(Note: This is for MySQL's SQL, not SQL Server.) I have a database column
SQL is not my forte, but I'm working on it - thank you for
The following PL/SQL will not execute and simply returns 'Invalid Argument' as an error.
Hey...I am in a bind here. I am not much of a programmer but
Using NHibernate from C# and only HQL (not SQL) in a way that is
I usually do not use Sql Server Management Studio, I usually use Linqpad to
I'm trying to perform a bitwise NOT in SQL Server. I'd like to do
I am a beginner SQL user (not formally trained; OJT only) and need some
When I call a Linq (not Linq-for-SQL, just simple in-memory Linq) - what locale

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.