SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Hybrid View

  1. #1
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I run a query on Access?

    I have a query that I'd like to run, I dumped this from my MySQL.
    Code:
    CREATE TABLE News_Authors (
       author_id int(4) NOT NULL auto_increment,
       username varchar(255) NOT NULL,
       password varchar(255) NOT NULL,
       author_email varchar(255),
       author_name varchar(255) NOT NULL,
       PRIMARY KEY (author_id)
    );
    
    CREATE TABLE News_Stories (
       story_id int(4) NOT NULL auto_increment,
       story_date timestamp(14),
       author_id int(4) DEFAULT '0' NOT NULL,
       story_title varchar(255),
       story_body text,
       PRIMARY KEY (story_id)
    );
    I want to just copy and paste the sql into something, but I can't find where!

    I know this is a really basic question and it is probably blaringly obvious but I can't seem to find it!

  2. #2
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Open Access and create a new table without the wizard. You should what looks like a design view. In the upper left corner is an option for the SQL view. Paste your code there, although, you'll want to do each of those two blocks in a seperate table since they create their own table.

    You may also be able to do the same thing from the SQL view of the query page.
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com

  3. #3
    Yugo full of anvils bronze trophy hillsy's Avatar
    Join Date
    May 2001
    Location
    :noitacoL
    Posts
    1,859
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So you want to run that SQL in Access?

    1) Go to the "Queries" tab in Access
    2) Create a new query in Design View
    3) When the Query Designer comes up (looks like a horizontally split window), cancel out of opening any tables and go to View --> SQL View
    4) Paste your SQL into the editor

    This is how you could do it under Access 97 anyway
    that's me!
    Now A Pom. And a Plone Nut
    Broccoli Martinez Airpark

  4. #4
    + platinum's Avatar
    Join Date
    Jun 2001
    Location
    Adelaide, Australia
    Posts
    6,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, wot hillsy said
    Click Queries,
    create new query,
    right click somewhere in the new window and select SQL view and copy and paste right there

  5. #5
    SitePoint Addict -TheDarkEye-'s Avatar
    Join Date
    Feb 2001
    Location
    canada
    Posts
    286
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by westmich
    Open Access and create a new table without the wizard. You should what looks like a design view. In the upper left corner is an option for the SQL view. Paste your code there, although, you'll want to do each of those two blocks in a seperate table since they create their own table.

    You may also be able to do the same thing from the SQL view of the query page.
    there is no sql view for tables. he would have to run this as a query.

  6. #6
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is alot more complicated than it should be..

  7. #7
    SitePoint Wizard wdmny's Avatar
    Join Date
    Jul 2000
    Location
    Here
    Posts
    1,010
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A much simpler method....... under the Enterprise Manager in SQL Server, Export your database (or choose specific tables) to an Access database.

  8. #8
    Yugo full of anvils bronze trophy hillsy's Avatar
    Join Date
    May 2001
    Location
    :noitacoL
    Posts
    1,859
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's the problem with running this as a query?
    that's me!
    Now A Pom. And a Plone Nut
    Broccoli Martinez Airpark

  9. #9
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by -TheDarkEye-


    there is no sql view for tables. he would have to run this as a query.
    My mistake

    This is alot more complicated than it should be..
    I don't think it could much simpler then cutting and pasting.
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •