By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,806 Members | 1,837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,806 IT Pros & Developers. It's quick & easy.

Error in Proc

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.