Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Joins

Author  Topic 

manners
Starting Member

1 Post

Posted - 2012-10-04 : 03:53:47
Hi, I need help with a join. Relatively new to SQL.Any help greatly appreciated.Here's the code:

set identity_insert idx_ref_attribute_type on
go

Insert into idx_ref_attribute_type
(idx_attribute_type_id,
type_desc,
value_type,
daily_change,
purpose)

Select idx_factor_type_id,
factor_type_desc,
factor_value_type,
daily_change,
factor_purpose

From idx_factor_type

inner join idx_attribute_type

on idx_ref_attribute_type.membershp_attribute = idx_attribute_type.membership_attribute

set identity_insert idx_ref_attribute_type off


The error I get is:
[Error] Script lines: 3-23 -------------------------
The column prefix 'idx_ref_attribute_type' does not match with a table name or alias name used in the query. Either the table is not specified in the FROM clause or it has a correlation name which must be used instead.


Without the inner join and following line it works perfectly! =(

Cheers

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-10-04 : 04:15:19
I only could answer like this:
The column prefix 'idx_ref_attribute_type' does not match with a table name or alias name used in the query. Either the table is not specified in the FROM clause or it has a correlation name which must be used instead.


Too old to Rock'n'Roll too young to die.
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-10-04 : 05:10:04
quote:
Originally posted by manners

Hi, I need help with a join. Relatively new to SQL.Any help greatly appreciated.Here's the code:

set identity_insert idx_ref_attribute_type on
go

Insert into idx_ref_attribute_type
(idx_attribute_type_id,
type_desc,
value_type,
daily_change,
purpose)

Select idx_factor_type_id,
factor_type_desc,
factor_value_type,
daily_change,
factor_purpose

From idx_factor_type

inner join idx_attribute_type

on idx_ref_attribute_type.membershp_attribute = idx_attribute_type.membership_attribute

set identity_insert idx_ref_attribute_type off


The error I get is:
[Error] Script lines: 3-23 -------------------------
The column prefix 'idx_ref_attribute_type' does not match with a table name or alias name used in the query. Either the table is not specified in the FROM clause or it has a correlation name which must be used instead.


Without the inner join and following line it works perfectly! =(

Cheers



Try this one


From idx_factor_type

inner join idx_attribute_type

on idx_factor_type.membershp_attribute = idx_attribute_type.membership_attribute

i think u mistakenly wrote idx_ref_attribute_type

--
Chandu
Go to Top of Page
   

- Advertisement -