Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > table trigger j...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 10972 of 11205
Post > Topic >>

table trigger just hangs

by rcamarda <robert.a.camarda@[EMAIL PROTECTED] > Apr 16, 2008 at 12:32 PM

I have a UDF that cleans a field of control characters and I use it
like this
select
  dbo.udf_CleanAlphaNum(Address1) as Address1
from  Leads

It works great. I use it to clean several fields from a vendors SQL
server. The downside is I have to first load the data into my database
so I can use my function to clean the data THEN proceed to load it
into the destination table. I thought I could create a trigger on the
final table that calls this function via a trigger.

This is my test CREATE TRIGGER

USE [Strayer_Staging]
GO
/****** Object:  Trigger [dbo].[Clean_Q_Lead_Demographics]    Script
Date: 04/16/2008 15:32:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


CREATE TRIGGER [dbo].[Clean_Q_Lead_Demographics]
   ON  [Strayer_Staging].[dbo].[Q_Lead_Demographics]
  for update, insert
AS
  update Strayer_Staging.dbo.Q_Lead_Demographics
  set address1 = dbo.udf_CleanAlphaNum(inserted.Address1)
from INSERTED   ;

when I try to update a record with

update q_lead_demographics
set address1 = '2 chestnut street'
where leadid = 1075789

it looks like it updates all records becuase it take 4 minutes and I
get this message:
(1055538 row(s) affected)

(1 row(s) affected)

it works, but on all rows, not just the updated row.

Is there a @[EMAIL PROTECTED]
 variable that is the primary key so I should use  a
WHERE, or am going about this all wrong?
TIA




 5 Posts in Topic:
table trigger just hangs
rcamarda <robert.a.cam  2008-04-16 12:32:25 
Re: table trigger just hangs
rcamarda <robert.a.cam  2008-04-16 13:55:19 
Re: table trigger just hangs
rcamarda <robert.a.cam  2008-04-16 20:48:36 
Re: table trigger just hangs
Ed Murphy <emurphy42@[  2008-04-16 22:23:25 
Re: table trigger just hangs
rcamarda <robert.a.cam  2008-04-25 20:04:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Fri Jul 4 20:57:32 CDT 2008.