datatypes

Return Data and Type of mysql_fetch_array()

Consider the following 3 standard statements $queryString = "SOME SQL SELECT QUERY"; $queryResult = mysql_query($queryString); $queryArray = mysql_fetch_array($queryResult); Question is : If the result set of the query is empty, what will be the resultant datatype and value of $queryArray after all three statements are executed ? ...

Estimating the size needed for text in MySQL

When I have a text field, I generally store it as varchar. But then I encounter the issue of how do I know the limit I should place? Estimating how much text a user will type seems very imprecise. As varchar uses as much space as needed, is it better to set the limit to far greater than you estimate? Is there any disadvantage to using ...

Efficient representation for large numeric arrays in GWT

I have a timeseries class that, over the course of a day will hold 100K-200K values (basically market ticks, uniformly sampled). On the java side the most performant representation is to use double[] (as opposed to say List). I am doubtful that this approach maps well into javasctipt. On the Java side, the double[] array must grow pe...

Difference between numeric,float and decimal in sql server

Hi, I searched in google and also visited the decimal and numeric and SQL Server Helper to glean the difference between numeric , float and decimal datatypes and also to find out which one should be used in which situation. For any kind of financial transaction, which one is prefered and why? e.g. for salary field ...

asp.net mvc can i have a menu that links by both id and username

I am basically taking the default ASP.NET MVC template and extending it: Looking at the site.master, I see this for menus: <ul id="menu"> <li><%= Html.ActionLink("Home", "Index", "Home")%></li> <li><%= Html.ActionLink("About", "About", "Home")%></li> </ul> I am then editing it by the following: <ul id="menu"> ...

Anybody got a C# function that maps the SQL datatype of a column to its CLR equivalent?

I'm sitting down to write a massive switch() statement to turn SQL datatypes into CLR datatypes in order to generate classes from MSSQL stored procedures. I'm using this chart as a reference. Before I get too far into what will probably take all day and be a huge pain to fully test, I'd like to call out to the SO community to see if anyo...

What SQL Server Datatype Should I Use To Store A Byte[]

I want to store arrays of bytes in SQL Server. What datatype, or pre INSERT manipulation would you suggest to store these? I wouldn't expect these byte[] to exceed 1024 in length. ...

SQL Server Inserting Decimal, but selecting Int

I have a table with two decimal(18,0) fields. I am inserting into this table, two decimal values. For example, 1.11 When I select from the table (with no casts), I get 1. I'm losing all percision and I have no clue why. insert into TEST values (153, 'test', 'test', 1, 1, 1.11, 1.11) Select * from TEST and they are 1 and 1 instead of...

What to do when bit mask (flags) enum gets too large.

I have a very large set of permissions in my application that I represent with a Flags enumeration. It is quickly approaching the practical upper bound of the long data type. And I am forced to come up with a strategy to transition to a different structure soon. Now, I could break this list down into smaller pieces, however, this is a...

How to give where condition in the select query?

How to give where condition in the select query? ACCESS 2003 MY Query SELECT RECORDNO, PERSONID, EMPNAME, TITLENAME, DEPARTMENT, NATION, CARDEVENTDATE, INTIME, OUTTIME, (select TOP 1 F1.CARDEVENTDATE from tmp_cardevent as F1 where F1.RECORDNO < F2.RECORDNO AND F1.PERSONID = F2.PERSONID order by F1.RECORDNO DESC, F1.PERSONID DESC) A...

Should I use double or float ?

What are the advantages and disadvantages of using one instead of the other in C++? ...

Sequence database field and query for updating sort order

I would like to enable users of my application to define a number of (say) email addresses. Then I would like to give them the ability to rearrange these addresses, so the primary address is on top, secondary next, etc. Let's suppose I have a UserEmailAddresses table in a database that links a user (UserId) and an email address (Email...

How do I use the YEAR datatype in MySQL 5.1?

I am trying to set a datatype for a column on a new table in MySQL 5.1 to YEAR with a default value of 2009 but it will not allow this. Should I use another integer datatype instead and/or how do I use the YEAR datatype correctly? MySQL 5.1 reference: YEAR datatype ...

How can you list all SQL Server tables, their columns, and column data types using Powershell?

I'm trying to do documentation on an SQL server 2008 database. This includes listing all tables, their columns, and the column types. I've been so far as to use "get-childitem | get-member" while browsing the table, the column, and the column's extended properties, and none of them return the data type of the columns. Is there a way to l...

Passing data types from C++ to Java/Java to C++

What data types can be passed between c++ and java/java to c++? Also, are the data types equivalent in terms of size? ...

Type classes in Haskell data types

In Haskell, one can define a data type like so: data Point1 = Point1 { x :: Integer , y :: Integer } Can one use type classes for variables inside a data type? If so how? I realize it is possible to do this as an algebraic data type, with a different definition for each kind of point, but I'm wondering if there...

Oracle Identify Data Type

Is there an Oracle function to return the data type of the parameter? Alternatively, what is the easiest way to determine the data type of all columns in a query that I've written? ...

Oracle NUMBER Comparisons

Generally in programming, the floating point data types should not be compared for equality since the values stored are very often an approximation. Can two non-integer Oracle NUMBER values be compared reliably for equality since they are stored differently (base-10)? ...

How do I best store a list of numbers in a relational database?

I want to store a list of numbers (essentially, a set in mathematical terms) in a relational database, specifically SQL Server 2005. Ideally, I'd like it to be a single column on a given table, but I'm willing to hear any sort of solution. The data I need to store is, like I said, a set of numbers. It isn't required to be sequential ...

Why should I use int instead of a byte or short in C#

I have found a few threads in regards to this issue. Most people appear to favor using int in their c# code accross the board even if a byte or smallint would handle the data unless it is a mobile app. I don't understand why. Doesn't it make more sense to define your C# datatype as the same datatype that would be in your data storage sol...