Firing Triggers Within DTS

Jul 27, 2001

My working environment exist of Win 2000 advance server w/service pack 1 and
SQL 2000 Enterprise no service pack applied.

I created trigger on INSERT table "A" which have to insert record
into table "B". The trigger fired when records inserted by insert statement from Query Analyzer. But the trigger doesn't s not fired if I moved records from text file into table "A" using DTS Import/Export Wizard.

How can I make it work.

Thank you.

View 1 Replies


ADVERTISEMENT

Trigger Firing And Not Firing

Aug 27, 2004

I have a trigger on a table that just updates a last_modified_date and this works fine on our production server. Now I have to update some data and I do not want the trigger to fire. I cannot disable or drop the trigger because the productions systems needs the trigger. Anyone an idea of how to solve this problem?

View 6 Replies View Related

Multiple Triggers On A Table Or Encapsulated Triggers

May 12, 2008

This isn€™t an problem as such, it€™s more of a debate.

If a table needs a number of update triggers which do differing tasks, should these triggers be separated out or encapsulated into one all encompassing trigger. Speaking in terms of performance, it doesn€™t make much of an improvement doing either depending upon the tasks performed. I was wondering in terms of maintenance and best practice etc. My view is that if the triggers do totally differing tasks they should be a trigger each on their own.

www.handleysonline.com

View 12 Replies View Related

Delete SP Not Firing?

May 23, 2007

 I cannot get this event to fire. I am using TextBox9 to see if statements are processed and it never fills so it appears the Button4_Click never happens.  Any ideas?
Thank you, 
<asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="Delete Submission" /> protected void Button4_Click(object sender, EventArgs e)    {        string CompanyDeleteID = TextBox10.Text;        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["localhomeexpoConnectionString2"].ConnectionString);        SqlCommand cmd = new SqlCommand("DeleteSubmission", con);        cmd.CommandType = CommandType.StoredProcedure;        cmd.Parameters.AddWithValue("@C_ID", CompanyDeleteID);       TextBox9.Text = "SP completed";
    }
 
PROCEDURE dbo.DeleteSubmission @C_ID intASBEGIN DELETE  FROM tblCompanyInfo_Submit WHERE C_ID = @C_ID
 DELETE  FROM tblStoreStudioSubmit WHERE C_ID = @C_ID
 DELETE  FROM tblContractorSubmit WHERE C_ID = @C_ID RETURNENDWHERE CD_ID = @C_IDRETURN

View 11 Replies View Related

SQLdatasource Not Firing

Mar 19, 2008

I have a datasource on my page, not connected to anything. In the selected event, I have the following:protected void InitializedDatasource_Selected(object sender, SqlDataSourceStatusEventArgs e)
{int total = e.AffectedRows;
lblInitialized.Text = total.ToString();
}
Howevever, because it's not attached to a gridview or anything, it seems the selected event never fires. How would i get it to run on page load?

View 2 Replies View Related

Firing DTS Package From An ASP

Feb 8, 2001

Does anyone here know of a way to execute a DTS package from an ASP that works? I have been using a variation on Microsoft's example that has yet to work.

I know that this code is getting a handle to both the package object and the task object because it recognizes if I have them spelled incorrectly and gives me an error.

On the other hand when everything is correct it simply claims to execute but nothing really happens... My screen will read
Executing...
Done.

The script goes something like this, any suggestions?:

