09.12.2010, 16:11 | #1 |
Участник
|
emeadaxsupport: How to delete orphaned data remained from deleted company?
Источник: http://blogs.msdn.com/b/emeadaxsuppo...d-company.aspx
============== In AX 2009 it may happen that you delete a company but data related to this company remain in the database. You can use this SQL script to delete this data: DECLARE @_tableName nvarchar(40) DECLARE @_companyId nvarchar(4) SET @_companyId = -- replace with required company DECLARE curSqlDictionary CURSOR FOR SELECT A.SQLNAME FROM SQLDICTIONARY A INNER JOIN SQLDICTIONARY X ON X.TABLEID = A.TABLEID AND X.FIELDID = 61448 WHERE A.FIELDID = 0 AND A.FLAGS = 0 OPEN curSqlDictionary FETCH NEXT FROM curSqlDictionary INTO @_tableName WHILE @@FETCH_STATUS = 0 BEGIN DECLARE @_sql nvarchar(4000) SET @_sql = N'DELETE FROM ' + QUOTENAME(@_tableName) + N' WHERE DATAAREAID = @_dataAreaId' EXEC sp_executesql @_sql, N'@_dataAreaId nvarchar(4)', @_dataAreaId = @_companyId FETCH NEXT FROM curSqlDictionary INTO @_tableName END CLOSE curSqlDictionary DEALLOCATE curSqlDictionary --author:Martin Falta--editor:Daniel Durrer--date:09/Dec/2010 Источник: http://blogs.msdn.com/b/emeadaxsuppo...d-company.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|