E-Book Gallery for Microsoft Technologies

Download existing and new content for ASP.NET, Office, SQL Server, Windows Azure, and other Microsoft technologies in e-book formats. Reference, guide, and step-by-step information are all available. All the e-books are free. New books will be posted as they become available.

  • Deploying an ASP.NET Web Application to a Hosting Provider using Visual Studio
  • Getting Started with ASP.NET 4.5 Web Forms (Beta)
  • Intro to ASP.NET MVC 4 with Visual Studio (Beta)
  • Configure Kerberos Authentication for SharePoint 2010 Products
  • SQL Server Master Data Services Capacity Guidelines
  • Microsoft SQL Server AlwaysOn Solutions Guide for High Availability and Disaster Recovery
  • Microsoft SQL Server Analysis Services Multidimensional Performance and Operations Guide
  • QuickStart: Learn DAX Basics in 30 Minutes
  • SQL Server 2012 Transact-SQL DML Reference
  • Windows Azure Prescriptive Guidance
  • Windows Azure Service Bus Reference

All the books are available in EPUB, MOBI, PDF format!

Download all the books from here.

Introducing Microsoft SQL Server 2012

41rYAFQaxbL. BO2204203200 PIsitb sticker arrow clickTopRight35 76 AA278 PIkin4BottomRight 4322 AA300 SH20 OU01  Introducing Microsoft SQL Server 2012For tech guys here is a free Microsoft ebook. Its a 288 pages book that gets you into shape with latest SQL Server 2012.

Microsoft SQL Server 2012 is Microsoft’s first cloud-ready information platform. It gives organizations effective tools to protect, unlock, and scale the power of their data, and it works
across a variety of devices and data sources, from desktops, phones, and tablets, to datacenters and both private and public clouds. Our purpose in Introducing Microsoft SQL Server 2012 is to point out both the new and the improved capabilities as they apply to achieving mission-critical confidence, breakthrough insight, and using a cloud on your terms.

As you read this book, we think you will find that there are a lot of exciting enhancements and new capabilities engineered into SQL Server 2012 that allow you to greatly enhance performance and availability at a low total cost of ownership, unlock new insights with pervasive data discovery across the organization and create business solutions fast—on your terms.

Download from here.

You can get it for Kindle as well.

SQL Server 2012 Cheatsheet

Pinal Dave has released his latest cheatsheet regarding the latest SQL Server 2012. Whats in there:

  • SSMS Shortcuts
  • Columnstore Index
  • SQL Server 2012 Datetime Functions
  • SQL Server Ranking Functions
  • SQL Server 2012 Analytic functions

Download from here.

Validate asp.net multiline TextBox

Because it is rendered to TextArea the MaxLength property does not work. One way around this is to attach a regular expression validator to that control. What is important is to set the ValidationExpression to something like “^[\s\S]{0,255}$“. Where 255 is the maximum length allowed.

Hope this helps icon smile Validate asp.net multiline TextBox

What is coming with VS2011 and Framework 4.5

ASPNET vNext What is coming with VS2011 and Framework 4.5Read here from Scott Hanselman’s post.

Download Links

Readmission to hospital within 28 days of discharge

This is very common question when we deal with patients in NHS data. Here is how the task is defined – Readmission rates and HES. In short we need to know how many times(or when) a patient was readmitted within 28 days of his last hospital discharge. Here is how I do that in SQL with self join.

The dates are being transferred from “DDMMYYYY” to SQL server datetime “YYYY-mm-dd”.

You can always ad disease code or any other conditions to the query. Hope it helps!

The columns are:
[Column 8] – Patient identifier
[Column 11] – Admission date
[Column 15] – Method of admission
[Column 19] – Discharge date
[Column 28] – Spell end – Yes/No
[Column 123] – PCT code
[Column 187] – Unique record ID

