Showing posts with label level. Show all posts
Showing posts with label level. Show all posts

Friday, February 24, 2012

Convertion VarChar Error

Ive got a small problem at the moment

I have ran a query that has been used for a while now and have recieved this error

Server: Msg 245, Level 16, State 1, Line 3
Syntax error converting the varchar value 'N' to a column of data type int.

Ive searched the data and the only value of N that i can find is currently sitting in a field where the field type is varchar

is there a workaround for this, Ive tried running a case statement to set the N to 0 and also tried casting

Cheers in advance
Dave...the only value of N that i can find is currently sitting in a field where the field type is varcharso why is it trying to convert this value to an integer?

i have no idea, because i can't see your query from here

:)|||rudy man i thought you were psychic

-- 5302 MH consultant OP first attendances

SELECT CdsType,
NHSTrust,
AttendedOrDNACode, --N apears here varchar(1) column
FirstAttendanceCode,
SpecialtyCode,
Specialty,
PCG,
PurchCode,
datepart (year, ActivityDate) as yearAct,
datepart (month, ActivityDate) as monthAct

FROM dbo.VIEW_Outpatient2000_Analysis

WHERE PurchCode like '5KW%'
--pcg like 'Chelt%'
and NHSTrust not like 'Glou%'
and FirstAttendanceCode = 1
and AttendedOrDNACode in ('5', '6', '1','N')
and SpecialtyCode between '710' and '715'
and ((datepart (year, ActivityDate) = 2004
and datepart (month, ActivityDate) > 03)
or (datepart (year, ActivityDate) = 2005
and datepart (month, ActivityDate) < 04))

So im pretty much confused, cant see anything there that would cause a problem|||the 'N' may not necessarily be where you think it is

FirstAttendanceCode = 1|||Ah Blind as a Bat i am
Cheers rudy

Friday, February 10, 2012

Converting numeric to non-numeric?

I'm a beginner to Crystal. Honestly, I had no intention of learning it beyond a user level but our developer is MIA and we need to tweak our template. We have a field that use to be a number (a "MapID" in this case), it would be 1, 2, 3, 4, etc. Now we want it to reflect a different ID that is going to look like 1a, 1b, 1c, 2, 3a, etc. I've changed the RPT query in access to populate with the new ID, keeping the column the same, but of course nothing in life is that simple. When trying to export the Crystal Template to PDF I get this error almost immediately:

"The string is non-numeric"

The Formula Workshop pops up and says this:

CDbl({RPT_Detailed_Findings.MAPID})

By going to the subreport and right clicking on the specific field and going to Edit Formula the Formula Workshop says this:

If {?Pm-RPT_Detailed_Findings.source} = "mapped" then
{?Pm-RPT_Executive_Summary.MAPID}
else "Unmapped";

I am so new to this I can't really see why it would only accept a number, my only guess is that the restriction has to do with "CDbl" or "?PM". Am I even close?

I'm in a jam here as there is nobody else to go to in the company, I'm it. And the developer is non-responsive.

Thanks for the help.remove cDbl,

as 1a ur new id is already string, u cannot convert it to a double numeric value

Hope it helps|||Now they are all out of order and the letters still did not come in, also I believe only the records that did not have letters made it into the report. The report exported though.