9

I am new to SQL Server 2014 and I was trying to generate data script from a database but I kept getting this error:

Error getting list of objects from db_name

The query for creating tables and inserting data was successful and generating schema script was successful too. I did some research and found this link.

I did turn auto close option off according to a guy's reply but it didn't work, I followed up on the link to another thread but there's nothing.

5
  • 1
    can you tell what are the steps you are followed? Commented Mar 21, 2016 at 5:21
  • simple, basic steps: first I create database named infoDB, then 3 tables plus setting up primary keys and foreign keys. Then I insert into these table 5 rows of data each Commented Mar 21, 2016 at 5:47
  • I can show you the query here @bmsqldev Commented Mar 21, 2016 at 5:53
  • Databasename -> Right Click-> Generate Scripts. Is this the way you generate the scripts? Commented Mar 21, 2016 at 6:58
  • yes, then I change the script type in advanced option to "data only" @bmsqldev Commented Mar 21, 2016 at 15:29

2 Answers 2

10
  1. Click on "Save Report" button
  2. Open the generated file and analyze the message regarding the error, this can give a clue on how to solve the problem.

In my case was that the sql output file was being used by another process. I closed the SQSMS, reopened and that's it.

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

2 Comments

I had cyclic dependencies - fixed with this answer: stackoverflow.com/a/26925004/4378740
Oddly, when I clicked Save Report it decided to try the first step again and then successfully went through all the steps and generated the script (not sure if any report was saved?)
6

I ran into this issue and what appeared to solve it for me was to generate a "schema only" script. Once this is successful, go back and try to generate the "data only" script again.

1 Comment

I tried this and the first error was gone, but then I get Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index (mscorlib)

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.