d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Easy Sql Help?
Add Reply New Topic New Poll
Member
Posts: 20,165
Joined: Dec 5 2007
Gold: 692.20
Sep 23 2012 04:36pm
I'm trying to create a new view using this code with Access 2010
Code
CREATE VIEW Housewares AS
 SELECT PartNum, Description, OnHand, Price
 FROM Part
 WHERE Class = HW
;


When I do, I get this error:
Quote
Syntax error in CREATE TABLE statement. (Error 3290)

And then it highlights the word "VIEW"

I'm literally copy pasting the code from the source, so I don't see how there is a syntax error.

Any help? I feel like I'm missing something obvious

This post was edited by Aurorae on Sep 23 2012 04:40pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 23 2012 04:46pm
As soon as I saw "Access" i knew that was your problem. Dunno why you're using it and I'm not sure I wanna know.

http://www.pcreview.co.uk/forums/do-use-create-view-access-2003-a-t1685655.html

http://www.utteraccess.com/forum/Create-View-Access-t1924479.html


This post was edited by carteblanche on Sep 23 2012 04:48pm
Member
Posts: 20,165
Joined: Dec 5 2007
Gold: 692.20
Sep 23 2012 04:54pm
Thanks for the help.

I found the solution here:
http://stackoverflow.com/questions/6163836/is-it-possible-to-create-a-view-in-access-2010

Just got rid of the "CREATE VIEW Housewares AS" part.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 23 2012 04:55pm
Quote (Aurorae @ Sep 23 2012 06:54pm)
Thanks for the help.

I found the solution here:
http://stackoverflow.com/questions/6163836/is-it-possible-to-create-a-view-in-access-2010

Just got rid of the "CREATE VIEW Housewares AS" part.


in other words you stopped using the view.
Member
Posts: 20,165
Joined: Dec 5 2007
Gold: 692.20
Sep 23 2012 05:03pm
From what I understand, we're writing query's in SQL and using them as views.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 23 2012 09:05pm
Quote (Aurorae @ Sep 23 2012 07:03pm)
From what I understand, we're writing query's in SQL and using them as views.


so you're making subselects?

eg:

SELECT PartNum, Description, OnHand, Price FROM (
SELECT PartNum, Description, OnHand, Price
FROM Part
WHERE Class = HW)

?

seems a little pointless imo, but whatever your teacher wants. i rarely use views, typically when we aggregate from multiple tables, use abnormal data types (eg: geometric or custom), or use many joins/functions.

This post was edited by carteblanche on Sep 23 2012 09:06pm
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll