This question already has answers here:
Why does Oracle 9i treat an empty string as NULL?
(10 answers)
Closed 9 years ago.
I have successfully converted an existing app's database from SqlServer to Oracle.
Everything works fine, but empty strings.
The app normally stores empty strings into the not null nvarchar2 fields which Oracle silently converts them to null and causes the following error:
ORA-01400: cannot insert NULL
Is there any workaround for this?
Note: I'm using Oracle Managed Driver ODP.NET + NHibernate Castle Active Record
you can use nvl(column_name,'')
Good Luck
Related
This question already has answers here:
What does a timestamp in T-Sql mean in C#?
(4 answers)
Closed 4 years ago.
My client is using Insight.Database for SQL Server ORM, using C# as the client. I have encountered a SQL Server 2017 database datatype 'Timestamp' and I am unsure what the C# entity type should be? I have downloaded the code for the Insight.Database and have globally searched for Timestamp, but results are empty.
Any ideas what datatype in C# would best represent a SQL Server Timestamp datatype?
It would be a byte array as that's what you'd use for varbinary.
https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings
This question already has answers here:
error, string or binary data would be truncated when trying to insert
(19 answers)
Closed 5 years ago.
I trying to write to a database, I have it connected, but I keep getting this
Error:
SqlException: String or binary data would be truncated.
What is causing it and How do I fix it so I can write to the database?
It sounds like the data you are trying to commit to the database is larger than the allocated size for that field. As an example, you are trying to commit 50 characters to a field but the field is only allocated 10 characters. Check the data you are commiting and the size allocation of the field in the database.
This question already has answers here:
Serializing and Deserializing Expression Trees in C#
(7 answers)
Is it possible to dynamically compile and execute C# code fragments?
(7 answers)
Closed 7 years ago.
I wonder if it is possible to convert text to C# code for dynamic validation. For example, I'd love to be able to store a string in my DB like this:
((Value.StartsWith("CR") || Value.StartsWith("TRC")) && Value.Length == 10)
Then - pull it from the DB and use it to validate data. If would automatically swap out Value for the piece of data I'm trying to validate.
All validations would return a boolean that I would use in the code to see if the data being tested passed or failed.
I would have numerous variations of validations similar to the one above like this stored in my DB.
I've tried researching various phrases on Google but can't seem to think of what this might be called?
This question already has answers here:
Mysql server does not support 4-byte encoded utf8 characters
(8 answers)
Closed 7 years ago.
I have a integration with facebook and have notice that thay sends for example u+1f600 that is called a grinning face. When I try to store this in the MySQL Text field I get Server does not support 4-byte encoded so a fast solution is to remove all these special chars from the string.
The question is how? I know about the u+1f600 but I suspect that there could be more of them.
Consider switching to MySQL utf8mb4 encoding... https://mathiasbynens.be/notes/mysql-utf8mb4
This question already has answers here:
Convert any object to a byte[]
(12 answers)
Closed 7 years ago.
I did a select statement in sql and 1 of the column return me this.
There is a need to query from that sql column, but as this is an existing system, I can only try and error.
From the characters, I have already confirmed if the numbers inside is 0015, I should get 15.
Problem is as you can see above, it contains more than one number, and I have to compare the numbers.
Using SQL Server and C# programming, can some1 guide me on how to retrieve these individual numbers in sql server as well as the data type in C#
In C#, you can directly assign ASCII codes to char. So, for instance,
char c = (char)0x0041;
will assign character repesented by 0x0041, which in this case is 'A', directly to c. You can later convert to string, if necessary, by executing
string s = new string(c);