Sylvain Lafontaine
3/19/2007 3:24:00 AM
Well, then if you are getting the message "error converting data type
varchar to numeric" error, then maybe your Case statement is OK and that you
have now a second error somewhere else.
However, as you didn't have posted your whole Select query nor the structure
of your tables that are relevant here, we cannot help you anymore at this
moment.
--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
"childofthe1980s" <childofthe1980s@discussions.microsoft.com> wrote in
message news:DE9803E8-6033-4D67-9FF3-B5653F65009F@microsoft.com...
> no, it's neither of those.
>
> I don't understand why this has to be so hard.
>
> childofthe1980s
>
> "Sylvain Lafontaine" wrote:
>
>> Also, another possibility would be that you need a comma after the
>> [Payroll
>> Description] or that the error is in the following FROM statement.
>>
>> --
>> Sylvain Lafontaine, ing.
>> MVP - Technologies Virtual-PC
>> E-mail: sylvain aei ca (fill the blanks, no spam please)
>>
>>
>> "Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
>> wrote in message news:%2378%23oscaHHA.4396@TK2MSFTNGP06.phx.gbl...
>> > What's the exact type of the field UPR40800.DSCRIPTN ?
>> >
>> > --
>> > Sylvain Lafontaine, ing.
>> > MVP - Technologies Virtual-PC
>> > E-mail: sylvain aei ca (fill the blanks, no spam please)
>> >
>> >
>> > "childofthe1980s" <childofthe1980s@discussions.microsoft.com> wrote in
>> > message news:0A1834D5-8E5C-4804-9F49-0FC425841935@microsoft.com...
>> >> Hi Sylvain:
>> >>
>> >> Now, I'm getting that "error converting data type varchar to numeric"
>> >> error.
>> >> Help!!!
>> >>
>> >> childofthe1980s
>> >>
>> >> "Sylvain Lafontaine" wrote:
>> >>
>> >>> I should have added that I took the assumption that the DSCRIPTN
>> >>> field
>> >>> is of
>> >>> char type.
>> >>>
>> >>> --
>> >>> Sylvain Lafontaine, ing.
>> >>> MVP - Technologies Virtual-PC
>> >>> E-mail: sylvain aei ca (fill the blanks, no spam please)
>> >>>
>> >>>
>> >>> "Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam
>> >>> please)>
>> >>> wrote in message news:%23LiAVLZaHHA.1296@TK2MSFTNGP02.phx.gbl...
>> >>> > It's because 0 is not a character string. Replace it with '0'.
>> >>> >
>> >>> > --
>> >>> > Sylvain Lafontaine, ing.
>> >>> > MVP - Technologies Virtual-PC
>> >>> > E-mail: sylvain aei ca (fill the blanks, no spam please)
>> >>> >
>> >>> >
>> >>> > "childofthe1980s" <childofthe1980s@discussions.microsoft.com> wrote
>> >>> > in
>> >>> > message news:E4617DFD-17D4-4723-9C60-4FD60954DF91@microsoft.com...
>> >>> >> Hello:
>> >>> >>
>> >>> >> I'm trying to complete an If, Then statement within a script that
>> >>> >> I
>> >>> >> put
>> >>> >> together, and I keep getting an "Incorrect syntax near the keyword
>> >>> >> 'As'"
>> >>> >> error toward the end of the statement.
>> >>> >>
>> >>> >> The whole statement says that if you are taking the payroll codes
>> >>> >> from
>> >>> >> the
>> >>> >> benefit table, then provide the payroll code's description such
>> >>> >> "health
>> >>> >> insurance" or "dental insurance".
>> >>> >>
>> >>> >> The very beginning of my clause, of course, says "SELECT ... CASE
>> >>> >> UPR30300.PAYROLCD WHEN 'SC2HF' THEN UPR40800.DSCRIPTN
>> >>> >> WHEN 'SC2LE' THEN UPR40800.DSCRIPTN
>> >>> >> WHEN 'SC2LS' THEN UPR40800.DSCRIPTN
>> >>> >> WHEN 'SC2LC' THEN UPR40800.DSCRIPTN
>> >>> >> WHEN 'SC2LF' THEN UPR40800.DSCRIPTN
>> >>> >> ELSE 0 END As [Payroll Description]
>> >>> >>
>> >>> >> There must be something wrong with the ELSE portion. I tried to
>> >>> >> fix
>> >>> >> it,
>> >>> >> by
>> >>> >> saying ELSE '' END As [Payroll Description]. But, I got the same
>> >>> >> error.
>> >>> >>
>> >>> >> What am I doing wrong, and how can I fix this?
>> >>> >>
>> >>> >> Thanks!
>> >>> >>
>> >>> >> childofthe1980s
>> >>> >
>> >>> >
>> >>>
>> >>>
>> >>>
>> >
>> >
>>
>>
>>