Unix Technical Forum

BCP error - missing data

This is a discussion on BCP error - missing data within the SQL Server forums, part of the Microsoft SQL Server category; --> After loading the BCP files that are created during the trigger/ reporting events I've noticed that the data in ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 12:11 PM
danceli@gmail.com
 
Posts: n/a
Default BCP error - missing data

After loading the BCP files that are created during the trigger/
reporting events I've noticed that the data in the table is missing
records. I've also noticed that the missing records (records in the
table but not in the BCP out files) seem to occur in contiguous
blocks. Since the complete set of records exists in the table, I
assume this points to an issue in the way the TableUpdate script/
Triggers interact with the system. But i tried to take out the bcp
procedure, do test on trigger, then no data missing, So, I think the
problem is still on bcp part. Could you help me with that?

CREATE TABLE [EventUpdate] (
[id] [int] NOT NULL ,
[eventid] [int] NOT NULL ,
[sequenceid] [int] NOT NULL ,
[UpdatePass] [int] NULL
) ON [PRIMARY]
GO
create trigger trgEventUpdate on EventLog For Insert,Update as
insert into EventUpdate (id,eventid,sequenceid) select ins.id,
ins.eventid,ins.sequenceid from inserted ins



bcp script:

bcp "select a.* from w..eventlog a, w..eventupdate b where
a.eventid=b.eventid and a.sequenceid=b.sequenceid and b.eventid<>-1
and b.sequenceid<>-1 and b.updatepass=1" queryout 30sec-%TFN_NOW%.wrk -
U <userwithaccess> -P <password> -S doserver -f EventLog.fmt

Thanks in advance for your reply!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 12:11 PM
Erland Sommarskog
 
Posts: n/a
Default Re: BCP error - missing data

(danceli@gmail.com) writes:
> After loading the BCP files that are created during the trigger/
> reporting events I've noticed that the data in the table is missing
> records. I've also noticed that the missing records (records in the
> table but not in the BCP out files) seem to occur in contiguous
> blocks. Since the complete set of records exists in the table, I
> assume this points to an issue in the way the TableUpdate script/
> Triggers interact with the system. But i tried to take out the bcp
> procedure, do test on trigger, then no data missing, So, I think the
> problem is still on bcp part. Could you help me with that?


Please, could you take that again, and more slowly this time? Keep in
mind that people reading this newsgroup does not know about your system.

You are missing data but where? You appear to extract data with BCP, do
you load it anywhere else?

One thing I can note:

> create trigger trgEventUpdate on EventLog For Insert,Update as
> insert into EventUpdate (id,eventid,sequenceid) select ins.id,
> ins.eventid,ins.sequenceid from inserted ins
>
>bcp "select a.* from w..eventlog a, w..eventupdate b where
>a.eventid=b.eventid and a.sequenceid=b.sequenceid and b.eventid<>-1
>and b.sequenceid<>-1 and b.updatepass=1" queryout 30sec-%TFN_NOW%.wrk -
>U <userwithaccess> -P <password> -S doserver -f EventLog.fmt


The BCP query has a condition on the column UpdatePass which is not
set in the trigger. So from what you have posted, I would not expect
anything at all to go in the BCP file.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 12:12 PM
danceli@gmail.com
 
Posts: n/a
Default Re: BCP error - missing data

1.
> You are missing data but where? You appear to extract data withBCP, do
> you load it anywhere else?


On table Eventlog, there are missing data.


2.
> > create trigger trgEventUpdate on EventLog For Insert,Update as
> > insert into EventUpdate (id,eventid,sequenceid) select ins.id,
> > ins.eventid,ins.sequenceid from inserted ins

>
> >bcp"select a.* from w..eventlog a, w..eventupdate b where
> >a.eventid=b.eventid and a.sequenceid=b.sequenceid and b.eventid<>-1
> >and b.sequenceid<>-1 and b.updatepass=1" queryout 30sec-%TFN_NOW%.wrk -
> >U <userwithaccess> -P <password> -S doserver -f EventLog.fmt

>
> TheBCPquery has a condition on the column UpdatePass which is not
> set in the trigger. So from what you have posted, I would not expect
> anything at all to go in theBCPfile.


sorry, i didn't clearly explain it. i did set the UpdataPass:

CREATE TABLE [EventLogUpdate] (
[id] [int] NOT NULL ,
[eventid] [int] NOT NULL ,
[sequenceid] [int] NOT NULL ,
[UpdatePass] [int] NULL
) ON [PRIMARY]
GO
create trigger trgEventUpdate on EventLog For Insert,Update as
insert into EventLogUpdate (id,eventid,sequenceid) select ins.id,
ins.eventid,ins.sequenceid from inserted ins
GO






Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2008, 12:12 PM
Erland Sommarskog
 
Posts: n/a
Default Re: BCP error - missing data

(danceli@gmail.com) writes:
> On table Eventlog, there are missing data.


But it was the EventLog table you had the trigger on? If data is
missing in EventLog what has the trigger or the BCP stuff to do with it?

> sorry, i didn't clearly explain it. i did set the UpdataPass:
>
> CREATE TABLE [EventLogUpdate] (
> [id] [int] NOT NULL ,
> [eventid] [int] NOT NULL ,
> [sequenceid] [int] NOT NULL ,
> [UpdatePass] [int] NULL
> ) ON [PRIMARY]
> GO
> create trigger trgEventUpdate on EventLog For Insert,Update as
> insert into EventLogUpdate (id,eventid,sequenceid) select ins.id,
> ins.eventid,ins.sequenceid from inserted ins
> GO


I still can't see any update of UpdatePass?

It's your call. If you don't want to explain what you are doing, that
is alright. But unfortunately it is difficult to answer your questions
in this case.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:59 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com