execute w/triggers returning 0 rows



I added some triggers to an existing SQL Server database. I noticed in testing the triggers using their ad hoc query tool that inserting a row (thus triggering other insertions) would print out:

	(0 row(s) affected)

	(1 row(s) affected)

	(1 row(s) affected)

OK, that was interesting. Then I ran my Perl program and inserted a row. The program was working fine before the triggers. Suddenly it kept telling me that the insertion wasn't returning the right number of rows. This was my own error message:

	unless ($stmt->execute == 1) {
	    Log->Warn('Insertion of item returned ', $rows, ' rows');
	}

I added some code in the unless statement body to double-check: was the row really inserted? This involved checking for the inserted row using a select statement. The row was actually there. Whaddyaknow.

So I'm wondering if SQL Server returns multiple row counts in this type of situation or just the first one. And if the former, whether ODBC understands that. And if so, whether the DBD::ODBC driver understands that. And if so, how would I get the program to understand?

But I'm probably barking up the wrong tree. Some silly misunderstanding on my part. Like the trigger should be returning a value and (d'oh!) it's not.

Which documentation didn't I read?

mma

===========================================================

The usual details:

Windows 2000
SP 4 (?)
------------------
SQL Server 7
------------------
This is perl, v5.8.4 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

Binary build 810 provided by ActiveState Corp. http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jun  1 2004 11:52:21
------------------
    Name: DBI
 Version: 1.45
  Author: Tim Bunce (dbi-users@xxxxxxxx)
   Title: DBI
Abstract: Database independent interface for Perl
Available Platforms:
       1. MSWin32-x86-multi-thread-5.8
----------------------------------------------------------
    Name: DBD-ODBC
 Version: 1.11
  Author: Jeff Urlwin (jurlwin@xxxxxxx)
   Title: DBD-ODBC
Abstract: ODBC Driver for DBI
InstDate:  14:42:55 2004
Location:
http://ppm.ActiveState.com/cgibin/PPM/ppmserver-5.8-windows.pl?urn:/PPMServe
r
Available Platforms:
       1. MSWin32-x86-multi-thread-5.8


.



Relevant Pages

  • Re: New to SQL server
    ... it is called triggers. ... ANYTHING THAT YOU CAN DO IN JET IS BABY TALK COMPARED TO WHAT WE CAN DO ... anything that you can do in JET that I can't do in SQL Server ... self-referencing FKs and inline constraints. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: 2010: Essential Diffs?
    ... the view in SQL server is the same thing as a saved select query in access. ... The reason why we don't call them views in Access is because saved queries can also be update queries, delete queries, append queries etc. So using the term "view" has nothing to do with the new JET table engine level triggers. ... Stored procedures don't necessarily mean that they can return tables as data. ... Keep in mind also that these triggers have to be able to run even if VBA or ms access is not installed on your computer. ...
    (comp.databases.ms-access)
  • Re: The data was added to the database but the data wont be displayed
    ... replication with queued updates (SQL Server 2005), ... When inserting records into a Microsoft SQL Server database from an ... Microsoft Access tries to reselect the newly inserted record to ... subscriber) are SQL Server 2000. ...
    (microsoft.public.access.adp.sqlserver)
  • Default values not being applied on insert in SQL 2005 virtual server
    ... Frank,First of all, SQL Server would throw an error if you explicitely inserta ... However, omitting the column when inserting, or inserting DEFAULT will ... I though maybe a trigger, but i want it to be as fast as possible and i am ...
    (microsoft.public.sqlserver.programming)
  • Re: SQL Server Express versus Access (In the World Series of Love)
    ... As far as the triggers are concerned, the first case is something to avoid ... have their usefulness, for updateability, but Jet has already updateability ... OF triggers to achieve the same, say, over view, so, advantage to Jet. ... MS SQL Server may have a horse shoe maker right out of the box, ...
    (microsoft.public.access.modulesdaovba)