Const DTSReposFlag_Default = 0
Const DTSReposFlag_UseTrustedConnection = 256
Dim oPackage, strResult
Dim oPump
Set oPackage=Server.CreateObject("DTS.Package")
oPackage.LoadFromSQLServer "hoaorg10","","",DTSReposFlag_UseTrustedConnection ,"","","","DirCopy"
set oPump = oPackage.Tasks("Copy Data from Results to [lhr2000].[dbo].[Households] Task").CustomTask
oPump.SourceSQLStatement = "SELECT * FROM HOREFPA WHERE NEIGHBORHOOD = 'testnbhd'"
oPackage.Execute
Response.Write "Executing package...<BR>"
For i = 1 To oPackage.Steps.Count
If oPackage.Steps(i).ExecutionResult = DTSStepExecResult_Failure Then
oPackage.Steps(i).GetExecutionErrorInfo lpErrorCode
iStatus = False
strErr = oPackage.Steps(i).Name + " in the " + oPackage.Description + " failed.<BR>"
End If
Response.Write strResult
Next
If iStatus = True Then
strResult = oPackage.Description + " Successful<BR>"
Response.Write strResult
End If
Response.Write "Done.<BR>"

View 1 Replies View Related

Trigger Not FIRING With BCP

Jun 7, 1999

Hi,

Anyone got an idea why this does not work. I have a trigger that is supposed to fire as an INSERT is done on a table. If I manually insert (insert into....), the trigger fires. If I use BCP to insert, the trigger DOES NOT FIRE.....

Davy

View 1 Replies View Related

Trigger Not Firing

Dec 7, 2007

OK, I'm at a loss..it must be staring me right in the face.

I have a junction table that relates 2 tables, with a unique key of the composit of the 2 keys. There is also an indicator that says 1 relationship between the 2 tables is "primary" and there should only be one of those. So I figured a trigger to take care of it...but I can't seem to get it working...I wrote sample sql to mimic the inserted table as well, and it seems correct, but the trigger just does not fire.

Any ideas?


