sqldatatypes

Sql Equivalent to UInt16

I know that the Sql equivalent of Int16 is SqlInt16. But what is the Sql equivalent of UInt16, UInt32 and Uint64? ...

Is there an advantage on setting tinyint fields when I know that the value will not exceed 255?

Should I choose the smallest datatype possible, or if I am storing the value 1 for example, it doesn't matter what is the col datatype and the value will occupy the same memory size? The question is also, cuz I will always have to convert it and play around in the application. UPDATE I think that varchar(1) and varchar(50) is the sa...

Reason to use DECIMAL(31,0)

What is the reason that some people from Oracle background are using DECIMAL(31,0) for integers. In MySQL it is not efficient. ...

How to insert an Array/Objet into SQL (bestpractice)

I need to store three items as an array in a single column and be able to quickly/easily modify that data in later functions. [---YOU CAN SKIP THIS PART IF YOU TRUST ME--] To be clear, I love and use x_ref tables all the time but an x_ref doesn't work here because this is not a one-to-many relationship. I am making a project managem...

VB.NET SQL date is changed format in query

Hi folks, I've got a date variable that looks like this: Dim LogDate As Date = Date.Today.AddDays(-1) the format comes out like: #4/5/2010# then it goes into a SQL select query as a WHERE clause. When I debug, the query has changed this to '05/04/2010'. I want it to be in the format '04/05/2010' like it is when declared. Any id...

Issue while saving system.decimal values in a dataset

Hello I work on a data intensive module. I have a datacolumn inside a dataset which is bound to a grid. The set datacolumn property is as follows : Datatype : System.Decimal MaxLength : -1 DefaultValue : 0 With this properties i expect whenever i enter a number viz. 11001100011 to be saved as 11001100011.00 However internall...

SQL Server: Appropriate datatype for holding percent values?

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

How do you make a Custom Data Generator for SQL XML DataType.

Howdy, I am using Visual Studio 2010 and am playing around with the Database Projects. I am creating a DataGenerationPlan to insert data into a simple table, in which one of the column datatypes is XML. Out of the box, the generation plan uses the Regular Expression generator and generates something like this : HGcSv9wa7yM44T9x5oFT4pmB...

Varchar columns: Nullable or not.

The database development standards in our organization state the varchar fields should not allow null values. They should have a default value of an empty string (""). I know this makes querying and concatenation easier, but today, one of my coworkers questioned me about why that standard only existed for varchar types an not other dat...

Postgres varchar field between

I have an addresses table with ZIP code field which has type VARCHAR. I need to select all addresses form this table using ZIP codes range. If I used next code: select * from address where cast(zip as bigint) between 90210 and 90220 I get an error on fields where ZIP code cann't be cast as bigint. How I can resolve this issue? ...

Problem with text datatype and UDF

I have this great function that parses a field into a pivot table consisting of four columns so I can sort my table accordingly. My only problem now is I can't use the function in a query that also calls a "text" datatype to be displayed in the results. Query runs fine as long as I don't include "spName" which is a "text" datatype. I've ...

Empty space at the end of SQL Server query results

I just installed Microsoft SQL Server 2008 R2 to test with LINQ to SQL. I have a table with one column of type nchar(20) and two rows: '123' and 'Test'. If I query all the rows from that table and wrap each value with "'" I get the following: '123 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ' ( _ is a space) 'Test _ _ _ _ _ _ _ _ _ _ _ _ _ _ _...

What SQL data type does Oracle assign to "count(*)"?

What SQL data type does Oracle assign to count(*) in a query like select count(*) from table? Does this depend on the count size? ...

What Java data type corresponds to the Oracle SQL data type NUMERIC?

What Java data type does the Oracle JDBC driver assign to the Oracle SQL data type NUMERIC? Does this vary with the size of the NUMERIC type? ...

Storing .NET double value in Oracle DB

I'm using ODP.NET to access Oracle DB from C# .NET. Please see following code: OracleConnection con = new OracleConnection(); con.ConnectionString = "User Id=user;Password=pass;Data Source=localhost/orcl"; con.Open(); /* create table */ DbCommand command = con.CreateCommand(); command.CommandType = CommandType.Text; try ...

Where did the datatypes get their name from?

Why is a bit, called a bit. Why is a 8-bits a Byte? What made people call a 16-bits a Word, and so on. Where and why did their alias come about? I would love other people to include things like basic ASM types, then branch out to C/C++ and move on to SQL and the like's datatypes. 1-Bit Bit - binary Unit Bool - Named after the invento...

define 'enum' and 'set' columns in mysql with same values

is there a way to define an column of type 'enum' and then define another column in the same table of type 'set' with the same values of the 'enum' ? for example we have an 'enum' with values "one", "two", "three", we define the first column in the table with that enum type. Then I need to define the second column in the table with the ...

SQLServer 2008: Showing the Information with Money DataType in Classic ASP

Hi All, I am using MS SQL 2008 to develop one system with Classic ASP. I want to show 3 Decimal Places the field Datatype is money. I got answer from this http://www.sqlusa.com/bestpractices2005/moneyformat/ . I use like this in my SQL Statement : CONVERT(VARCHAR, CAST(Sell_Price AS Decimal(19, 3))) AS Unit_Price What I w...