Изменение INT на BigInt

Попробуйте очистить кеш градиента и amp; выполните, запустив каждую строку в терминале:

gradlew --stop
gradlew cleanBuildCache
gradlew clean
28
задан Raj More 22 September 2009 в 20:18
поделиться

4 ответа

If one or more of those columns have no constraints against them (like a foreign key, index, default, rule, etc), you should be able to change each one quickly by doing

ALTER TABLE monster ALTER COLUMN MyIntCol1 bigint

Management Studio's change SQL is rarely the most efficient and tends to favour temporary tables for anything modifying an existing column.

53
ответ дан 28 November 2019 в 02:20
поделиться

to expand on OrbMan's answer:

  • add the new columns at the bottom of the column list (this will speed it up a lot)
  • you can do your updates in batches of 10,000 rows or so if necessary
  • make sure you are in single user mode, or the application if "OFF" so no one else changes data in that table

Also, to see all the work that Management studio does when you change a table, click on the toolbar icon that looks like scroll with a diskette on it. This will show the actual SQL commands used to alter your table.

2
ответ дан 28 November 2019 в 02:20
поделиться

Не уверен, что это поможет, но попробуйте следующее:

1 - create a new bigint column in the table
2 - update that new column with the values from the int column
3 - delete the int column
4 - rename the bigint column
28
ответ дан 28 November 2019 в 02:20
поделиться

Я думаю, что основная ошибка, с которой вы можете столкнуться, заключается в том, что время ожидания истекает из-за графического интерфейса. Когда вы применяете большое изменение с помощью выбора «Изменить» в SSMS, время ожидания истекает. Если вы выполните ту же команду, сгенерировав сценарий изменения в SSMS, а затем запустите как прямой запрос SQL, он будет выполняться до завершения.

7
ответ дан 28 November 2019 в 02:20
поделиться
Другие вопросы по тегам:

Похожие вопросы: