0

I'm trying to rebuild an U-SQL table with the expression:

ALTER TABLE dbo.Content REBUILD;

It doesn't work and returns the error:

Scripts must contain at least one data write operation or one DDL operation. At least one data write or one DDL operation is required.

ALTER TABLE REBUILD operation was mentioned here, but I didn't find any details about it. Could anyone help me on this problem?

Thanks

Ali
  • 3,373
  • 5
  • 42
  • 54

1 Answers1

1

Thanks for raising this question. One small additional comment on this.

The situation here is that there is nothing to be done when rebuild statement is executed. This error message can be raised in 2 scenarios: - tables is empty - table has been loaded only once

In both cases, rebuild operation is no-op and there is nothing to be rebuilt. Having said that, we could improve error message to indicate rebuild operation is not needed or did not do anything. Another alternative is that executing REBUILD could become no-op and no error message is raised. If there are any thoughts about possible outcome or preferences to choices above, please feel free to provide such comments...

Regards, Igor

Igor
  • 51
  • 2
  • Thanks for your reply Igor, I will delete my answer! : ) – wBob Jan 30 '17 at 19:05
  • I definitely think it should be no-op in that case. Especially since no control flow statements are available. – Alexandre Gattiker Jan 31 '17 at 07:22
  • Hi wBob, thank you for your original answer. The error message mislead me. I thought that I’m using incorrect syntax or something like that. I used the expression on a table that has been loaded only once as a test. I would vote for “no-op and no error message” in this case. I consider the REBUILD operation as "reindexing" in SQL and it should work without errors even there is nothing to rebuild. – Valeri Ilyin Jan 31 '17 at 08:25