473,666 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with trigger

Im having problems with an after insert trigger...

Im trying to join the INSERTED table with other tables to retrieve
data....Some of these tables it must link to get data inserted into
them at the same time my original table does...my question is why when
the trigger runs, my sql statement gets no data...however afterwards if
I run the statement and use the primary key that was just inserted, the
statement brings up data?..

I hope I was clear enough..

-Jim

Dec 21 '06 #1
1 1149
On 21 Dec 2006 09:26:27 -0800, Jimbo wrote:
>Im having problems with an after insert trigger...

Im trying to join the INSERTED table with other tables to retrieve
data....Some of these tables it must link to get data inserted into
them at the same time my original table does...my question is why when
the trigger runs, my sql statement gets no data...however afterwards if
I run the statement and use the primary key that was just inserted, the
statement brings up data?..

I hope I was clear enough..
Hi Jim,

No, you were not.

Please post CREATE TABLE statements to reproduce your tables (you may
omit irrelevant columns, but please do include all keys, properties, and
indexes), the CREATE TRIGGER statement with your current, non-working
trigger code, some INSERT statements with sample data, the expecte
results and the results yoou are actuallly seeing. That allows us to
reproduce your problem by cut and paste, and to test if our suggestions
match the desired resuls.

--
Hugo Kornelis, SQL Server MVP
Dec 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4171
by: Dunc | last post by:
I'm new to Postgres, and getting nowhere with a PL/Perl trigger that I'm trying to write - hopefully, someone can give me some insight into what I'm doing wrong. My trigger is designed to reformat / standardize phone numbers and it looks like this: CREATE or REPLACE FUNCTION fixphone() RETURNS trigger AS $$ $number .= $_TD->{new}{phone}; $number =~ s/(-|\.|\(|\)| )//g; $number .= substr($number,0,3) . "." .
4
14240
by: Hank | last post by:
I have two SQL Server 2000 machines (server_A and server_B). I've used sp_addlinkedserver to link them both, the link seems to behave fine. I can execute remote queries and do all types of neat things from one while logged onto the other. I'm working on a project to keep the data in the two systems synchronized, so I'm using triggers on both sides to update each other. For testing, I've created a simple, one-column table on both...
1
1954
by: BUSHII | last post by:
I have little problem and I dont have any idea how to make my trigger. I have table MyTable where I have many column with almost same name and same type (Grp1,Grp2,Grp3,Grp4...Grp50 char(1)). I`d like to make some trigger on UPDATE this table. I must to check which column was changed. For example to check if Grp1 was changed I can try this: ALTER TRIGGER MyTrigger
4
3831
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following beautiful script "http://javascript.internet.com/navigation/toolbar-menu.html". It works like a charm. I made my webpage in frames, where the nav-frame shows the menubar, so whenever I click a link in the menubar, it opens in the frame below. But...
2
2835
by: gustavo_randich | last post by:
Hi :-) I'm porting a project from Oracle to DB2 and now I'm trying to avoid error SQL0746N in a trigger which reads the same table in which the trigger is defined. Below is Oracle's workaround for this problem (Oracle raises a similar error when trying to do this). It uses a package to temporarily store affected rows in a BEFORE trigger for later processing in an AFTER trigger. Is there a functionality in DB2 similar to Oracle's...
4
1955
by: SUKRU | last post by:
Hello everybody. Unfortunately I am pretty new to sql-server 2000 I need some help with a Trigger I created. I created a trigger witch takes the id of the affected row and does a update on a other table with that ID. The trigger works fine with one affected row. But when there are more then one rows affected, i get an error. I found out that SQL-server does not support row-level triggers. I should probable make my own cursor and...
2
4967
by: mob1012 via DBMonster.com | last post by:
Hi All, I wrote last week about a trigger problem I was having. I want a trigger to produce a unique id to be used as a primary key for my table. I used the advice I received, but the trigger is still not working correctly. Here is my code: create trigger emp_update_id BEFORE update on emp_update REFERENCING NEW AS N for each row SET unique_id = Generate_unique();
2
2392
by: dean.cochrane | last post by:
I have inherited a large application. I have a table which contains a hierarchy, like this CREATE TABLE sample_table( sample_id int NOT NULL parent_sample_id int NOT NULL ....lots of other cols...) DELETEs on all tables are handled by the front end code, which just
3
1874
by: anuja pokharel | last post by:
hello, i have a problem in trigger. My trigger is CREATE OR REPLACE TRIGGER duplicate_deptno BEFORE INSERT OR UPDATE OF deptno ON DEPT1 REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE x NUMBER ;
11
4070
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved, CrtdUser and Date And Edit and Delete buttons
0
8445
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
8356
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,...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
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
4198
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...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
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.