CREATE TABLE [dbo].[PIF_MEP99] (
[PIFRecID] [int] NOT NULL ,
[MEPRecID] [int] NOT NULL ,
[PrimaryInd] [char] (1) NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[PIF_MEP99] WITH NOCHECK ADD
CONSTRAINT [PIF_MEP99_PK] PRIMARY KEY CLUSTERED
(
[PIFRecID],
[MEPRecID]
) ON [PRIMARY]
GO

INSERT INTO PIF_MEP99(PIFRecID, MEPRecID, PrimaryInd)
SELECT 1,1,'Y' UNION ALL
SELECT 2,1,'N' UNION ALL
SELECT 3,2,'N'
GO

CREATE TRIGGER dbo_PIF_MEP99_tr_Rule1 ON dbo.PIF_MEP99
FOR UPDATE, DELETE
AS
SET NOCOUNT ON

-- Rule 1: Prevent and MEP from having more than 1 PIF as Primary

IF Exists ( SELECT * FROM inserted i
INNER JOIN PIF_MEP99 p
ON i.MEPRecID = p.MEPRecID
AND i.PrimaryInd = 'Y'
AND p.PrimaryInd = 'Y')
BEGIN
ROLLBACK TRAN
RAISERROR 500003 'Attempting to Insert 2 Primary PIFs for an MEP'
END
GO

SELECT * FROM PIF_MEP99
GO

SELECT * FROM (SELECT 4 AS PIFRecID,1 AS MEPRecID,'Y' AS PrimaryInd) AS i
INNER JOIN PIF_MEP p
ON i.MEPRecID = p.MEPRecID
AND i.PrimaryInd = 'Y'
AND p.PrimaryInd = 'Y'
GO

BEGIN TRAN
INSERT INTO PIF_MEP99 (PIFRecID, MEPRecID, PrimaryInd) SELECT 4,1,'Y'
COMMIT TRAN
GO

SELECT * FROM PIF_MEP99
GO

SELECT * FROM (SELECT 5 AS PIFRecID,1 AS MEPRecID,'Y' AS PrimaryInd) AS i
INNER JOIN PIF_MEP p
ON i.MEPRecID = p.MEPRecID
AND i.PrimaryInd = 'Y'
AND p.PrimaryInd = 'Y'
GO

DROP TABLE PIF_MEP99
GO




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam

View 3 Replies View Related

Mail Is Not Firing

Jun 24, 2008

I have a job that fires every 15 minutes. Job is working.
I looked in here
select * from msdb.dbo.sysmail_allitems
records are in here...

I looked in here and
select * from msdb.dbo.sysmail_log it says the database mail is
2008-06-24 14:46:10.997DatabaseMail process is started
2008-06-24 14:56:13.453DatabaseMail process is shutting down
Which it seems to do periodically ....through out the log

What starts up the process - to go run the email alerts.

View 11 Replies View Related

Trigger Not Firing

Mar 27, 2006



I have build a SQL Trigger that fires on the update of a specific column; this works perfectly when I test using SQL or even the SQL Server GUI but when I do the update from .NET it doesn€™t fire.

I have a dataset that gets modified and then I call sqlDataAdapter.Update(Dataset) - the row is successfully modified in the database but alas - the trigger isn't fired.

Any help would be appreciated.

View 2 Replies View Related

Trigger Not Firing ...

May 23, 2008

Afternoon All ...

I have a trigger on a table that works great when a single record is updated BUT it seems not to fire when I try to do a bulk update as in ...

update TableA

set field3 = ms.field3
FROM TableA as ta,
#ms as ms
where field1 = ms.field1
and field2 = ms.field2

Why does this happen and how can I correct it.

Thanks!

View 1 Replies View Related

SP Not Firing In Foreach Loop

Feb 28, 2008

The foreach loop below runs fine and it sends emails as expected but the SP does not update the Companies table.  Any thoughts?  How do I cause the SP to execute?  
 PROCEDURE newdawn.EmailSentDate      @CID intAS     UPDATE Companies      SET Companies.LastEmailDate = (GetDate())     WHERE tblCompanies.C_ID = @CID RETURN
foreach (GridViewRow row in GridView3.Rows)        {            pstrTo = row.Cells[2].Text;            CEmail = row.Cells[2].Text;            CName = row.Cells[3].Text;            CID = row.Cells[1].Text;            CState = TextBox1.Text;            CCity = row.Cells[5].Text;            CCat = row.Cells[4].Text;            CCID = row.Cells[0].Text;
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["localhomeexpoConnectionString2"].ConnectionString);            SqlCommand cmd = new SqlCommand("EmailSentDate", con);            cmd.CommandType = CommandType.StoredProcedure;            cmd.Parameters.AddWithValue("@CID", CCID);                                    try            {                System.String mailServerName = "mail.domain.com";
                               REST of code sends email to email address found in each row ....it all works find but SP above does not fire.
 

View 12 Replies View Related

Firing Already Made DTS Package -- From Vb.net

Apr 13, 2005

Someone please help me with this. 
I'm trying to fire off an already created DTS package.  This package is stored within SQL Server's -- underneith the Data Transformation Services / Local Packages section. 
HOW CAN I FIRE THIS OFF FROM A VB .NET APPLICATION
I'm familiar with strored procedures and using them in vb.net so if somone could lead me down that road I would be very much appriciated. 
Thanks in advance everyone,
RB

View 4 Replies View Related

Only One Of My SQL Delete Statement Are Firing

Mar 12, 2006

Hey guys...
I am trying to tidy up my code a bit and have one SQL command (Sub class) to call when needing to insert, update, delete and select.
I have got one class I am testing with that delete from a table support_ticket and then calls RunSQL() again to delete the corresponding tickets in Support_Reply.
however it only seems to want to delete from one table at a time...as i commented out the first sql and it worked and the second fires...but if the first one is active it doesnt fire.
Do anyone on the forum know why this has happened?
 
Sub DeleteUserTicket(sender as Object, e as EventArgs)
Dim strSQL1 = "DELETE FROM Support_Ticket WHERE (TicketID = " & txtticketID & ")"
RunSQL(strSQL1)
strSQL1 = "DELETE FROM Support_Reply WHERE (TicketID = " & txtticketID & ")"
RunSQL(strSQL1)
End Sub
'One class to run the sql statements for the entire page this will reduce in repetitve code as well as reduce code size
Sub RunSQL(strSQL)
Dim objCmd As SqlCommand
Dim sqlConn = New SqlConnection(strConn)
objCmd = New SQLCommand(strSQL, sqlConn)
objCmd.Connection.Open()
'Check that the rows can be deleted if not then return a error.
Try

objCmd.ExecuteNonQuery()
response.redirect("ticketsystemtest2.aspx")
Message.InnerHtml = "<b>Ticket " & txtticketID & " Closed</b> <br/>"
Catch ex As SqlException
If ex.Number = 2627 Then
Message.InnerHtml = "ERROR: A record already exists with " _
& "the same primary key"
Else

Message.InnerHtml = "ERROR: Could not update record, please " _
& "ensure the fields are correctly filled out <br>" & ex.Message & " " & ex.Number
Message.Style("color") = "red"
End If
End Try
objCmd.Connection.Close()
sqlConn = nothing
objcmd = nothing
End Sub
 
cheers

View 2 Replies View Related

Alert Deleted But Still Firing

Mar 28, 2006

I created an alert (18453) to audit successful logins. After I was done with the alert I made I edited the alert 18453 to disable event log logging and then deleted the alert. My problem is that the alert is deleted but it continues to log to the SQL Server error log and the windows application log. I have tried restarting the SQL Server Agent and even had the server rebooted over the weekend. Has anyone else had this problem? Where is this configured and how can I disable it?

View 2 Replies View Related

Trigger Not Firing, DTS Load

Nov 18, 2005

I have a table that is getting refreshed from DB2 using DTS (I believe the DBA is doing a DELETE and an APPEND). I have a trigger on this table ON APPEND, INSERT, but the trigger never fires. When I manually update the data, the trigger fires no problem...

Is DTS capable of updating a SQL Server table without firing the trigger?

I'm an Oracle guy, and this is my 1st experiences with SQL Server, so I'll put the code here and if you want to point out any bad practices (such as the way i converted the DB2 TIMESTAMP to a SQL Server DATETIME , please do.

FYI, the DB2 TIMESTAMP is getting loaded into the SQL Server table as a VARCHAR(26)
Carl

CREATE TRIGGER trig_SAWakeUp ON tsnro
FOR INSERT, UPDATE
AS
DECLARE @snro_stus char(10)
DECLARE @snp_sht_dtm as datetime
SELECT @snro_stus = snro_stus
FROM tsnro
IF (RTRIM(@snro_stus) = 'ASSIGNED') OR (RTRIM(@snro_stus) = 'REFRESHED')
BEGIN
SELECT @snp_sht_dtm = CONVERT(DATETIME, SUBSTRING(evt_dtm,1,19))
FROM tsnro

INSERT INTO TSNP_SHT_DTM (SNRO_STUS, SNP_SHT_DTM )
VALUES (@snro_stus, @snp_sht_dtm)
END
ELSE
BEGIN
INSERT INTO TSNP_SHT_DTM ( SNRO_STUS, SNP_SHT_DTM )
VALUES (@snro_stus, @snp_sht_dtm)
END

View 2 Replies View Related

Insert Trigger Sometimes Not Firing

Nov 29, 2006

hi all

i have an issue with an insert trigger sometimes not firing.

here is the trigger


CREATE TRIGGER Insert_tPABillToAddr ON [dbo].[tPA00175]
FOR INSERT
AS


INSERT into tPABillToAddr
(
chrJobNumber
)

SELECT chrJobNumber
FROM inserted



when the user enters a new this table is to insert one column into another table. the thing is, sometimes it does not do the insert. any ideas as to why? it is a very uncommon thing, lets say once out of every 20 inserts does it fail. but it is crucial that it never fails.

thanks

View 4 Replies View Related

Prevent Trigger From Firing

Jan 13, 2004

Hi,

I have an update tigger on one of my tables.
I want to fire an Update SQL but somehow prevent trigger from firing.

Any Ideas..

View 5 Replies View Related

Trigger Is Not Firing For Some Records

Jun 18, 2014

1) I have two tables , chat and country tables , chat table has 3 columns(chat_id,language,chat_info) and media table has 2 fields(chat_id ,country), chat table will store all countries data (India,china,taiwan)

2) chat_id,language will be populated by insert statement, and chat_info by update statement, i have a below after update trigger on chat table,which should verify country from media table and copy respective record from chat table to chat_country table (chat_in,chat_cn,chat_tw - these tables will have same structure as chat table)

3) this trigger is not firing for some of the records ,no clue or info for which it is missing some records.

