Skip to content

Instantly share code, notes, and snippets.

@davidajacobus
Created April 25, 2020 00:00
Show Gist options
  • Save davidajacobus/0a725707faeedb4c176e8322666633e2 to your computer and use it in GitHub Desktop.
Save davidajacobus/0a725707faeedb4c176e8322666633e2 to your computer and use it in GitHub Desktop.
T-SQL
/*
RENAME ALL TABLES, DROPPING THE PREFIX
*/
select 'exec sp_rename @objname=''' + name + ''', @newname=''' + replace(name ,'tbl', '') + ''''
from sysObjects
where type = 'U' and name like 'tbl%'
order by replace(name ,'tbl', '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment