Written by Deepak Vasa on February 11th, 2009
SELECT schemas.name AS [Schema],
tables.name AS [Table],
columns.name AS [Column],
CASE
WHEN columns.system_type_id = 34 THEN ‘byte[]‘
WHEN columns.system_type_id = 35 THEN ‘string’
WHEN columns.system_type_id = 36 THEN ‘System.Guid’
WHEN columns.system_type_id = 48 THEN ‘byte’
WHEN columns.system_type_id = 52 THEN ‘short’
WHEN columns.system_type_id = 56 THEN ‘int’
WHEN columns.system_type_id = 58 THEN ‘System.DateTime’
WHEN columns.system_type_id = 59 THEN ‘float’
WHEN columns.system_type_id = 60 THEN ‘decimal’
WHEN columns.system_type_id = 61 THEN ‘System.DateTime’
WHEN columns.system_type_id = 62 THEN ‘double’
WHEN columns.system_type_id = 98 THEN ‘object’
WHEN columns.system_type_id = 99 THEN ‘string’
WHEN columns.system_type_id = 104 THEN ‘bool’
WHEN columns.system_type_id = 106 THEN ‘decimal’
WHEN columns.system_type_id = 108 THEN ‘decimal’
WHEN columns.system_type_id = 122 THEN ‘decimal’
WHEN columns.system_type_id = 127 THEN ‘long’
WHEN columns.system_type_id = 165 THEN ‘byte[]‘
WHEN columns.system_type_id = 167 THEN ‘string’
WHEN columns.system_type_id = 173 THEN ‘byte[]‘
WHEN columns.system_type_id = 175 THEN ‘string’
WHEN columns.system_type_id = 189 THEN ‘long’
WHEN columns.system_type_id = 231 THEN ‘string’
WHEN columns.system_type_id = 239 THEN ‘string’
WHEN columns.system_type_id = 241 THEN ‘string’
WHEN columns.system_type_id = 241 THEN ‘string’
END AS [Type],
columns.is_nullable AS [Nullable]
FROM sys.tables tables
INNER JOIN sys.schemas schemas ON (tables.schema_id = schemas.schema_id )
INNER JOIN sys.columns columns ON (columns.object_id = tables.object_id)
WHERE tables.name <> ‘sysdiagrams’
AND tables.name <> ‘dtproperties’
ORDER BY [Schema], [Table], [Column], [Type]
Written by Deepak Vasa -
Visit Website
Posted in SQL | 5 Responses »
Tags: SQL, Sql Server 2005, Sql Tricks
Written by Deepak Vasa on January 12th, 2009
Hello World !!
I am writing this using Internet Explorer 8 on Windows 7 Beta, which I am able to successfully install on my Mac OS X using VM Ware Fusion 2.x
The setup and installation of Windows 7 is a breeze, so far I have got nothing to complain with the installation. Looks pretty good. I haven’t used Windows Vista before so I guess my experience with Windows 7 (so far) is turning out to be good
.
Here’s the screen shot

Windows 7 Beta on Mac
Will keep you all posted on how goes things.
Written by Deepak Vasa -
Visit Website
Posted in General | 1 Response »
Tags: Beta, Installation, mac, VM Ware Fusion, Windows 7, Windows 7 Beta
Written by Deepak Vasa on November 26th, 2008
Posted in .NET | No Responses »
Tags: intellisense, Javascript, jQuery, Visual Studio, VS2008
Written by Deepak Vasa on November 3rd, 2008
For those who are not aware, last week there has been some misunderstanding regarding the future of LINQ to SQL based on announcements made by MS at PDC. Well after reading a few blogs around the Blogosphere I have come accross the following posts which explain that there is future for L2S:
Read Damien Guard’s blog ->http://damieng.com/
Read Huagati’s Blog -> http://blog.huagati.com/res/index.php/2008/11/03/quiet-blog-gone-fishing-is-linq-to-sql-dead-etc/
Further I found this cool image supporing L2S here

Long live LINQ to SQL !!!
Written by Deepak Vasa -
Visit Website
Posted in .NET, General | No Responses »
Tags: L2S, LINQ, Not Dead, SQL
Written by Deepak Vasa on October 31st, 2008
// LINQ query to get all the column names for every Table
var model = new AttributeMappingSource().GetModel(typeof(ReportDBMLClassesDataContext));
int i = 0;
ArrayList lblList = new ArrayList();
foreach (var mt in model.GetTables())
{
i++;
Label lbl = new Label();
lbl.Text = mt.TableName.ToString();
lbl.ID = “lbl” + i;
Panel1.Controls.Add(lbl);
Panel1.Controls.Add(new LiteralControl(“<br>”));
int r = 0;
foreach (var dm in mt.RowType.DataMembers)
{
r++;
Label rlbl = new Label();
rlbl.Text = dm.MappedName.ToString();
rlbl.ID = “rlbl” + i + “” + r;
Panel1.Controls.Add(rlbl);
Panel1.Controls.Add(new LiteralControl(“<br>”));
}
}
Written by Deepak Vasa -
Visit Website
Posted in .NET, SQL | No Responses »
Tags: Column Names, DBML, LINQ, Row Names, Table Names