create TRIGGER [dbo].[chat_trigger] ON [test].[dbo].[chat]
after update
as
BEGIN

[code]...

View 3 Replies View Related

Trigger Not Firing On Update

Feb 3, 2006

hi,Here's the scenario1) I am running a DTS job to fetch some rows from Oracle2) The job populates the Table A as step 13) Then it fires a update statement which updates the rows in Table B.Here's the statementUPDATE Table B SETtime = case when (select median from Table A where sno = sno and TableA.stno=70 ) is null then timeelse (select median from Table A where Table B.sno = Table A.sno andTable A.sstno=70) end ,endWHERE EXISTS (select sstno from Table A where Table B.sno = TableA.sno)There is a trigger on table B which should fire as soon as thevalue>15.When I fire the update statement direcly with a higher value than itfires the trigger.update table B set time=17 where b.sno=1000But not when the job runs...I am puzzled.Thoughts?AJ

View 1 Replies View Related

Update Trigger Not Firing.

Nov 22, 2007



Hi All,

I have an update trigger which stores the date a record was updated by a GIS app.

It worked in SQL2000 but when I copied and pasted the code into SQL2 its not firing. Any Ideas? Below is the code.


Create TRIGGER [dbo].[Date_Entered] ON [dbo].[ZONING_OP]

