468,242 Members | 1,546 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

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


Sep 15 '08 #1
3 1111
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
Sep 15 '08 #2
Found it,
Had to place the code to check @@error
befor the select statement , forgot it resets on each command

DaveL

"Hugo Kornelis" <hu**@perFact.REMOVETHIS.info.INVALIDwrote in message
news:kt********************************@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

Sep 15 '08 #3
DaveL (dv*****@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, es****@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

Sep 15 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Mairhtin O'Feannag | last post: by
2 posts views Thread by mghale | last post: by
8 posts views Thread by CarpetMnuncher! | last post: by
6 posts views Thread by ferg | last post: by
reply views Thread by robgallen | last post: by
4 posts views Thread by PokerMan | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.