Results 1 to 3 of 3

Thread: [RESOLVED] Creating a database from sql server file in VS

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2009
    Posts
    230

    Resolved [RESOLVED] Creating a database from sql server file in VS

    I've got a SQL file from a previous database I exported from a SQL Server via SSMS. Now I want to create an mdf file from it in visual studio. I've tried running a sql query but it doesn't work as it's referencing the old sql server. How can I fix this please?

  2. #2
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Creating a database from sql server file in VS

    Post the query that you're using to try to create this database.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2009
    Posts
    230

    Re: Creating a database from sql server file in VS

    Thanks but I've sorted it by by following these steps:

    1. remove the "USE database" statements at the start and end of the sql server generated query
    2. create a mdf file by right clicking the app_code folder and choosing new item> sql server database in the solution explorer
    3. double click the new database to show the database explorer window
    4. right click on the database > new query
    5. copy and paste the query in the open window and run it

Posting Permissions

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



Click Here to Expand Forum to Full Width