FOR UPDATE

AS

UPDATE [dbo].[ZONING_OP]

Set Date_Entered = GetDate()

Where ID = (Select ID from Inserted)


View 6 Replies View Related

Activated Proc Not Firing.

Mar 13, 2007

Hi There

I just had the following scenario.

I checked sys.service_queues to confirm the my queue has an activated proc assigned to it and is activation_enabled.

I send messages to the service, however i see that the messages just sit in the queue. I run profiler with all SB and Error events there is nothing, i check the sql server log, there is also nothing.

So i have no idea why the activated proc is not firing, all i see in the profiler trace is that the messages are acknowledged but the activated proc does not execute.

For a while i was stumped. i then tried to execute the proc myself and i got a syntax error.

Basically what happened was that i altered a table that the proc used and now the proc cannot execute cos there are more columns that must be inserted so i altered the proc.

However the activated proc still did not fire.

I had to disable and re-enable activation for it to work.

What i am wondering is why was there no indication in profiler or the sql og as the the fact that something was wrong with the activated proc ? Surely the activated proc should have fired and given the same error i got either to the sql log or profiler ?

And why did i have to re-enable activation ? Does sql cache the proc when you activate it and not know that the proc has changed when you alter it ?

Thanx

View 4 Replies View Related

SqlDependency.OnChange() Not Firing

Aug 2, 2006

I am running

ALTER DATABASE dbname SET ENABLE_BROKER

on my app startup and then SqlDependency.Start(), and then the following code

SqlCommand cmd = con.CreateCommand();

cmd.CommandText = "SELECT request_queue.track_id, track.file_name, track.track_number, track.track_name, " +

"artist.artist_id, album.album_id, artist.artist_name, album.album_name " +

"FROM dbo.request_queue INNER JOIN track on request_queue.track_id=track.track_id " +

"inner join artist on track.artist_id=artist.artist_id " +

