Friday, September 26, 2014

Text and Image Data Types Being Removed (SQL Server)

"ntext text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max)varchar(max), and varbinary(max) instead."

SQL Server 2012 (and 2014 perhaps) will be the last versions to support these.


SQL Joins

W3Schools has a great SQL section.  Included are:

The "outer" joins come in two flavors.  And now you can see why it doesn't make sense to have Left and Right INNER joins.

Getting To Know That DB You Inherited (SQL Server)

Useful SQL queries to get to know that legacy db you are assigned:

select, count('count'
from sys.columns col
inner join sys.tables tab on col.object_id = tab.object_id
INNER JOIN sys.types t ON col.user_type_id = t.user_type_id
group by
order by 'count' desc

name count
datetime 36
int 32
char 32
decimal 24
varchar 19
sysname 1
varbinary 1

Actually, turns out the sysdiagrams table will mess up your numbers. Mostly you'll get an extra sysname and varbinary (and 3 extra int values).  So if you are using it to see which kind of types you have to contend with (as I was doing), know you can ignore those.

Also see:

Tuesday, September 23, 2014

Making Things More Complicated to Make Them Easier?

This is probably where Entity Framework started to go awry.