Categories
Coding

Mapping SQL Server integer types to .NET types

BigInt = Int64 (Long)
Int = Int32 (Integer)
SmallInt = Int16 (Short)
TinyInt = Byte

e.g. byte recurrenceType = reader.GetByte(8);

Categories
Coding

Row numbers within MySQL

Sometime you will need a query that will return a resultset of ranked records. The following MySQL query will do the trick:

SELECT @rownum:=@rownum+1 AS rank, companies.* FROM conpanies p, (SELECT @rownum:=0) r ORDER BY profit DESC LIMIT 20;