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 8898101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:31:25+00:00 2026-06-15T00:31:25+00:00

I just converted a MySQL database to SQL Server. I’m complete new to SQL

  • 0

I just converted a MySQL database to SQL Server. I’m complete new to SQL Server, I want to use it with Entity Framework 4, so I shouldn’t be a biggie.

I think I don’t get the concepts about objects in DB and so on. In SQL Server Mgmt Studio I can execute this query

/****** Script for SelectTopNRows command from SSMS  ******/
SELECT TOP 1000 [id]
  FROM [db].[dbo].[mytable]

And it works fine, however if I use this connection string

Data Source=MYPC-PC\;Integrated Security=SSPI;Min Pool Size=5;Max Pool Size=60;Connect Timeout=30

The query will execute fine, but it will exclude the [db], so it will not return any row. This is the query from Entity Framework.

/****** Script for SelectTopNRows command from SSMS  ******/
SELECT TOP 1000 [id]
  FROM [dbo].[mytable]

If I change my connection string to include a Database like this

Data Source=MYPC-PC\;Integrated Security=SSPI;Database=db;Min Pool Size=5;Max Pool Size=60;Connect Timeout=30

I get this error

There is already an object named ‘MyTable’ in the database.

But there is only one table called Table. I have no idea of the concepts behind this. What am I doing wrong? I’m using SQL Server 2012

Update 1

I use code first.

        var result = db.MyTable.Where(x => x.Prop == Prop)
            .OrderBy(x => x.Something)
            .Take(10);

        var data = result.ToList();

My DbContext class

public class Context : DbContext
{
    
     public Context()
    : base("Context")
  {
    // Get the ObjectContext related to this DbContext
    var objectContext = (this as IObjectContextAdapter).ObjectContext;

    // Sets the command timeout for all the commands
    objectContext.CommandTimeout = 12000;
  }

    public DbSet<Models.MyTable> MyTable{ get; set; }


}

And in web.config

  <connectionStrings>
    <add name="Context" providerName="System.Data.SqlClient" connectionString="connectionString"  />
  • 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-15T00:31:27+00:00Added an answer on June 15, 2026 at 12:31 am

    Your table MyTable already exists in the database before first migration. So you can just delete this table and then it will be recreated at first application run.

    EDIT:
    If you don’t want to remove your table and if you use at least EF 4.3 then
    run from the Console Add-Migration InitialMigration -IgnoreChanges
    and then run Update-Database

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

Sidebar

Related Questions

I just converted my SQL Server 2008 database from using a lat/long pair to
I just converted a WebSite to a Web application and put in a new
I want to save the following NSDictionary to a MySQL database: NSDictionary notesDictionary: object:
So I have a MySQL database set up on a Debian server and it
I tried to backup my database following the instruction from SQL Server: Database stuck
We're doing a sort of roll-your-own replication from a SQL Server 2008 R2 database
enter code hereIn my SQL Server database I have my address information for the
I have added Full Text Search to my sql server 2008 express database and
I just converted an Objective-C library to a C library in the hopes of
I just converted a VB.net solution into C# solution. But lots of variables have

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.