Go Back   Access World Forums > Apps and Windows > SQL Server

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-05-2019, 05:01 AM   #1
Zedster
Newly Registered User
 
Join Date: Jul 2019
Location: UK Warwickshire
Posts: 46
Thanks: 22
Thanked 0 Times in 0 Posts
Zedster is on a distinguished road
Line numbers in error messages

I am getting an error message:

Msg 8152, Level 16, State 10, Line 16
String or binary data would be truncated.


I believe it is occurring in a stored Scalar-Valued function that is being called from a query.

How do I find line 16 because:
  • lines have spaces
  • There are comments
  • To view the function I need to modify it and that includes the code to instruct the alteration


Last edited by Zedster; 09-05-2019 at 05:14 AM.
Zedster is offline   Reply With Quote
Old 09-05-2019, 06:46 AM   #2
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 4,145
Thanks: 46
Thanked 971 Times in 952 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: Line numbers in error messages

Hi. I'm just guessing here but I think the comments and empty lines count but not sure about the ALTER line though. Would you be able to do a quick experiment and create a small function that raises an error. You can then add empty and comment lines to see if the line number reported when the error occurs matches what you're expecting to get.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 09-05-2019, 08:18 AM   #3
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,357
Thanks: 159
Thanked 1,708 Times in 1,678 Posts
Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough
Re: Line numbers in error messages

If that is in the query window in SSMS you can normally double click on the error and it will take you to the offending line ?

Caveat : This may be version dependent

__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is offline   Reply With Quote
The Following 2 Users Say Thank You to Minty For This Useful Post:
theDBguy (09-06-2019), Zedster (09-05-2019)
Old 09-05-2019, 10:19 PM   #4
Zedster
Newly Registered User
 
Join Date: Jul 2019
Location: UK Warwickshire
Posts: 46
Thanks: 22
Thanked 0 Times in 0 Posts
Zedster is on a distinguished road
Re: Line numbers in error messages

Quote:
Originally Posted by Minty View Post
If that is in the query window in SSMS you can normally double click on the error and it will take you to the offending line ?

Caveat : This may be version dependent
Having just tried that I can confirm that for SSMS V18.2 double clicking the error works, thank you.

Last edited by Zedster; 09-05-2019 at 11:18 PM. Reason: confirmation that solution works
Zedster is offline   Reply With Quote
Old 09-06-2019, 07:45 AM   #5
kevlray
Newly Registered User
 
Join Date: Apr 2010
Location: Central California
Posts: 644
Thanks: 9
Thanked 52 Times in 50 Posts
kevlray will become famous soon enough
Re: Line numbers in error messages

Of course in SSMS you can turn on the line numbers (normally off for some reason).

kevlray is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Line Numbers AceBK Tables 21 01-11-2015 11:11 AM
automate line numbers and PO numbers steve111 Modules & VBA 5 08-25-2014 03:08 AM
Line numbers in VBA? WinDancer Modules & VBA 1 02-28-2008 11:24 AM
Trap access messages that don't have numbers! Bee General 5 10-19-2007 01:08 AM
Error Messages without Error Numbers badabing Forms 2 08-02-2004 08:07 AM




All times are GMT -8. The time now is 08:12 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World