Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can I link a table using a variable 1

Status
Not open for further replies.

christer99

IS-IT--Management
Joined
Dec 3, 2001
Messages
247
Can I link tables using a variable? (in example below @polvar ) The variable corresponds to a column table. The above code doesn't work

select *
FROM PolicyType PolicyType_1 INNER JOIN
PROSP ON PolicyType_1.TYPE = @polvar LEFT OUTER JOIN
LeadSource ON PROSP.MPLAN = LeadSource.TME LEFT OUTER JOIN
PolicyType RIGHT OUTER JOIN
 
You would need to use Dynamic SQL do to this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top