Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Using Insert Bulk

Author  Topic 

oukuri
Starting Member

7 Posts

Posted - 2012-12-18 : 02:25:32
Hi i am trying to use 'Insert Bulk' like

Insert Bulk newpersontable select
FIRST_NM,
LST_NM,
MIDDLE_NM,
GNDR,
STU_ID,
CMP_ID,
CALNETUID,
UC_LOC,
ANID
from PERSON

But facing below error
.Net SqlClient Data Provider: Msg 4022, Level 16, State 1, Line 1
Bulk load data was expected but not sent. The batch will be terminated.

Can any one tell how to correct this

oukuri

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-12-18 : 02:29:01
If both table newpersontable, person tables are in same database and same instance, then
Insert INTO Bulk newpersontable
SELECT FIRST_NM, LST_NM, MIDDLE_NM, GNDR,STU_ID,CMP_ID,CALNETUID,UC_LOC, ANID
from PERSON

--
Chandu
Go to Top of Page

oukuri
Starting Member

7 Posts

Posted - 2012-12-18 : 05:37:11
Incorrect syntax near the keyword 'Bulk'.

oukuri
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-12-18 : 05:38:28
quote:
Originally posted by oukuri

Incorrect syntax near the keyword 'Bulk'.
oukuri

Strike out that part, then execute...
Insert INTO newpersontable
SELECT FIRST_NM, LST_NM, MIDDLE_NM, GNDR,STU_ID,CMP_ID,CALNETUID,UC_LOC, ANID
from PERSON

If the tables are in different servers, then you have to use linked server..



--
Chandu
Go to Top of Page
   

- Advertisement -