I have created SQL using a Derived Table. Obviously, there's a method for my
madness here and it has been a while since I've used a derived table. I am
testing portions of my query and I am having a problem with the following
SQL...getting the following error message...
Server: Msg 8155, Level 16, State 2, Line 1
No column was specified for column 6 of 'drvtbl'.
And here's the SQL...
SELECT drvtbl."loan_id",
drvtbl."corr_name",
drvtbl."corr_address_1",
drvtbl."corr_city",
drvtbl."corr_state",
drvtbl."corr_zip",
drvtbl."misc_field_value"
FROM (SELECT ms_address_information."loan_id",
ms_address_information."corr_name",
ms_address_information."corr_address_1",
ms_address_information."corr_city",
ms_address_information."corr_state",
CAST(ms_loan_misc_fields."misc_field_value" AS CHAR(15))
FROM { oj "fics"."dbo"."ms_address_information" ms_address_information
LEFT OUTER JOIN "fics"."dbo"."ms_loan_misc_fields" ms_loan_misc_fields
ON ms_address_information."loan_id" = ms_loan_misc_fields."loan_id"
AND ms_loan_misc_fields."misc_field_id" = 10079}) drvtbl
Can anyone help me out here and tell me why I am getting an error message on
this?
Thanks for your help!give your column an alias
i.e.
SELECT drvtbl."loan_id",
drvtbl."corr_name",
drvtbl."corr_address_1",
drvtbl."corr_city",
drvtbl."corr_state",
drvtbl."corr_zip",
miscField
FROM (SELECT ms_address_information."loan_id",
ms_address_information."corr_name",
ms_address_information."corr_address_1",
ms_address_information."corr_city",
ms_address_information."corr_state",
CAST(ms_loan_misc_fields."misc_field_value" AS CHAR(15)) as miscField
FROM { oj "fics"."dbo"."ms_address_information" ms_address_information
LEFT OUTER JOIN "fics"."dbo"."ms_loan_misc_fields" ms_loan_misc_fields
ON ms_address_information."loan_id" = ms_loan_misc_fields."loan_id"
AND ms_loan_misc_fields."misc_field_id" = 10079}) drvtbl
"wnfisba" wrote:
> I have created SQL using a Derived Table. Obviously, there's a method for
my
> madness here and it has been a while since I've used a derived table. I am
> testing portions of my query and I am having a problem with the following
> SQL...getting the following error message...
> Server: Msg 8155, Level 16, State 2, Line 1
> No column was specified for column 6 of 'drvtbl'.
> And here's the SQL...
> SELECT drvtbl."loan_id",
> drvtbl."corr_name",
> drvtbl."corr_address_1",
> drvtbl."corr_city",
> drvtbl."corr_state",
> drvtbl."corr_zip",
> drvtbl."misc_field_value"
> FROM (SELECT ms_address_information."loan_id",
> ms_address_information."corr_name",
> ms_address_information."corr_address_1",
> ms_address_information."corr_city",
> ms_address_information."corr_state",
> CAST(ms_loan_misc_fields."misc_field_value" AS CHAR(15))
> FROM { oj "fics"."dbo"."ms_address_information" ms_address_informatio
n
> LEFT OUTER JOIN "fics"."dbo"."ms_loan_misc_fields" ms_loan_misc_fields
> ON ms_address_information."loan_id" = ms_loan_misc_fields."loan_id"
> AND ms_loan_misc_fields."misc_field_id" = 10079}) drvtbl
>
> Can anyone help me out here and tell me why I am getting an error message
on
> this?
> Thanks for your help!
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment