Using SQL Server bcp to migrate data from datetime to datetimeoffset - sql-server

I have two tables with almost the same structure, one in SQL Server 2005 and the other in SQL Server 2016. The only difference is that column ModifiedDate is of type datetime in SQL 2005 and datetimeoffset in SQL 2016.
I used bcp to export the data from SQL 2005 in native format to a file. Then I tried to use bcp to import the data file to SQL 2016. I got error:
[ODBC Driver 11 for SQL Server] Invalid field size for datatype
If I removed ModifiedDate column, export/import would run without any errors.
Does anybody know how to solve the problem?

When you export with BCP, instead of doing an OUT export directly for a table, do a QUERYOUT export with a query that converts the DATETIME field to a field with a format that is convertible to DATETIMEOFFSET.

Related

Spatial Data Migration: from Oracle to SQL Server using SSMA

I'm migrating tables and views from Oracle to SQL Server using SSMA. I have a number of tables that have columns with SDO_GEOMETRY datatype, SQL Server does not work with that.
How could I map SDO_GEOMETRY to SQL Server? If it's not possible, then what should be done using SSMA?
And is it possible to work out this issue without editing anything in the Oracle database (just using SSMA or SQL Server)?
Oracle use an internal specific Oracle format of geo data that is non standard... Convert it to WKB or WKT and it should works.

SSIS SQL Server to Excel

I am trying to use SSIS to export a BigInt data type from SQL Server 2016 to Excel 2016 (.xlsx).
I'm having trouble with mapping the BigInt column to Excel. What is the data type to use for Excel?
Thanks

SQL Server export wizard default mapping for datetime column is wrong

I'm using SQL Server 2017 Developer Edition. When i tried to export my database to a 2014 Developer Edition instance, somehow its default column mapping changed all my datetime columns to smalldatetime. Is there anyway i can config the default mapping ?

Copy arabic data from old SQL server database

I have existing data in SQL Server 2008 that has Arabic data in varchar column that I need to copy to SQL Server 2014. When I query the data I see text like èíë¢ïëë¢é Is there a solution. Can I do it through C# application.
I have tried INSERT using Arabic Collation on the source, bcp utility to export using codepage 1256.

Can't see data in SQL Server database table

I can't see data in SQL Server database table. The column is of nvarchar(MAX) not null.
It stores json string in string format.
When I run query Select * from table, I can see the data in output window, but can't see when I open table using edit top 200 rows.
You need to update your SQL Server Management Studio (SSMS) to the latest version. This problem occurs if you use SSMS v. SQL 2008 for working with SQL server 2014.

Resources