Unix Technical Forum

What's wrong with this View? Duplicate columns?

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 * ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 07:13 AM
robboll
 
Posts: n/a
Default What's wrong with this View? Duplicate columns?

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 07:13 AM
Erland Sommarskog
 
Posts: n/a
Default Re: What's wrong with this View? Duplicate columns?

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:30 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com