Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

edit shchima table in sql

declare @sql varchar(8000), @table varchar(1000), @oldschema varchar(1000), @newschema   varchar(1000)

  set @oldschema = 'hts-shop_com_User'
  set @newschema = 'dbo'

 while exists(select * from sys.tables where schema_name(schema_id) = @oldschema)
  begin
      select @table = name from sys.tables 
      where object_id in(select min(object_id) from sys.tables where  schema_name(schema_id)  = @oldschema)

    set @sql = 'alter schema ' + @newschema + ' transfer [' + @oldschema + '].' + @table
	print @sql
   exec(@sql)
 end
 
PREVIOUS NEXT
Tagged: #edit #shchima #table #sql
ADD COMMENT
Topic
Name
6+6 =