Showing posts with label checking. Show all posts
Showing posts with label checking. Show all posts

Sunday, February 19, 2012

Error importing excel file

When ever importing a excel file or flat file, I get an Unhandled exception error and the event log reads a .Netframework error ID 1000.

Checking the database I was importing into, I find that the table was created with the columns, but no data within the columns.

The import wizards report 509 row copyed before crashing with the Handle error, where a dialog box appears allowing debug or close.

Can anyone help?

I include the logged errors.

Event Log

.NET Runtime 2.0 Error
Event ID: 1000

Faulting application dtswizard.exe, version 9.0.1399.0, stamp 434f5e2a, faulting module dtspipeline.dll, version 2005.90.1399.0, stamp 434f5dbc, debug? 0, fault address 0x0004ba38.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

0000: 41 00 70 00 70 00 6c 00 A.p.p.l.
0008: 69 00 63 00 61 00 74 00 i.c.a.t.
0010: 69 00 6f 00 6e 00 20 00 i.o.n. .
0018: 46 00 61 00 69 00 6c 00 F.a.i.l.
0020: 75 00 72 00 65 00 20 00 u.r.e. .
0028: 20 00 64 00 74 00 73 00 .d.t.s.
0030: 77 00 69 00 7a 00 61 00 w.i.z.a.
0038: 72 00 64 00 2e 00 65 00 r.d...e.
0040: 78 00 65 00 20 00 39 00 x.e. .9.
0048: 2e 00 30 00 2e 00 31 00 ..0...1.
0050: 33 00 39 00 39 00 2e 00 3.9.9...
0058: 30 00 20 00 34 00 33 00 0. .4.3.
0060: 34 00 66 00 35 00 65 00 4.f.5.e.
0068: 32 00 61 00 20 00 69 00 2.a. .i.
0070: 6e 00 20 00 64 00 74 00 n. .d.t.
0078: 73 00 70 00 69 00 70 00 s.p.i.p.
0080: 65 00 6c 00 69 00 6e 00 e.l.i.n.
0088: 65 00 2e 00 64 00 6c 00 e...d.l.
0090: 6c 00 20 00 32 00 30 00 l. .2.0.
0098: 30 00 35 00 2e 00 39 00 0.5...9.
00a0: 30 00 2e 00 31 00 33 00 0...1.3.
00a8: 39 00 39 00 2e 00 30 00 9.9...0.
00b0: 20 00 34 00 33 00 34 00 .4.3.4.
00b8: 66 00 35 00 64 00 62 00 f.5.d.b.
00c0: 63 00 20 00 66 00 44 00 c. .f.D.
00c8: 65 00 62 00 75 00 67 00 e.b.u.g.
00d0: 20 00 30 00 20 00 61 00 .0. .a.
00d8: 74 00 20 00 6f 00 66 00 t. .o.f.
00e0: 66 00 73 00 65 00 74 00 f.s.e.t.
00e8: 20 00 30 00 30 00 30 00 .0.0.0.
00f0: 34 00 62 00 61 00 33 00 4.b.a.3.
00f8: 38 00 0d 00 0a 00 8.....

Debug Log

Unhandled exception at 0x2357ba38 in DTSWizard.exe: 0xC000001D: Illegal Instruction.

Would you be able to help us nail down this problem by identifying what data is exactly causing this crash?