"inner join album on track.album_id=album.album_id";

cmd.CommandType = CommandType.Text;

if (con.State != ConnectionState.Open)

con.Open();

dep = new SqlDependency(cmd);

dep.OnChange += new OnChangeEventHandler(dep_OnChange);

SqlDataReader rdr = cmd.ExecuteReader();

List<Track> l = new List<Track>();

while (rdr.Read())

{

Track t = new Track();

t.TrackID = (int)rdr["track_id"];

t.Filename = (string)rdr["file_name"];

if (rdr["track_name"] != DBNull.Value)

t.TrackName = (string)rdr["track_name"];

t.TrackNumber = (int)rdr["track_number"];

l.Add(t);

}

rdr.Close();





and for some reason, after i do multiple changes to the request_queue table, (adding rows), the dep_on_change never fires, and if i check dep.HasChanges it is always false.

View 8 Replies View Related

EventHandlers Firing Events

Nov 16, 2006

I ran into a pretty bizzare behavior in SSIS:

I am trying to set up a package with a built-in auditing. It has a OnPreExecute, OnPostExecute and OnError event handlers. I am trying to record when the package starts, completes, and the completion status. Each one of these event handlers has a script task that does the logging. I put in debug message boxes into each event handler script to understand what goes on. So here's the sequence of events:

1. When starting the package the OnPreExecute event fires. Right away it fires the second time. I'm guessing what happens here is the script task within the event handler fires its own OnPreExecute event - that's how the first message really pops up. The second message is generated by the actual package-level OnPreExecute event.

2. I have a condition within the OnPreExecute event handler which might set the task status to failure. You would expect the OnError handler to fire, right?.. Wrong! The package dies without firing either OnError or OnPostExecute event....

3. If i remove the condition in step 2, and force an error in the package body, i get an OnError event, and then 2 OnPostExecute events ( i guess for the same reason as in step 1).

What I'm trying to understand is why in the world my OnPreExecute and OnPostExecute events get fired by their own event handlers, yet when i fire other events within these event handlers the appropriate (other) event handler does not run.

Any ideas will be greatly appreciated.

View 9 Replies View Related

OnInformation Event Firing Twice?

Oct 31, 2007

In my SSIS package (which was created programatically) when I try to log details in OnInformation event I get all the entries twice. One with the source name as the taskhost.name property and another with a guid. I'm not able to figure out which component raises the event. Infact for all the events the sourcename comes as GUID.

So I thought I'll override the events by inheriting IDTSEvents or DefaultEvents, But I'm not sure how to proceed further so that I can pass the sourcename properly instead of GUID.




Code BlockIDTSLogging.Log(string eventName, string computerName, string operatorName, string sourceName, string sourceGuid, string executionGuid, string messageText, DateTime startTime, DateTime endTime, int dataCode, ref byte[] dataBytes)



Thanks

View 5 Replies View Related

Sql 2005 Scheduled Job Not Firing

Feb 9, 2007

Setting: sql 2005, SP1.

I created a new job (under SQL Server agent) which runs a simple ActiveX script. When run interactively, the job runs fine. But when run under the scheduler the job fails to even start. There is no error message and "History" makes no reference at all to the job run. I checked, the job is enabled. Any thoughts much appreciated.





TIA,



barkingdog

View 1 Replies View Related

Sqldatasource Onselected Event Not Firing

Oct 3, 2007

Hi All - I've got a simple gridview/sqldatasource page, but the sqldatasource_onSelected event isn't firing.
heres the parameters <SelectParameters>
<asp:QueryStringParameter Name="LicenceID" QueryStringField="LicenceID" Type="string" />
<asp:QueryStringParameter Name="SiteID" QueryStringField="SamplingSiteID" Type="string" />
</SelectParameters>

