473,698 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL 2000 Trigger Question

1 New Member
Hello all,

I have a database question for you. I have a table in SQL 2000 that I think I need a trigger for. I'm tring to get the trigger to take the last two numbers from one field and replace the number in another field on the same table, see my example that follows:


Before Trigger

Table: Job
J_User1: 0122567801
J_JobType: 20

I would like to take the last two numbers fromt he J_User1 field on the Job table and replace the numbers on the J_JobType



After Trigger

Table: Job
J_User1: 0122567801
J_JobType: 01

Any help would be great.

Andy
Aug 30 '07 #1
1 1216
ck9663
2,878 Recognized Expert Specialist
Hello all,

I have a database question for you. I have a table in SQL 2000 that I think I need a trigger for. I'm tring to get the trigger to take the last two numbers from one field and replace the number in another field on the same table, see my example that follows:


Before Trigger

Table: Job
J_User1: 0122567801
J_JobType: 20

I would like to take the last two numbers fromt he J_User1 field on the Job table and replace the numbers on the J_JobType



After Trigger

Table: Job
J_User1: 0122567801
J_JobType: 01

Any help would be great.

Andy

can't it be handled by DEFAULT? or you may define J_JobType as calculated field and store the last two digit of the J-JUser1.

of course, trigger may still handle this. grab all values from the inserted table, force an insert with J_JobType field will contain the desired expression..che ck for error, otherwise, commit
Aug 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
8023
by: Fernand St-Georges | last post by:
Hi, can someone tell how to write a Trigger; I am familiar with Sybase Sql Anywhere trigger syntax. Actually I have three tables MEMBER, CONTRACT and PAYMENT I need to update the MEMBER.BALANCE once the PAYMENT.AMOUNT is INSERTED where PAYEMENT.CONTRAC_ID = CONTRACT.CONTRAC_ID and CONTRAT.MEMBER_ID = MEMBRE.MEMBER_ID I have more TRIGGERS to write, but with a good example it would be great
2
10631
by: M Wells | last post by:
Hi All, I'm a relatively newbie to SQL Server 2000, having come from a MySQL background. I'm creating my first Trigger statement on a table, and I'd like to know how I go about performing an update on the row that was changed when the trigger was fired. To explain, I have 2 columns, one which contains a member number, the
3
16334
by: JB | last post by:
To anyone that is able to help.... What I am trying to do is this. I have two tables (Orders, and OrderDetails), and my question is on the order details. I would like to set up a stored procedure that essentially inserts in the orders table the mail order, and then insert multiple orderdetails within the same transaction. I also need to do this via SQL 2000. Right now i have "x" amount of variables for all columns in my orders tables,...
5
3532
by: Neil Rutherford | last post by:
During testing of an application, i noticed a difference between SQL 2000 and SQL 7, both with identical config. In a nutshell: A table has a trigger for UPDATE and DELETE. When a column in the table is UPDATED the following happens: In autocommit mode, when entering a trigger the trancount equals 1 for both SQL 7 and 2000.
3
1310
by: jabailo | last post by:
Can a SQL 2000 server raise a .NET event? -- Texeme Textcasting Technology http://www.texeme.com
2
1876
by: Brian Salentine | last post by:
Hi - We have two SQL 2000 Servers. We have the linked server setup and we can perform updates and inserts between the databases. But when we add a trigger and insert something into a table, the database hangs. There are NO processes blocking or being block in either database. This ONLY occurs when we have one OS as Windows 2000 Server and the other OS as Windows 2003 Server. This problem does not occur when both servers are Windows...
2
4264
by: tolcis | last post by:
I have a trigger that should be execute on each row insert and only if appcode = 'I' and datasent = 0. It should execute a DTS package. The DTS package by itself runs about 6 seconds. Trigger was created successfuly. When I try to insert a row my db hangs. I can see that SPID on my db is hang by SPID from master db. It doesn't complete until I kill that SPID. Why is that? This is the trigger that I am trying to execute: CREATE...
1
4142
by: FBU | last post by:
Hallo to everybody, I'm newbie of access 2000, I always used Mysql. Now I have to make a trigger on a db of access 2000. It should work like this, when I insert a new record in table A the trigger have to insert other prefixed records in table B. How can I insert this trigger in Access 2000? Thank you very much for your help FBU
1
1527
by: pallavikiran | last post by:
I am using a trigger on a table in SQL SERVER 2000. When the trigger fires I need it to execute a Stored Procedure in SQL EXPRESS 2005. I tried to do that by creating a linked server from sql 2000 to slq express.But its not linking properly.Both SQL 2000 and SQL EXPRESS 2005 are on the same machine.Can any one please send me the solution.Thanks in advance.
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.