| Author |
Topic |
|
Brittney10
Posting Yak Master
154 Posts |
Posted - 2011-11-09 : 15:39:53
|
I've never worked with views in SQL before, but I'm trying to select one column from the view, somename.customername. When i try to query for:select somename.customername from dbo.vw_myview i get this error: The multi-part identifier "somename.customername." could not be bound. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
Kristen
Test
22859 Posts |
Posted - 2011-11-09 : 15:47:50
|
| select XXXX.customername from dbo.vw_myview AS XXXX |
 |
|
|
Brittney10
Posting Yak Master
154 Posts |
Posted - 2011-11-09 : 16:48:32
|
I tried:select vw_myview.customername from dbo.vw_myview and select vw_myview.somename.customername from dbo.vw_myview but I get "Invalid column name...."When i do "select * from vw_myview somename.customername" somename.customername is in there. |
 |
|
|
Brittney10
Posting Yak Master
154 Posts |
Posted - 2011-11-09 : 16:49:57
|
quote: Originally posted by Kristen select XXXX.customername from dbo.vw_myview AS XXXX
It still does not work when I derive it. |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-11-09 : 17:08:42
|
| Sounds like there's actually a column called somename.customername...bad practice.In that case:SELECT [somename.customername] FROM vw_myView; |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-11-09 : 17:13:11
|
| By the way, if that doesn't resolve it for you, post the view definition please. |
 |
|
|
Brittney10
Posting Yak Master
154 Posts |
Posted - 2011-11-09 : 17:21:46
|
quote: Originally posted by russell Sounds like there's actually a column called somename.customername...bad practice.In that case:SELECT [somename.customername] FROM vw_myView;
That doesn't work either.... |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-11-09 : 17:25:03
|
| Post the DDL. We're just guessing without it. |
 |
|
|
Brittney10
Posting Yak Master
154 Posts |
Posted - 2011-11-09 : 17:27:41
|
quote: Originally posted by russell Sounds like there's actually a column called somename.customername...bad practice.In that case:SELECT [somename.customername] FROM vw_myView;
I'm sorry that actually did work with the brackets! Thanks so much! |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-11-09 : 17:54:40
|
You're welcome |
 |
|
|
|