I am trying to pull the data from multiple data extensions to another DE and i am using union to achieve it.Also I have subscriber key as a primary key in the target data extension.However i get system error at times and don't get any error messages.And this error is not constant it occurs sometimes and not all times.All three tables contains different data no duplicates. Below is my sql query
SELECT [uid] As [Subscriber Key],
[Email] As [Email Address],[Email Opt Out],
CASE WHEN [Email Opt Out] = 0 THEN 'useroptedin'
ELSE 'useroptedout' END AS Status
FROM [sfcontacts]
Union
SELECT
[uid] As [Subscriber Key],[Person Account: Email] As [Email Address],[Person Account: Email Opt Out],
CASE WHEN [Person Account: Email Opt Out] = 0 THEN 'useroptedin'
ELSE 'useroptedout' END AS Status
FROM [sfcontacts1]
Union
SELECT
[uid] As [Subscriber Key],[Person Account: Email] As [Email Address],[Person Account: Email Opt Out],
CASE WHEN [Person Account: Email Opt Out] = 0 THEN 'useroptedin'
ELSE 'useroptedout' END AS Status
FROM [sfcontacts2]