troubleshooting Question

Could you explain and give a workaround on what is causing an UNION ALL to consider an original char(8) column by using MSSQLServer?

Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil asked on
Microsoft SQL Server
11 Comments1 Solution22 ViewsLast Modified:
Hi Experts

Could you explain and give a workaround on what is causing an UNION ALL to consider an original char(8) column from the constituent tables that had be uncorrectly considered as an int  column at the resultant table,  by using MSSQLServer?

Accordingly to:



SELECT *
  INTO  TargetTable
FROM
(
SELECT  * FROM dbo.LOG_LOGRADOURO_AC_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_AL_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_AM_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_AP_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_BA_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_CE_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_DF_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_ES_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_MA_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_MG_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_MS_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_MT_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_PA_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_PB_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_PE_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_PI_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_PR_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_RJ_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_RN_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_RO_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_RR_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_RS_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_SC_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_SE_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_SP_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_TO_OK
UNION ALL
SELECT  * FROM dbo.LOG_LOGRADOURO_GO_OK
) a

Thanks in advance
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros