How do I check if a SQL Server text column is empty?

I am using SQL Server 2005. I have a table with a text column and I have many rows in the table where the value of this column is not null, but it is empty. Trying to compare against '' yields...

Which MySQL data type to use for storing boolean values

Since MySQL doesn't seem to have any 'boolean' data type, which data type do you 'abuse' for storing true/false information in MySQL? Especially in the context of writing and reading from/to a PHP...

Should I use the datetime or timestamp data type in MySQL?

Would you recommend using a datetime or a timestamp field, and why (using MySQL)? I'm working with PHP on the server side.

SQL Server Text type vs. varchar data type

I have variable length character data and want to store in SQL Server (2005) database. I want to learn some best practices about how to choose TEXT SQL type or choose VARCHAR SQL type, pros and...

Appropriate datatype for holding percent values?

What is the best datatype for holding percent values ranging from 0.00% to 100.00%?

Why doesn't SQL Server support unsigned datatype?

I am specifically thinking about unsigned int. Here is a practical example: what do you do when your identity column maxes out? It's possible to either go BigInt (8 bytes storage instead of 4) or...

Entity Framework Code First Date field creation

I am using Entity Framework Code First method to create my database table. The following code creates a DATETIME column in the database, but I want to create a DATE...

How to get the SqlType of a column in a DataTable?

I have a DataTable obtained from a SQL DataBase, like this: using (SqlCommand cmd = new SqlCommand(query, _sqlserverDB)) { using (SqlDataAdapter adapter = new SqlDataAdapter(cmd)) { ...

Is there any difference between integer and bit(n) data types for a bitmask?

I am working with a table in a PostgreSQL database that has several boolean columns that determine some state (e.g. published, visible, etc.). I want to make a single status column that will store...

MySQL char & varchar character sets & storage sizes

Wondering how much actual storage space will be taken up by these two datatypes, as the MySQL documentation is slightly unclear on the matter. CHAR(M) M × w bytes, 0 <= M <= 255, where w is...

What is the corresponding C++ data type to the SQL numeric(18,0) data type?

What is the corresponding C++ data type to the SQL numeric(18,0) data type? I need a data type in C++ to store numeric(18,0) of SQL in it.

Is it possible to change the datatype of a column in a view?

Usually I run a script like this: ALTER TABLE [TABLE] ALTER COLUMN [Column] NVARCHAR(40); The result is that the field in the table gets converted to nvarchar. But what is the syntax for doing...

what is the right data type for unique key in postgresql DB?

which data type should I choose for a unique key (id of a user for example) in postgresql database's table? does bigint is the one? thanks

How to convert Nvarchar column to INT

I have a nvarchar column in one of my tables. Now I need to convert that column values to INT type.. I have tried using cast(A.my_NvarcharColumn as INT) and convert (int,...

Best data type to store money values in MySQL

I want to store many records in a MySQL database. All of them contains money values. But I don't know how many digits will be inserted for each one. Which data type do I have to use for this...

SQLAlchemy: How to conditionally choose type for column by depending on its backend

I want to use HSTORE type for a column if it uses PostgreSQL as its backend, or PickleType otherwise. The problem is that we cannot determine which backend will be used when schema is being...

Issues with ODBC Drivers formatting date fields incorrectly

I have been having problems with using mulitple ODBC connections with different drivers to linked tables. When I use the ODBC driver 'SQL Native Client 10.0' the dates format correctly (For...

How to get a list column names and datatypes of a table in PostgreSQL?

How can I get a list of column names and datatypes of a table in PostgreSQL using a query?

Import datatype DECIMAL from CSV to SQL server

When importing a file.csv to sql server 2008 I am getting a problem. In my file.csv the decimal is written in this way: (ex. 1234,34112) and It seems that SQL server does not understand the ',' as...

How to change VARCHAR type to DATETIME using ALTER in Postgresql?

How can I change VARCHAR() type to DATETIME using ALTER in Postgresql? The column data is already structured like: "2013-12-08 16:09:07"

Is "NUMBER" and "NUMBER(*,0)" the same in Oracle?

In Oracle documentation it is mentioned that NUMBER (precision, scale) If a precision is not specified, the column stores values as given. If no scale is specified, the scale is zero. But NUMBER...

Writing datetime.datetime() column using pandas.to_sql()

I have a single column dataframe df which has column TS where In [1]: type(df.TS.values[0]) Out[1]: pandas.tslib.Timestamp I convert the column to type datetime.datetime() In [2]: import...

store only date in database not time portion C#

I have a test class and an ExecutionDate property which stores only date but when we use [DataType(DataType.Date)] that also stores the time portion in database but I want only date...

How can I set a size limit for an "int" datatype in PostgreSQL 9.5

I am experimenting with PostgreSQL coming from SQL using MySQL and I simply wish to create a table with this piece of code which is valid SQL: CREATE TABLE flat_10 ( pk_flat_id INT(30) DEFAULT...

What data type should be use for timestamp in DynamoDB?

I am new to DynamoDB. I wish to create a table which using DeviceID as the hash key, Timestamp as my range key and some data. { DeviceID: 123, Timestamp: "2016-11-11T17:21:07.5272333Z", X: 12, Y:...

MySQL Datatypes - Signed Unsigned

Let us consider TINYINT. W3Schools says that it's signed range is from -128 to 127 and its unsigned range is from 0 to 255. Why does it say that its range is from -128 to 127 and why not that its...

Why when converting SQL Real to Numeric does the scale slightly increase?

I'm storing a value (0.15) as a Real datatype in a Quantity field in SQL. Just playing around, when I cast as numeric, there are some very slight changes to scale. I'm unsure why this occurs, and...

how to have an int >255 in sql

I'm very new to SQL and know very little about it. But, I'm trying to add a column to each row so every user starts with 2000. I want this value to be an int so I'm using: ALTER TABLE users ADD...

Alter column varchar to json in psql

Hi i am trying to convert a column in my table from varchar to json and the table already had some string data. I tried doing that with the below command. Database=# alter table table_name alter...

How to solve error in Pandas for "The incoming tabular data stream in remote procedure call protocal stream is incorrect

I have a pandas dataframe that I'm writing to a table in SQL Server. The data frame contains the following dtypes: Contact_ID object Skill_No ...