0

I'm importing a big flat file (about 400.000 rows and 255+ columns) into SQL Server Management Studio through the import wizard.

To get the right variables I use Suggest types, but I have found that I need to search through all the rows to get the right variable types. It takes a very long time. Is there a way to avoid this or do it faster?

Furthermore, my real goal is to transfer data from one sql server database to another on another computer. I do this by exporting it as a flat file. But maybe this is stupid since I lose the information about the correct format?

Thanks!

1
  • You can use Script with data in SQL Server 2008 and later. It will copy all the information to the related database. In the generated script you might change database name if new database needed on other computer. Commented Feb 3, 2014 at 9:47

2 Answers 2

1

According to Copy one database to another database:

There are several ways to do this, below are two options:

Option 1

  • Right click on the database you want to copy

  • Choose 'Tasks' > 'Generate scripts'

  • 'Select specific database objects'

  • Check 'Tables'

  • Mark 'Save to new query window'

  • Click 'Advanced'

  • Set 'Types of data to script' to 'Schema and data'

  • Next, Next

You can now run the generated query on the new database.

Option 2

  • Right click on the database you want to copy

  • 'Tasks' > 'Export Data'

  • Next, Next

  • Choose the database to copy the tables to

  • Mark 'Copy data from one or more tables or views'

  • Choose the tables you want to copy

  • Finish

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the reply. I tried option 2 for a start, and I managed to export the tables from the database. But how do I import it on the other computer. I have copied the .mdf and .ldf files to the new computer, and I have tried using 'Tasks' > 'Import data', but I can't see where I can specify the location of the .mdf and .ldf files.
please check the sql server installed file location.. Mark answer or upvote if it helped you
1

Backup your database and restores it on the other server (the tager server must be equal or higher version) or simply copy the database files to other server and attached it (when copying database files, you must ensures that either you have detached the database or stop the sql server service).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.