Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8106885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:36:03+00:00 2026-06-06T00:36:03+00:00

We are rewriting a foxpro database to SQL. I encountered the following scenario. Foxpro

  • 0

We are rewriting a foxpro database to SQL. I encountered the following scenario. Foxpro can create two cursors with the same name under two different if statements.

I tried to do the same in SQL. Created two temporary tables. Something like below:

IF @id = 1
BEGIN
SELECT * INTO #abc from table1
END

IF @id = 2
BEGIN
SELECT * INTO #abc frm table2
END

NEXT here I write a code to update the values of a temporary table column with another column. But sql throws me an error saying ‘there is already an object named #abc in the database’.

Can I please have a solution to this?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:36:04+00:00Added an answer on June 6, 2026 at 12:36 am

    For your specific use case given that both have the same structure you could use.

    IF @id IN ( 1, 2 )
      BEGIN
          SELECT *
          INTO   #abc
          FROM   table1
          WHERE  @id = 1
          UNION ALL
          SELECT *
          FROM   table2
          WHERE  @id = 2
      END 
    

    to avoid the parser issue you are encountering. I agree with Ben’s comment though that a literal translation of the FoxPro code is likely going to lead you with an inefficient and unmaintainable mess.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can Apache be rewriting URLs without mod_rewrite enabled or configured? I'm working on
I'm using URL Rewriting under ASP.NET 4 (using ISAPI_Rewrite) and I'm finding that that
I'm new to rewriting and I was looking for the regex that I can
I`m rewriting an application that use MS Access as the database. I was able
Im rewriting application from .NET to PHP. I need to create class like this:
I'm rewriting one of our forms so that it can handle international domains, but
We are rewriting our legacy accounting system in VB.NET and SQL Server. We brought
I'm rewriting some messy code that manages a database, and saw that the original
I'm rewriting an application so that we can stop using the old Microsoft.Web.Services2.Security.X509 from
I had the following rewriting set up in my .htaccess file: RewriteRule ^(\w+)/?$ profile.php?customURL=$1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.