You can do this by reducing the data set in your spreadsheet (i.e. take 10 rows around the row #509 and see if the problem reproes, than try to find the exact row, then the exact column if possible) and figuring out what is the data and data type of the cell that could not be handled.

In the case you can give us the entire spreadsheet or the minimal piece that still reproes the problem; we could start our investigation from there.

Thanks.

|||

Hi

I have cut down the excel file, still no luck. I have even created a new excel file with two columns and two rows and I still get the error. I have noticed the test file I created "test.xls" is imported with a $ "test$" .

test.xls

Temp Contract 1 231 2 234

This should be simple to import.

John

|||

Well, this is quite simple data and it should not cause any problem. It worked for me quite easy.

Could it be possible that you have some problems with your installation/binaries? What edition of SQL Server do you have installed? Have you installed some previous versions on the same machine?

|||

Bob,

Here are the version information:

Microsoft SQL Server Management Studio 9.00.1399.00
Microsoft Analysis Services Client Tools 2005.090.1399.00
Microsoft Data Access Components (MDAC) 2000.086.1830.00 (srv03_sp1_rtm.050324-1447)
Microsoft MSXML 2.6 3.0 6.0
Microsoft Internet Explorer 6.0.3790.1830
Microsoft .NET Framework 2.0.50727.42
Operating System 5.2.3790

There was no prevoius installations of SQL, However after installing SQL2005 I installed the MSDN disk that came with it, I believe there was an error, I uninstalled and re-install MSDN without any errors "Installation Successful".

John

Wednesday, February 15, 2012

Error Handling in procs etc.

In the last hour a few people have referred to the site: http://www.sommarskog.se/
error-handling-II.html
I am trying to figure out the error checking. I used the document and the bo
l. For example, I cut this from the bol:
USE pubs
GO
UPDATE authors SET au_id = '172 32 1176'
WHERE au_id = '172-32-1176'
IF @.@.ERROR = 547
print 'A check constraint violation occurred'
Once I FIXED the code (the bol uses double quotes) I was able to see the pri
nt statement appear. That was an improvement.
Now in the sample code from http://www.sommarskog.se/error-handling-II.html
he returns a value. When I modify my code like this:
USE pubs
GO
UPDATE authors SET au_id = '172 32 1176'
WHERE au_id = '172-32-1176'
IF @.@.ERROR = 547
return 12
(12 is just a made up number to test with)
I get:
Server: Msg 178, Level 15, State 1, Line 7
A RETURN statement with a return value cannot be used in this context.
How CAN I return something?
Thanks.Roger,
Try putting your code inside a stored procedure.
create procedure dbo.p1
@.old_aid varchar(11),
@.new_aid varchar(11)
as
set nocount on
UPDATE dbo.authors
SET au_id = @.new_aid
WHERE au_id = @.old_auid
return @.@.error
go
declare @.rv int
declare @.error int
exec @.rv = dbo.p1 '172-32-1176', '172 32 1176'
set @.error = isnull(nullif(@.rv, 0), @.@.error)
print @.error
go
AMB
"Roger Twomey" wrote:

> In the last hour a few people have referred to the site: http://www.sommarskog.s
e/error-handling-II.html
> I am trying to figure out the error checking. I used the document and the
bol. For example, I cut this from the bol:
> USE pubs
> GO
> UPDATE authors SET au_id = '172 32 1176'
> WHERE au_id = '172-32-1176'
> IF @.@.ERROR = 547
> print 'A check constraint violation occurred'
>
> Once I FIXED the code (the bol uses double quotes) I was able to see the p
rint statement appear. That was an improvement.
> Now in the sample code from [url]http://www.sommarskog.se/error-handling-II.html[/url
] he returns a value. When I modify my code like this:
> USE pubs
> GO
> UPDATE authors SET au_id = '172 32 1176'
> WHERE au_id = '172-32-1176'
> IF @.@.ERROR = 547
> return 12
> (12 is just a made up number to test with)
> I get:
> Server: Msg 178, Level 15, State 1, Line 7
> A RETURN statement with a return value cannot be used in this context.
> How CAN I return something?
> Thanks|||>>
Server: Msg 178, Level 15, State 1, Line 7
A RETURN statement with a return value cannot be used in this context.
How CAN I return something?
By doing so from within a stored procedure. if you are not in a stored
procedure, where are you returning to? PRINT instead, or SELECT, or issue
your own RAISERROR().
A|||Here is my code:
CREATE PROCEDURE dbo.prTest
AS
UPDATE authors SET au_id = '172 32 1176'
WHERE au_id = '172-32-1176'
IF @.@.ERROR = 547
Begin
return 123
End
select 'fred'
go
When I run the proc I get this:
Server: Msg 547, Level 16, State 1, Procedure prTest, Line 4
UPDATE statement conflicted with COLUMN CHECK constraint 'CK__authors__au_id
__0CBAE877'. The conflict occurred in database 'Pubs', table 'authors', colu
mn 'au_id'.
The statement has been terminated.
This is exactly the same result I get if there is no @.@.Error code. I don't s
ee how this error checking code did anything?
Shouldn't I see something different?
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message news:u0ZJrGvYGH
A.4760@.TK2MSFTNGP03.phx.gbl...
> Server: Msg 178, Level 15, State 1, Line 7
> A RETURN statement with a return value cannot be used in this context.
>
> How CAN I return something?
>
> By doing so from within a stored procedure. if you are not in a stored
> procedure, where are you returning to? PRINT instead, or SELECT, or issue
> your own RAISERROR().
>
> A
>
>|||> Shouldn't I see something different?
Why do you say that? Think about it:
The update is executed. It encounters an error on a row. The error is return
ed to the client
application.
The IF statement is executed and the condition is true
The RETURN statement is executed, returning the value 123 to the calling pro
cedure/application.
You don't see the return value because no-one is catching and doing anything
with that value.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Roger Twomey" <rogerdev@.vnet.on.ca> wrote in message news:OctDzvvYGHA.4060@.
TK2MSFTNGP02.phx.gbl...
Here is my code:
CREATE PROCEDURE dbo.prTest
AS
UPDATE authors SET au_id = '172 32 1176'
WHERE au_id = '172-32-1176'
IF @.@.ERROR = 547
Begin
return 123
End
select 'fred'
go
When I run the proc I get this:
Server: Msg 547, Level 16, State 1, Procedure prTest, Line 4
UPDATE statement conflicted with COLUMN CHECK constraint 'CK__authors__au_id
__0CBAE877'. The
conflict occurred in database 'Pubs', table 'authors', column 'au_id'.
The statement has been terminated.
This is exactly the same result I get if there is no @.@.Error code. I don't s
ee how this error
checking code did anything?
Shouldn't I see something different?
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:u0ZJrGvYGHA.4760@.TK2MSFTNGP03.phx.gbl...
> Server: Msg 178, Level 15, State 1, Line 7
> A RETURN statement with a return value cannot be used in this context.
> How CAN I return something?
> By doing so from within a stored procedure. if you are not in a stored
> procedure, where are you returning to? PRINT instead, or SELECT, or issue
> your own RAISERROR().
> A
>|||When executing the stored procedure you must declare (and use) a variable to
assign the return value from the procedure to:
declare @.r int
exec @.r = <procedure> <parameter list>
print @.r
What exactly are you trying to achieve?
ML
http://milambda.blogspot.com/|||Well... At this point I am trying to achieve the Zen state of knowlege. ;)
I am trying to figure out how this works so that I might be able to apply it
to something in the future.
Currently a huge amount of my .net code is error checking. Because I have
never been able to figure out the @.@.Error in SQL server I rely on my .Net
code to figure out what happened and fix it.
I think it would be ever so much easier if I understood @.@.Error use so that
I could take care of some of this in SQL itself. The sample I gave you is
just me trying to figure out what the heck is happening.
Okay. Executing the way you suggested worked. Now I just have to figure out
how I can use that knowlege.
For example, could my variable use to hold the error state be an output
param? I know how to get those from vb.net.
It's amazing the things I don't know! ;)
Thanks for your help.
Anyway, I will try
"ML" <ML@.discussions.microsoft.com> wrote in message
news:66BD512F-C1AE-4CD8-8C40-575153F30B9C@.microsoft.com...
> When executing the stored procedure you must declare (and use) a variable
> to
> assign the return value from the procedure to:
> declare @.r int
> exec @.r = <procedure> <parameter list>
> print @.r
> What exactly are you trying to achieve?
>
> ML
> --
> http://milambda.blogspot.com/|||As suggested before, read through Erland's articles. That will give you the
basics and a few good practices.
There are three ways a procedure can return data:
1) a result set (one or more) - the results of select statements (with the
exception of variable assigning selects);
2) output parameters - declared as output parameters when the procedure is
dreated and when the procedure is executed; and
3) the return value.
The latter is usually used for just the purpose of either returning 0 when
the procedure was executed without any errors, or returning a SQL Error
number (look at the sysmessages system table) or a user-defined numeric valu
e
that can be trapped in the calling process (e.g a user error could be the
fact that no rows were affected by an update statement).
But the essence of error-handling is IMHO:
1) to *prevent* possible errors (by validating inputs); and
2) to report fatal (unrecoverable) errors to the caller.
You mention the fact that you do most of your development work in .Net, so I
assume you are familiar with the TRY...CATCH method. If you need this
functionality, then you'd have to use SQL 2005, since it's not known in
previous versions.
What exactly is your goal here? We can help you find the best solution to
any problem, but we really need to know what it is that you need.
ML
p.s. the Zen model is the future. :)
http://milambda.blogspot.com/