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) ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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 |
| |||
| 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 |
| ||||
| 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 |
| Thread Tools | |
| Display Modes | |
|
|
| ||||
| 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 |