Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL
Hi
 
I am having some trouble creating a view on my database
 
If i run the query in a normal window the query runs returns all the data i require
 
When i copy that query to create a view i keep getting this error
multi-part identifier cannot be bound
 

could some one please explain to me what the issue could be and a possible solution.
 
Thanks in Advance
Posted 10-Mar-13 22:58pm
isi19503
Comments
Zoltán Zörgő at 11-Mar-13 4:11am
   
Read this first: http://aartemiou.blogspot.fr/2009/01/multi-part-identifier-could-not-be.html
gvprabu at 11-Mar-13 4:51am
   
Give your sample query, what u tried?
isi19 at 11-Mar-13 4:59am
   
Hi
 
I have managed to solve the issue when creating the view because the statements are unioned they have similar links to tables and the ssms created the view and aliased the 2nd and 3rd etc join
 
so if my query was select id,code from (select test.id,test.codeid from test inner join test.code on code.id = test.codeid unionall select table2.id,table.codeid inner join table2.codeid on code.id = table2.codeid) AS D
 

the sub query changed to
select test.id,test.codeid from test inner join test.code on code.id = test.codeid unionall select table2.id,table.codeid inner join table2.codeid_1 on code.id = table2.codeid_1

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 205
3 Jochen Arndt 180
4 Sergey Alexandrovich Kryukov 165
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100