either or both parameters may be null (ie. not in querystring )  .
If only one of the selectparameters is null, and I remove it, the event fires!!!
The parameters in the stored proc are optional(ie. default = NULL) and it works fine if I test it in SQL .
Whats going on? If there's some error happening, why no error raised? if there are no records returned, the onselected event should still fire shouldn't it?
Geoff 
 
 
 
 
 

View 2 Replies View Related

Sqldatasource Selected Event Not Firing?

Oct 4, 2007

Using Sql server 2005, SQLdatasource, I need to display total rows count.  But the selected event is not fired?  Am I mssing something or doing something wrong? Please comment.  thanks
Code<asp:SqlDataSource ID="DataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:AuditToolConnection%>"
ProviderName="System.Data.SqlClient"SelectCommandType="StoredProcedure"
SelectCommand="usp_Dashboard_GetAll" >
 --------------------------------
public in recordCount = 0;protected void DataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e)
{
recordCount = e.AffectedRows;
lblCount.Text += recordCount.ToString();
}

View 2 Replies View Related

SqlDataSource OnSelected Event Not Firing

Nov 20, 2007

Hi,
 I have a SqlDataSource whose select statement uses parameters from the selected row on a gridview on the page. So when a row is selected in the gridview, I want the SqlDataSource to do a select using the new parameters, and then I want to inspect the number of rows returned. If 0, I want to set a FormView to insert mode, if >0 I want to set the FormView to edit mode.
The "SqlDataSource2_Selected" sub never fires, so I cannot retrieve the number of rows returned. How can I deal with this? I would like the SqlDataSource to execute a Select each time the Gridview selected row changes. What could prevent "OnSelected" from firing?
 I do have "OnSelected="SqlDataSource2_Selected" within the SqlDataSource tag.
 Thanks in advance for any help with this.

View 7 Replies View Related

Firing DTS Through Window Based Forms In VB.net

Apr 6, 2005

Here is what I've got so far...for some reason it's not firing off:
<code>
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dtsp2 As New DTS.Package
dtsp2.LoadFromSQLServer("jfgp34", "sa", "@jfgp#1", DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, "", "", "", "Test Northwind", "")
dtsp2.Execute()
 
End Sub
</code>
Any one with ideas helps out alot.  Thanks in advance everyone.
RB

View 3 Replies View Related

SQL 7 Alert Not Firing. Somewhat Urgent... Deadlines!

Jan 13, 2000

I have set up an alert in sql 7 for error #9002 (log file full) for a particular database. I have a job assigned to run when the alert fires. It appears that I have done everything 'by the book', but when I run an insert that causes the log file to fill... the alert does not fire. I have checked everything I can think of:

- the alert is enabled
- the 9002 message is being logged in the NT event log
- slq server agent is running

what am i missing?

thank you in advance to anyone who can help.

View 2 Replies View Related

UPDATE TRIGGER WITHOUT RECURSIVE FIRING

Apr 11, 2001

I have an update trigger I created that updates a field based on the user who last updated the record. Under 7 the only way it would work was to have recursive triggers firing turned on. Under 2000 might there be a btter solution. The code is below. Thanks

CREATE trigger tr_cmsUpdt_MARS on dbo.PATIENT_MEDICATION_DISPERSAL_ for UPDATE as
-- updates record with sql user and timestamp
--created 11-28-00 tim cronin
DECLARE @muser varchar(35),
@rec_lock_status int,
@ptacpt_status int
set @muser = current_user
begin
UPDATE PATIENT_MEDICATION_DISPERSAL_
set MODIFIED_BY = @muser,
MODIFIED_TS = getdate()
from deleted dt
WHERE --DT.MODIFIED_BY <> 'DBO' AND
PATIENT_MEDICATION_DISPERSAL_.RECORD_ID = dt.RECORD_ID
end

View 3 Replies View Related

Error W/ Trigger When Firing On 'DELETE XYZ WHERE IN (1,2,3)'

May 10, 2006

Hi,

