This is a discussion on What's wrong with this View? Duplicate columns? within the SQL Server forums, part of the Microsoft SQL Server category; --> When I add this code in a view and try to save . . . SELECT TOP 610 * ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| When I add this code in a view and try to save . . . SELECT TOP 610 * FROM dbo.Master INNER JOIN dbo.TypeByCase ON dbo.TypeByCase.CaseNum = dbo.Master.CaseNum It gives the error: ODBC error: [Microsoft][ODBC SQL Server Driver]Column names in each view or function must be unique. Column name 'CaseNum' in view or function 'dbo.BobView1' is specified more than once. Any idea why? Thanks, RBollinger |
| ||||
| robboll (robboll@hotmail.com) writes: > When I add this code in a view and try to save . . . > > SELECT TOP 610 * > FROM dbo.Master INNER JOIN > dbo.TypeByCase ON dbo.TypeByCase.CaseNum = dbo.Master.CaseNum > > It gives the error: > ODBC error: [Microsoft][ODBC SQL Server Driver]Column names in each > view or function must be unique. Column name 'CaseNum' in view or > function 'dbo.BobView1' is specified more than once. > > Any idea why? The error message appears to be crystal clear to me. You have a column CaseNum in both tables, and you cannot have the same column twice in a query. I am sorry, but if this answer does not help you, I will have to ask you to: o Post the CREATE TABLE statement for the tables in question. o The CREATE VIEW statement you are using. o Why you think this should work. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |