p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Wrox's SQL Server 2005 Express Edition Starter Kit ISBN: 978-0-7645-8923-2 (http://p2p.wrox.com/book-wroxs-sql-server-2005-express-edition-starter-kit-isbn-978-0-7645-8923-2-236/)
-   -   View example failed (http://p2p.wrox.com/book-wroxs-sql-server-2005-express-edition-starter-kit-isbn-978-0-7645-8923-2/42240-view-example-failed.html)

davwein May 7th, 2006 10:56 PM

View example failed
 
When I attempted to try the view example on page 41

using this code:
CREATE VIEW InventoryPublisherView AS
(SELECT * FROM Inventory AS I FULL OUTER JOIN Publisher AS P ON I.ID=P.InventoryID)


I received the following error:

Msg 4506, Level 16, State 1, Procedure IPV, Line 2
Column names in each view or function must be unique. Column name 'ID' in view or function 'IPV' is specified more than once.

I tried using only the code part (in the brackets) - not the view part and the code worked ok. so I am confused as to what went wrong in the view specification.





BigOcean May 15th, 2006 02:53 PM

Hi davwein,

The code statements of Using Views on Page 41 do not work in my Windows XP Pro PC that is on Microsoft Windows NT 4 LAN Syste. I got the following error messages in Parse or Execute without Results:

Msg 156, Level 15, State 1, Procedure InventoryPublisherView, Line 3

Incorrect syntax near the keyword 'SELECT'.

Msg 111, Level 15, State 1, Procedure InventoryPublisherView, Line 6

'ALTER VIEW' must be the first statement in a query batch.

I want to try your modified code statements (that worked in your PC/system - what kind of your PC and LAN System did yopu use?)in my PC. Please post your complete modified code statements on this Forum.
Thanks,
Scott Chang



Scott Chang

willetfarm August 21st, 2010 02:39 PM

Try it out p41
 
This thread looks ancient, but I'll post in case anyone else has the same problem.

I'm running SSMSE 2005 on XP SP3.

davewein received this error message because the tables created earlier, 'Inventory' and 'Publisher' BOTH have columns, defined as primary keys, with the same name, "ID".

One just needs to delete either table and recreate them with differing column names. Once I did this, the queries completed successfully.

Hope this helps


All times are GMT -4. The time now is 09:34 PM.

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.