lunes, 14 de junio de 2010

T-SQL: PIVOT Operator with Dynamic Columns

In My Previous post "PIVOT Operator in SQL", I explained about, How to use T-SQL Operator PIVOT.

http://blog-mstechnology.blogspot.com/2009/06/pivot-operator-in-sql.html

In Previous post, I explained using Static PIVOT Columns in the Query, which are hard coded.

This post explains with dynamic columns in PIVOT, For Example: Distinct values from columns of a table.

I used the AdventureWorks Database in my samples script

Have a look at this Query, Here I Explained in 4 steps alsong with the Query.

USE AdventureWorks
GO

#1. Declare a Variable to Store All the Column Values
DECLARE @columns VARCHAR(8000)

#2. Columns Vlaues are Storing in @columns Values In ID or QUOTED_ID Format


SELECT
@columns =
COALESCE
(
@columns + ',[' + cast(DATEPART(yyyy, OrderDate) as varchar) + ']',
'[' + cast(DATEPART(yyyy, OrderDate) as varchar)+ ']'
)
FROM
Sales.SalesOrderHeader
GROUP BY
DATEPART(yyyy, OrderDate)
ORDER BY DATEPART(yyyy, OrderDate)


@columns Contains:
#3. Building PIVOT Query with Dynamic Columns(@columns)

DECLARE @query VARCHAR(8000)
SET @query = 'SELECT *
FROM
(
SELECT
CustomerID,
DATEPART(yyyy, OrderDate) as OrderYear,
TotalDue
FROM
Sales.SalesOrderHeader
) PIV
PIVOT
(
SUM(TotalDue) FOR OrderYear in ('
+ @columns +
')
) AS chld'


#4. Executing Built Query
EXECUTE (@query)
GO
Output:
Hope it Helps you!

viernes, 14 de mayo de 2010

SQL Server 2008 R2 Books Online

SQL Server 2008 R2 Books Online includes the following types of information:

1. Setup and upgrade instructions.

2. Information about new features and backward compatibility.

3. Conceptual descriptions of the technologies and features in SQL Server.

4. Procedural topics describing how to use the various features in SQL Server.

5. Tutorials that guide you through common tasks.

6. Reference documentation for the graphical tools, command prompt utilities, programming languages, and application programming interfaces (APIs) that are supported by SQL Server.

7. Descriptions of the sample databases and applications that are available with SQL Server.


Download SQLServer2008R2_BOL.msi

miércoles, 12 de mayo de 2010

BeeMobile For MVP - Free of Charge

Dear Friends,


Good Opportunities for Microsoft Most Valuable Professional (MVP) !!!


Bee Mobile is providing the Products free of charge for you and your company, if you are a MVP.


Please send an email together with a link to your MVP profile to beemobile@beemobile4.net


Reference:
http://beemobile.blogspot.com/2009/03/are-you-mvp.html


This product really rocks!


beeMobile product helps to develop mobile application with modern touch control suite. it provides high look, transparent screen, ease of access to mobile application.
I found many features and samples about this product from their native site. Have a look at this at, http://beemobile4.net/?mod=products


Here i placed some samples about BeeMobile products.


The following is the sample of Region Controls, we can use this control in multiple ways, like shown below: Menu, Keyboard, toolbar, etc., 









The following is a sample of iWheel Control, it provides same look feel of IPhone DatePicker

The following the sample of Transaparent Control, it provides the transparency effects.



martes, 4 de mayo de 2010

Expression Blend 4

Expression Blend 4 enables you to create websites and applications based on Silverlight 3 and Silverlight 4, and desktop applications based on Windows Presentation Foundation (WPF) 3.5 with Service Pack 1 (SP1) and WPF 4.
Expression Blend provides support for prototyping, interactivity through behaviors, special Silverlight functionality, and on-the-fly sample data generation.

Expression Blend includes new behaviors that are quickly and easily configured. To support the development of line-of-business (LOB) applications, Expression Blend introduces support for Views and ViewModels.

Download Blend_Trial_en.exe

jueves, 29 de abril de 2010

SQL Server 2000 Best Practices Analyzer

Microsoft SQL Server Best Practices Analyzer is a database management tool that lets you verify the implementation of common Best Practices. These best practices typically relate to the usage and administration aspects of SQL Server databases and ensure that your SQL Servers are managed and operated well.

Download bpasetup.msi

lunes, 26 de abril de 2010

Visual Studio crash when adding items to the toolbox

When I tried to adding items to toolbox thru Visual studio 2008 IDE, then my visual studio has closed automatically. 
I tried many times, but I faced the same issue. I searched in Google and I got many solutions, but nothing is helped me and many people replied that it helps others, I placed the solution here. It may help you
Solution1:
Reinstall add ins by Visual Studio commands
1. devenv /setup
2. devenv /resetuserdata
3. devenv /resetsettings CSharp


Solution 2:
devenv /safemode


Then use Choose Items on toolbox and run through each of the tabs. Once you accept any exceptions raised on loading controls, you can then open Visual
Studio normally and add items.


Solution 3:
If your system contains PowerCommands installed, then


This is taken from
http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/e2434065-9921-4861-b914-9cc9d6c55553/


Through Microsoft's help they came up with a work around which is a simple modification to the devenv.exe.config file.


This will exist in (64 bit systems) C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE 
Or (32 bit systems) C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE


Add this XML token to the dependentAseembly list. They had me add it after the office one, but im not sure if that matters.




<dependentAssembly>
<assemblyIdentity name="office" publicKeyToken="71e9bce111e9429c" culture="neutral"/>
<codeBase version="12.0.0.0" href="PrivateAssemblies\Office12\Office.dll"/>
</dependentAssembly>
<!-NEW STUFF-->
<dependentAssembly>
<assemblyIdentity name="Microsoft.PowerCommands" publicKeyToken="null" culture="neutral"/>
<codeBase version="1.1.0.0" href="C:\Program Files (x86)\PowerCommands\Microsoft.PowerCommands.dll"/>
</dependentAssembly>


Now you should be able to run PowerCommands with VS 2008 SP1 and XAML with no crashes. I guess there will be a fix when the next PowerCommands version comes out or on .net 4.0.


Solution 4:
1. Go to your %userprofile% Folder, (Start -> Run -> Type %userprofile% -> Enter)
2. Open Application Data\Microsoft\
3. Then Clear all the content from the following folder


VisualStudio
MSDN
VSA


Then open VS IDE,  try to add the items in the toolbox.
Solution 4 is helped me. Hope it helps you!

martes, 6 de abril de 2010

New MVPs - April 2010

Microsoft announced the new MVPs for this quarter (April 2010).

Jacob Skaria
Excel
Visual C#
Nitin Agarwal
Windows Desktop Experience
Connected System Developer
Babu A
SQL Server
Hemantgiri S. Goswami
SQL Server
Jugal Shah
SQL Server
Rajesh Jonnalagadda
SQL Server
Anoop Madhusudanan
Client App Dev
Abhijit Jana
ASP/ASP.NET
Satalaj Tukaram More
ASP/ASP.NET
Tanzim Saqib
ASP/ASP.NET
Avinash Tiwari
ASP/ASP.NET
Kazi Manzur Rashid
ASP/ASP.NET
Krishna Chaitanya
ASP/ASP.NET

Congrats to Everyone!!