Unix Technical Forum

Error in Proc

This is a discussion on Error in Proc within the SQL Server forums, part of the Microsoft SQL Server category; --> hi im trying to Catch the error below String or binary data would be truncated. Example insert into @tmptable(id1,name) ...


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

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-16-2008, 12:13 PM
DaveL
 
Posts: n/a
Default Error in Proc

hi im trying to Catch the error below

String or binary data would be truncated.

Example

insert into @tmptable(id1,name) --name is 10

select id,name from somothertable --name is 50

if (@@error<>0) begin

--never reaches here

goto problem

end





thanks Dave






Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-16-2008, 12:13 PM
Hugo Kornelis
 
Posts: n/a
Default Re: Error in Proc

On Mon, 15 Sep 2008 09:48:04 -0700, DaveL wrote:

>hi im trying to Catch the error below

(snip)

Hi Dave,

Recommended reading:
http://www.sommarskog.se/error-handling-I.html
http://www.sommarskog.se/error-handling-II.html

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-16-2008, 12:13 PM
DaveL
 
Posts: n/a
Default Re: Error in Proc

Found it,
Had to place the code to check @@error
befor the select statement , forgot it resets on each command

DaveL

"Hugo Kornelis" <hugo@perFact.REMOVETHIS.info.INVALID> wrote in message
news:kt8tc4hoh6t9abcthnu3rg91uso8h4keuh@4ax.com...
> On Mon, 15 Sep 2008 09:48:04 -0700, DaveL wrote:
>
>>hi im trying to Catch the error below

> (snip)
>
> Hi Dave,
>
> Recommended reading:
> http://www.sommarskog.se/error-handling-I.html
> http://www.sommarskog.se/error-handling-II.html
>
> --
> Hugo Kornelis, SQL Server MVP
> My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-16-2008, 12:13 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Error in Proc

DaveL (dvs_bis@sbcglobal.net) writes:
> Found it,
> Had to place the code to check @@error
> befor the select statement , forgot it resets on each command


If you are on SQL 2005, look into to using TRY-CATCH instead. So much
easier than the @@error-madness.


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

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: 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

Similar Threads for: Error in Proc

Thread Thread Starter Forum Replies Last Post
Can a stored proc swallow an error wackyphill@yahoo.com SQL Server 5 02-29-2008 06:24 AM
Stored Proc Error Handling Pachydermitis SQL Server 2 02-28-2008 08:17 PM
stored proc error - ADO and DB2 ColdCanuck DB2 6 02-26-2008 07:01 PM
Installer error: Failure trying to run: chroot /target mount -t proc proc /proc Robert Hulme Debian Linux Users forum 3 01-25-2008 08:26 AM
Tripwire error in /proc Anthony Campbell Debian Linux Users forum 1 01-22-2008 02:08 PM


All times are GMT. The time now is 04:26 PM.


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