Thanks for looking at this post. I currently have a trigger that fires when a row is inserted or deleted on a table. The idea behind the trigger is that when a row is inserted (representing a sub-category for images), the categories parent needs to have some work done on it. I currently have the trigger working just fine with single inserts and single deletes:


sql Code:






Original
- sql Code





CREATE TRIGGER smvcModImageManagerCategory_insert_delete_pdfManger_sync
ON smvcModImageManagerCategory
FOR INSERT, DELETE
AS
DECLARE @pdfId INTEGER;
DECLARE @parentPdfId INTEGER;
DECLARE @grandparentPdfId INTEGER;
DECLARE @parentId INTEGER;
DECLARE @grandparentId INTEGER;
DECLARE @tableName VARCHAR( 255 );


-- If I am being inserted or deleted, and I am not a top level
-- category, then my parent's pdf record needs to be set so that
-- the pdf file is updated
IF (SELECT id FROM Inserted) IS NOT NULL
BEGIN
SELECT @pdfId = (SELECT pdfManagerId FROM Inserted),
@parentId = (SELECT parentCategory FROM Inserted),
@grandparentId = (SELECT parentCategory FROM smvcModImageManagerCategory
WHERE id = @parentId);
END
ELSE
BEGIN
SELECT @pdfId = (SELECT pdfManagerId FROM Deleted),
@parentId = (SELECT parentCategory FROM Deleted),
@grandparentId = (SELECT parentCategory FROM smvcModImageManagerCategory
WHERE id = @parentId)
END



-- If I am not a top level category, set my parent's pdf to be
-- updated
IF @parentId <> -1
BEGIN
SELECT @parentPdfId = (SELECT pdfManagerId
FROM smvcModImageManagerCategory
WHERE id = @parentId);
UPDATE smvcModPdfManager SET data_last_updated = GETDATE()
WHERE id = @parentPdfId;
END
GO






 CREATE TRIGGER smvcModImageManagerCategory_insert_delete_pdfManger_syncON smvcModImageManagerCategoryFOR INSERT, DELETEAS     DECLARE @pdfId INTEGER;    DECLARE @parentPdfId INTEGER;    DECLARE @grandparentPdfId INTEGER;    DECLARE @parentId INTEGER;    DECLARE @grandparentId INTEGER;    DECLARE @tableName VARCHAR( 255 );         -- If I am being inserted or deleted, and I am not a top level    -- category, then my parent's pdf record needs to be set so that     -- the pdf file is updated    IF (SELECT id FROM Inserted) IS NOT NULL    BEGIN        SELECT @pdfId = (SELECT pdfManagerId FROM Inserted),            @parentId = (SELECT parentCategory FROM Inserted),            @grandparentId = (SELECT parentCategory FROM smvcModImageManagerCategory                                WHERE id = @parentId);    END    ELSE    BEGIN        SELECT @pdfId = (SELECT pdfManagerId FROM Deleted),            @parentId = (SELECT parentCategory FROM Deleted),            @grandparentId = (SELECT parentCategory FROM smvcModImageManagerCategory                                WHERE id = @parentId)    END             -- If I am not a top level category, set my parent's pdf to be    -- updated    IF @parentId <> -1    BEGIN        SELECT @parentPdfId = (SELECT pdfManagerId                                 FROM smvcModImageManagerCategory                                WHERE id = @parentId);        UPDATE smvcModPdfManager SET data_last_updated = GETDATE()            WHERE id = @parentPdfId;    ENDGO



However, when I execute a statement like:


sql Code:






Original
- sql Code





DELETE FROM smvcModImageManagerCategory WHERE (smvcModImageManagerCategory.id IN ('86','87','88','90','91'))






 DELETE FROM smvcModImageManagerCategory WHERE (smvcModImageManagerCategory.id IN ('86','87','88','90','91'))



I get an error because the virtual 'Deleted' table has more than one record in it. So, what I really need is advice on how to turn the above trigger into something that will be able to handle multiple deletes.

Thank you.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved