×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Create new table from another table values

Create new table from another table values

Create new table from another table values

(OP)
Hi,
How can I select all or part of the data from a table, create a new table and insert all the selected data in it.

My query would look like Select * from table but how can I create a new table and insert those data in it.
Thanks for your help

RE: Create new table from another table values

What version of Pervasive are you using? What is your goal for this process? Rather than create a new table, you might want to consider a VIEW.
To answer the question, you can use the SELECT INTO syntax. For example:

CODE

SELECT t1.f1, t1.f2 INTO #mytmptbl FROM t1 WHERE f1 < 100 
The statement above will create a temporary table called #mytmptbl and insert records that match the restriction (f1 < 100).

The same statement can be made into a VIEW and reused easier:

CODE

CREATE VIEW v1 as SELECT t1.f1, t1.f2 FROM t1 WHERE f1 < 100 

and then used with:

CODE

SELECT * FROM v1 

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: Create new table from another table values

(OP)
I am using Pervasive 11.

Since I am having problems converting with Access, the purpose is to create a new table with only part of the table. I can then use this new table, or give it to my helper to create some crystal report when I am too busy.

I just do not want them to connect directly to the master database.

RE: Create new table from another table values

Rather than create a new table, why not figure out why the queries aren't running properly. Creating a new table will only add to the complexity.

The syntax I posted will work in v11 however it will only create a new PSQL table. It won't create an Access table.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: Create new table from another table values

(OP)
I will check the queries in Crystal report, but It would be nice if the query worked the same against Pervasive and Access.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close