Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS SQL Reporting format error

Posted on 2009-03-31
4
Medium Priority
?
534 Views
Last Modified: 2012-06-27
Here is the format:

=format(cdec(Fields!SSN.Value), "###-##-####")

Error if the value is " ".  How to check before convert this field value to decimal?
0
Comment
Question by:monica73174
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 25

Expert Comment

by:reb73
ID: 24031264
You should be able to use the ISNUMERIC function to check if the value is a number -

= IIF(IsNumeric(Fields!SSN.Value), format(cdec(Fields!SSN.Value), "###-##-####"), Fields!SSN.Value)
0
 

Author Comment

by:monica73174
ID: 24031427
still has error:
Here is the code:

=IIF(IsNumeric(Fields!SPOUSE_SSN.Value),format(cdec(Fields!SPOUSE_SSN.Value), "###-##-####"), Fields!SPOUSE_SSN.Value)

Error show in the field:  #Error

Warning message:
[rsRuntimeErrorInExpression] The Value expression for the textbox SPOUSE_SSN contains an error: Conversion from string "" to type 'Decimal' is not valid.
Preview complete -- 0 errors, 1 warnings



0
 
LVL 25

Accepted Solution

by:
reb73 earned 2000 total points
ID: 24031945
Try using VAL() instead of CDEC()
0
 

Author Comment

by:monica73174
ID: 24032093
It works.  Thank you very much for your help!!!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to extract data from a Microsoft SQL Server database and export it to an Excel file, but did not want to use a DTS package? The concept in this article is not new, but it is the answer and will also work on 64-bit SQL boxes.   …
This code started out as a fix for a customer that had incoming data that was hunderds of numbers and words long that was to fit in one column. The problem was that the customer did not want to split words or numbers when wrapping in the column. …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question