DECLARE @TableName varchar(max)=NULL SELECT @TableName=COALESCE(@TableName+',','')+t.TABLE_CATALOG+'.'+ t.TABLE_SCHEMA+'.'+o.Name FROM sysindexes AS i INNER JOIN sysobjects AS o ON i.id = o.id INNER JOIN INFORMATION_SCHEMA.TABLES T ON T.TABLE_NAME=o.name WHERE i.indid < 2 AND OBJECTPROPERTY(o.id,'IsMSShipped') = 0 AND i.rowcnt >350000000 AND o.name NOT LIKE '%Temp_MesajHareketDB%' AND o.name NOT LIKE '%Temporary%' AND o.xtype !='TF' ORDER BY o.name ASC