exporting the data gives error when the type is 'smalldatetime' and value is null - sql

In SQL server, I have a table with 'smalldatetime' data type for one of the column. When I am trying to export the data using Microsoft SQL server import/export wizard, it is giving me conversion error because the field contains NULL value in Date field. Can you please help me in resolving this error.
What steps need to be followed in order to resolve the conversion error.

Are you trying to copy "table to table" or "query to table"?
Cause if your problem is only with null values you can write a query and use ISNULL() function.
Can you post the error here? I´m asking cause maybe your problem isn´t it. Maybe you´re trying to convert a type into another that is not compatible.

Related

while inserting the values i am getting "invalid number" error

sq
in image you can see that i am getting error "invalid number".
how can i fix this error.
you should check your data types for every column where you want to insert data. For example I see that you try to add data with "$9,99" which seems a little bit strange. May have a look again.
Maybe there is a column of orders which expects a number and you're trying to insert an non-number.
You could double-check the table definition in SQL Developer or by using DESC <table>.

SQL Developer Data is not compatible with column definition

I'm trying to insert data into my table but I am receiving this error:
"SQL Developer Data is not compatible with column definition or is not available for a nut nullable column"
The column that is getting this error has data of the form 7391DBDF-40D5-E523-80C2-3863BB43AC67.
I believe this is a uniqueidentifer but but I'm not sure how one would insert this datatype into SQL Developer.
nvm: got it. Use Varchar
Same error importing good data into a number column with SQLDeveloper, problem was not specifying precision and scale on the column.
Solved by setting size to 28,0.

Google BigQuery: Error: Invalid schema update. Field has changed mode from REQUIRED to NULLABLE

I'm trying to append the results of a query to another table.
It doesn't work and sends out the following error:
Error: Invalid schema update. Field X has changed mode from REQUIRED to NULLABLE.
The field X is indeed REQUIRED, but I don't try to insert any NULL-values into that specific column (the whole table doesn't have a single NULL value).
This looks like a bug to me. Anyone knows a way to work around this issue?
The issue is fixed after switching from Legacy SQL to Standard SQL.

sql data type error when dividing two figures

I have a simple query which states
convert(decimal(20,10),a.sumclk)/ nullif(convert(decimal(20,10),a.sumimp),0) as CTR1
When I run this I get a message saying 'Data Type "sumclk" does not match a Defined Type name.'
I looked around for what this means but I'm stuck
I'm using Teradata
Instead of convert(decimal(20,10),a.sumclk) (which is MSSQL), try CAST(a.sumclk as decimal(20,10)) (which I found on the Teradata forums: http://forums.teradata.com/forum/database/explicit-casting)

SSIS getdate into DateTimeOffset column - data value overflowed the type

I have an SSIS package. The source is a SQL query. The destination is a table. The package worked until I changed a column in a destination table from datetime to datetimeoffset(0).
Now, all records fail with a "Conversion failed because the data value overflowed the type used by the provider" error on this particular column.
The value in the source query is getdate(). I tried TODATETIMEOFFSET(getdate(),'-05:00') without success.
In fact, the only thing that has worked so far is to hard code the following into the source query:
cast('3/14/12' as datetime)
The only other interesting piece of information is that the package worked fine when running the source query against another server implying that maybe a setting is involved - but I see no obvious differences between the two servers.
I was going to suggest to add a "data conversion component" to deal with it, but since you changed only on the destination, it means that you can change your source query to do:
select cast(YOUR_DATE_COLUMN as datetimeoffset(0))
In case anyone else is looking, we found an alternative solution that works if the source is in SQL 2005 (no support for datetimeoffset).
select dateAdd(minute,datediff(minute,0,getutcdate()),0)
The intent is to reduce the precision. Granted I also lose seconds but if I try the above line with seconds I get an overflow error.