Urgent.News

What's breaking now, across thousands of outlets.

Tech

Renaming a column in SQL Server, and what it quietly breaks

A column was misspelled when the table was created, and it has been Ammount ever since. The rename itself is one line: EXEC sp_rename 'dbo.Invoice.Ammount' , 'Amount' , 'COLUMN' ; Caution: Changing any part of an object name could break scripts and stored procedures. That caution is the entire problem, stated once and never mentioned again. The rename succeeds. What breaks, breaks later, and in a…

Renaming a column in SQL Server can cause unexpected problems. The example given was a misspelled column called Ammount. The SQL command to rename the column is EXEC sp_rename dbo.Invoice.Ammount, Amount, COLUMN;. While the rename operation itself works fine, it can break scripts and stored procedures that reference the old column name. These issues are not immediately apparent, and can cause failures when the renamed column is used later on.

For example, a view called InvoiceTotal that selects from the Invoice table will fail with an error stating that the column "Ammount" is invalid. Similarly, a stored procedure called GetInvoice will also fail with the same error. This means that after renaming a column, all objects that reference that column must be updated before they can be used again. If not, they will continue to produce errors, causing issues for anyone who uses those objects.

To avoid these problems, it is important to carefully review all objects that use the renamed column before making the change. This can be done by querying the sys.dm_sql_referencing_entities system view to see which objects reference the column, and then searching their definitions for the old column name. By doing this, any necessary updates can be made before the rename is performed, and the operation can be completed without any unexpected issues.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

NocoDB app matches point to API token governance

NocoDB app matches point to API token governance NocoDB turns databases into spreadsheet-like applications. A self-hosted deployment can contain customer records, internal inventories, workflow data…

  • NocoDB app exposes sensitive API tokens in 703 internet instances
  • Documentation outlines API token management and SSO workspaces
  • Mitigation includes reviewing access controls and token lifecycle

Build a PWA Icon Pack in the Browser: 8 Sizes, a Manifest and a README

I work on OnePassApps. We build browser studios that do their work in the tab instead of uploading your files, and Icon Studio is the one for icons: eight tools on one tab bar - SVG to PNG, PNG to…

  • Icon Studio creates complete PWA icon sets in browser
  • Generates 8 sizes, manifest, README in single ZIP file
  • Supports SVG/PNG up to 5/24 MiB, outputs up to 512px

More from Tuesday 3 November →