I write this code but don’t update my columns name
DECLARE @sql NVARCHAR(MAX) = '';
DECLARE @tableName NVARCHAR(128) = 'dbo.tkp_WorkingPeriodStatisticsExtra';
SELECT @SQL = N'EXEC sp_rename N' + t.[name] + N'.' + s.[name] + N',N' + Replace(s.[name],N'k',N'z') + N';'
FROM sys.columns s
JOIN sys.tables t ON s.object_id = t.object_id
WHERE t.name LIKE '%dbo.custommer%'
I don’t have any exception and query is run
New contributor
sara mln is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1