From: Brian Conner via SQLMonster.com on 19 Jan 2010 10:27 How can I set up a Trigger to Update when I Import data into a table.... I manually Import Data into a Table each month by Right clicking on the Database and Selecting Tasks..Import.. I would like for the Trigger to Execute after the file has been imported... Any help is greatly appreciated.... Brian -- Brian Conner Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/201001/1
From: B.Edwards on 19 Jan 2010 13:19 Two options (assuming 2008/2005) (1) Run the import data wizard and do not execute the SSIS package. Instead save it. Open the SSIS package in BIDS and edit the OLE DB Destination object--change data access mode from "Table or view-fast load" TO "Table or view". Save the packet; redeploy it to SQL server and run it. (2) Create a stored procedure that contains code to perform the actions you want (it will be similar but not exactly the same as the Trigger). Run this stored procedure after running the IMPORT. The problem is that the default behaviour of the wizard in your case is to use BULK INSERT to perform the data load--the default behaviour in this case is to NOT have triggers firing. Option 1 above changes this behaviour explicity. Option 2 above is somewhat of a work around. If you actually mean "I would like the Trigger to Execute after the file has been imported" then your ONLY option is #2. "Brian Conner via SQLMonster.com" <u47161(a)uwe> wrote in message news:a259629110df9(a)uwe... > How can I set up a Trigger to Update when I Import data into a table.... > > I manually Import Data into a Table each month by Right clicking on the > Database and Selecting Tasks..Import.. > > I would like for the Trigger to Execute after the file has been > imported... > > Any help is greatly appreciated.... > > Brian > > -- > Brian Conner > > Message posted via SQLMonster.com > http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/201001/1 >
|
Pages: 1 Prev: Multi-value paramter syntax...help Next: Need help with "SUM-IF" query |