SELECT a.[Column 8] as 'PatientID', a.[Column 15] as 'Method of Admission',
convert(datetime, STUFF(STUFF(a.[Column 11],3,0,'-'),6,0,'-'), 105) as 'Admission Date',
convert(datetime, STUFF(STUFF(a.[Column 19],3,0,'-'),6,0,'-'), 105) as 'Dischrage Date',
MIN(convert(datetime, STUFF(STUFF(b.[Column 11],3,0,'-'),6,0,'-'), 105)) AS 'Readmission Date',
left(a.[Column 123],3) as 'PCT',
DateDiff(dd, convert(datetime, STUFF(STUFF(a.[Column 19],3,0,'-'),6,0,'-'), 105), MIN(convert(datetime, STUFF(STUFF(b.[Column 11],3,0,'-'),6,0,'-'), 105))) AS 'How many days'
FROM Readmissions_data a
INNER JOIN Readmissions_data b ON a.[Column 8] = b.[Column 8]
	AND convert(datetime, STUFF(STUFF(b.[Column 11],3,0,'-'),6,0,'-'), 105) BETWEEN convert(datetime, STUFF(STUFF(a.[Column 19],3,0,'-'),6,0,'-'), 105) AND DATEADD(dd, 28, convert(datetime, STUFF(STUFF(a.[Column 19],3,0,'-'),6,0,'-'), 105))
WHERE a.[Column 28]='Y' AND a.[Column 19]<>'' AND (right(a.[Column 19],2)='09' OR right(a.[Column 19],2)='10') AND a.[Column 187]<>b.[Column 187]
GROUP BY a.[Column 8],a.[Column 15],left(a.[Column 123],3),convert(datetime, STUFF(STUFF(a.[Column 11],3,0,'-'),6,0,'-'), 105),convert(datetime, STUFF(STUFF(a.[Column 19],3,0,'-'),6,0,'-'), 105)
ORDER BY convert(datetime, STUFF(STUFF(a.[Column 11],3,0,'-'),6,0,'-'), 105)

Clean whole database from unwanted string

Often we end up having an unwanted string injected into our database. It might be a virus or any text that you don’t need. This stored procedure is doing the hard work to remove all the unwanted instances.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROC [dbo].[UpdateAllTables]
(
	@SearchStr nvarchar(100)
)
AS
BEGIN

	SET NOCOUNT ON

	DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
	SET  @TableName = ''
	SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
	SET @SearchStr = QUOTENAME('' + @SearchStr + '','''')

	WHILE @TableName IS NOT NULL
	BEGIN
		SET @ColumnName = ''
		SET @TableName = 
		(
			SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
			FROM 	INFORMATION_SCHEMA.TABLES
			WHERE 		TABLE_TYPE = 'BASE TABLE'
				AND	QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
				AND	OBJECTPROPERTY(
						OBJECT_ID(
							QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
							 ), 'IsMSShipped'
						       ) = 0
		)

		WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
		BEGIN
			SET @ColumnName =
			(
				SELECT MIN(QUOTENAME(COLUMN_NAME))
				FROM 	INFORMATION_SCHEMA.COLUMNS
				WHERE 		TABLE_SCHEMA	= PARSENAME(@TableName, 2)
					AND	TABLE_NAME	= PARSENAME(@TableName, 1)
					AND	DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')
					AND	QUOTENAME(COLUMN_NAME) > @ColumnName
			)
	
			IF @ColumnName IS NOT NULL
			BEGIN
				EXEC
				(
					'UPDATE ' + @TableName + ' SET ' + @ColumnName + '=REPLACE(' + @ColumnName + ','+ @SearchStr + ','''') WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
				)
			END
		END	
	END

END

Thursdays links part 2

What is Node.js?

Let’s start with V8. V8 is the JavaScript implementation used within Chrome. It utilises “Just In Time” compilation to achieve performance that was previously unattainable in JavaScript. In fact, these improvements lift V8 JavaScript into the same realms of performance as Clojure, Java or Go.

Should I use HTML5 or Silverlight?

I was in Belgium and The Netherlands this last week presenting and talking to folks in the community. After I presented on ASP.NET MVC 3, HTML5 and jQuery, one fellow came up after and said, “Should I use Silverlight or HTML5. I don’t understand what Microsoft’s strategy is or what to use in my app.”