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
isi19527
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 Suvendu Shekhar Giri 285
1 Sergey Alexandrovich Kryukov 245
2 OriginalGriff 210
3 PIEBALDconsult 180
4 Peter Leow 125
0 Sergey Alexandrovich Kryukov 6,425
1 OriginalGriff 5,918
2 Peter Leow 2,514
3 Maciej Los 2,263
4 Abhinav S 2,249


Advertise | Privacy | Mobile
Web01 | 2.8.150414.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2015
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