AnsweredAssumed Answered

Query Layer Won't Retain Attribute Values When Coverted to Table

Question asked by lloydbronn on Dec 6, 2016
Latest reply on Dec 7, 2016 by lloydbronn

So I'm starting to work with ArcGIS and SQL Server. I've successfully made a DB connection in ArcMap and created a query layer. I'm trying to automate this process with Python and I'm aware of the bugs involved and I found this workaround involving arcpy.Describe. 


arcpy.MakeQueryLayer_management(DB_Conn, query_layer, "SELECT * FROM CMORPH_Test.dbo.cmorph_data WHERE precipmm > 1", "OBJECTID", "", "", spatial_reference)
desc = arcpy.Describe(query_layer)
query_table = arcpy.mapping.TableView(


This creates an info table. The problem is, each one of the records in the SQL server contains a date field (called "day") formatted like this: 19980101. When I open the info table in ArcMap or convert it to a dbf, the date field is now zero. 


Any ideas why this would happen?