Showing posts with label product. Show all posts
Showing posts with label product. Show all posts

Thursday, March 22, 2012

Bulk Insert Syntax

Hi - What is the correct syntax to bulk insert into a link table. I
want to link Person 1 to every Product, something like below.
Thanks.
INSERT INTO PersonProducts (PersonID,ProductID)
VALUES (1, Products.ProductID FROM Products)INSERT INTO PersonProducts (PersonID,ProductID)
SELECT 1, Products.ProductID FROM Products|||Thanks!|||Although INSERT...SELECT is the answer to your question, I want to make it
clear that this is not bulk insert. In SQL Server, bulk insert means using
the BULK INSERT Transact-SQL statement, BCP utility, or other APIs that
perform mass insert of external data. INSERT...SELECT is simply a multi-row
insert.
I mention this to avoid confusion since bulk insert is an entirely different
beast.
Hope this helps.
Dan Guzman
SQL Server MVP
"hals_left" <cc900630@.ntu.ac.uk> wrote in message
news:1144063552.967897.165740@.i40g2000cwc.googlegroups.com...
> Hi - What is the correct syntax to bulk insert into a link table. I
> want to link Person 1 to every Product, something like below.
> Thanks.
> INSERT INTO PersonProducts (PersonID,ProductID)
> VALUES (1, Products.ProductID FROM Products)
>|||Thanks for the claification|||Hi Dan,
I am using bulk insert to transfer hugh data from a .dbf file to my sql
server table. Can you guide me in this case what shoud I specify as
fieldterminator and rowterminator?
Thanks in advance.
Regards,
Shailesh
"Dan Guzman" wrote:

> Although INSERT...SELECT is the answer to your question, I want to make it
> clear that this is not bulk insert. In SQL Server, bulk insert means usin
g
> the BULK INSERT Transact-SQL statement, BCP utility, or other APIs that
> perform mass insert of external data. INSERT...SELECT is simply a multi-r
ow
> insert.
> I mention this to avoid confusion since bulk insert is an entirely differe
nt
> beast.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "hals_left" <cc900630@.ntu.ac.uk> wrote in message
> news:1144063552.967897.165740@.i40g2000cwc.googlegroups.com...
>
>|||The BULK INSERT Transact-SQL statement is intended to import 'flat' files.
You can use DTS for 'dbf' files.
Hope this helps.
Dan Guzman
SQL Server MVP
"Shailesh" <Shailesh@.discussions.microsoft.com> wrote in message
news:57FBA5F4-30E7-47F0-A20A-D36408464782@.microsoft.com...
> Hi Dan,
> I am using bulk insert to transfer hugh data from a .dbf file to my sql
> server table. Can you guide me in this case what shoud I specify as
> fieldterminator and rowterminator?
> Thanks in advance.
> Regards,
> Shailesh
> "Dan Guzman" wrote:
>sql

Wednesday, March 7, 2012

Bulk insert bypasses trigger

Hey Folks,
A 3rd party product uses some kind of bulk insert to update a table
several times during the day. Sometimes the data is overwritten, which
effectively loses history. A trigger on the table is bypassed by the bulk
process. I'm hoping there is another way to get notified when the table is
updated so I can quickly copy it to a safer location for reporting purposes.
Maybe an event? Alert?
Thanks!> A 3rd party product uses some kind of bulk insert to update a table
> several times during the day. Sometimes the data is overwritten, which
> effectively loses history. A trigger on the table is bypassed by the bulk
> process. I'm hoping there is another way to get notified when the table is
> updated so I can quickly copy it to a safer location for reporting
> purposes.
Bulk Insert to a staging table, then perform a regular insert ... select ...
from to ensure the trigger is fired.|||BULK INSERT? See the FIRE_TRIGGERS argument for the BULK INSERT statment in
BOL.
HTH
Jerry
"MnFisher" <mnfisher@.community.nospam> wrote in message
news:utwybjoyFHA.2516@.TK2MSFTNGP12.phx.gbl...
> Hey Folks,
> A 3rd party product uses some kind of bulk insert to update a table
> several times during the day. Sometimes the data is overwritten, which
> effectively loses history. A trigger on the table is bypassed by the bulk
> process. I'm hoping there is another way to get notified when the table is
> updated so I can quickly copy it to a safer location for reporting
> purposes.
> Maybe an event? Alert?
> Thanks!
>
>|||Jerry,
Thanks for the response. I don't have access to the command itself. Is there
any other way to catch a bulk insert?
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:uJbnaooyFHA.1960@.TK2MSFTNGP10.phx.gbl...
> BULK INSERT? See the FIRE_TRIGGERS argument for the BULK INSERT statment
> in BOL.
> HTH
> Jerry
> "MnFisher" <mnfisher@.community.nospam> wrote in message
> news:utwybjoyFHA.2516@.TK2MSFTNGP12.phx.gbl...
>|||To "catch"? view? Yes. Profiler.
HTH
Jerry
"MnFisher" <mnfisher@.community.nospam> wrote in message
news:OptkiQpyFHA.2812@.TK2MSFTNGP14.phx.gbl...
> Jerry,
> Thanks for the response. I don't have access to the command itself. Is
> there any other way to catch a bulk insert?
> "Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
> news:uJbnaooyFHA.1960@.TK2MSFTNGP10.phx.gbl...
>