problem

Topics: Developer Forum
Feb 19, 2007 at 9:58 PM
I have this problem when import a shape file!!!
which is the problem?
thanks.

C:\temp>msscmd -server=sonyvaio\sqlexpress -db=GisDB -table=stradeok -import=shp
-shp_filename="C:\temp\shp\stradeok.shp"

Unhandled Exception: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow
. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value)
at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value)
at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value)
at System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb)
at System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, In
t32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject sta
teObj)
at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 ti
meout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserSt
ateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBe
havior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehav
ior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult
result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult res
ult, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at StoredProcedures.ImportFromDatasource(IProvider datasource, String schemaN
ame, String tableName, String columnName, Int32 srid, String type, String connec
tionString, ImportFromDatasourceProcess process, Int32& importedRows, TimeSpan&
elapsedTime)
at StoredProcedures.ImportFromShapefileMain(String shapefile, String schema_n
ame, String tablename, String columnname, Int32 srid, String type, String conn
ectionString, Int32& importedRows, TimeSpan& elapsedTime)
at MsSqlSpatialConsole.Program.ImportShp(ArgParser arg, String schema, String
table, String column, Int32 srid, String type, String connectionString)
at MsSqlSpatialConsole.Program.Main(String[] args)
Feb 20, 2007 at 10:46 AM
From what I can gather, it appears that your installation of SQL Server is treating 2-digit dates as being be between 1753 and 1999. Some of your dates within your data must therefore be after 1999 (or before 1753; less likely though). I'd suggest finding out how to change the way that SQL Server treats 2-digit dates to a more sensible way - ie. something like 1853-2099 instead.

I haven't worked with dates within my SHP files though, so I'm not sure how this would affect data importing :)