GET all columns of a table–TIP #4


To Get all columns information of a table we can use following command


SELECT,,sc.is_identity AS IdentityColumn,
sc.is_nullable AS NullableColumn,
sc.max_length as colmaxlength, as columnType
FROM sys.columns sc
INNER JOIN sys.tables st ON st.object_id  = sc.object_id
INNER JOIN systypes sty on sty.xtype = sc.system_type_id


Or we can use following statement



Enjoy Smile !!!

Soft Input Panel (SIP) Windows Phone 7

Dear Friends,

Input is must for any application and valid input provide best result which you want.

Windows phone 7 having SIP ( Soft Input Panel)  for input.

For example phone number should be numeric always personal name having alphabets only such kind of validation is required when we develop any application.

With windows phone 7 we have facility that keyboard automatically change according to input scope.

For example if we want numeric value in textbox than it shows numeric keys.

Below are the some patterns which windows phone support.   AddressCountryShortName












You just need to add Input scope property to textbox and rest of the validation for input handle by Windows phone 7.

The SIP (Soft Input Panel) change according to Input scope.

For more detail see below screen.

You can download the code at!243

Thanks & Best Regards,

Rajat Jaiswal

How take photo from Windows Phone 7 using code

Hello friends,

Today we will learn how to take photo from windows phone using code.

For this we will do following design we will have a button with name btnImage and text Take image.

We have an image control also on the page.

Now as we need to add same reference as we added in our previous 3 examples which is “Microsoft.Phone.Tasks”

Now on the  button click event we will write following code

CameraCaptureTask cameraTask = new CameraCaptureTask();

cameraTask.Completed += new EventHandler(cameraTask_Completed);

Now in the above code we have created a delegate in this delegate we will right following code

this.imgsrc.Source = PictureDecoder.DecodeJpeg(e.ChosenPhoto);

Here in the above line we are providing the capture image as a source code to our image control.

So when you click the take photo button you will get following screen.

And once you accept the photo you will get taken photo in image control of our windows phone app. So you are now aware how to capture image.

You can download the code at!243

Enjoy doing taking Photos

Thanks & Best Regards,

Rajat Jaiswal

Simple code for calling from Windows Phone 7 using C# code

Hello friends,

Today I will explain how to make call using your C# code in Windows Phone.

It is very easy code you just need to write few lines and you are good to go. I will explain the concept of chooser and launchers later on please don’t worry about that right now.

So we start with a new project in which we add reference of Microsoft.Phone.Tasks.

On the screen we have added few names & there phone numbers textboxes.

We have added a call button for each name. Please see the below snap for design. Now in button click event you need to do following

  PhoneCallTask callTask = new PhoneCallTask();

callTask.DisplayName = this.txtName1.Text;

callTask.PhoneNumber = this.txtPhone1.Text;


Now when you click the call button you will find now you will get following screen which is a confirmation screen. In confirmation screen you will find the Display Name “Rajat Jaiswal” and phone number is there.

Now you can press call button and you will find you are calling Rajat Jaiswal at given number .

You can download the code at!243

Enjoy calling

Rajat Jaiswal

How to set Windows Phone Page orientation in 5 minutes

Dear Friends,

Today we start with some basic but important feature for Windows Phone which is Orientation of screen.  As we know windows mobile phone is handy device a user can handle it any ways like portrait or landscape. Our main aim here is to change our screen orientation according to user action. Windows phone page has two properties for this activity.

When you open the XAML of the page in the phone application page you will find SupportedOrientations and Orientation by default these properties having value Portrait.

Support Orientations can have following property

a) Landscape  (It support Landscape view only)

b) Portrait     ( It support Portrait View only)

c) PortraitOrLandScape  (It support both View )

While Orientation can have following values

a) Landscape

b) Portrait

c) LandscapeLeft

d) LandscapeRight

e) PortraitUp

f) PortraitDown

g) None

To change the page layout we need to set  supportOrientation property to “portraitOrLandscape” And design the page in such a way that it automatically resize according to screen and take their position else you have to do programming for it to put control at proper place.

In current example I have use stack panel and in this stack panel I have used image control. To enable page orientation I have just change the support orientation property.  To know we are seeing which orientation I have added an event which is page orientation event.

You can say it will be simplest example for more information please download the project. (!243


Thanks & Best Regards,

Rajat Jaiswal

VS 2012 – Latest version of Visual Studio (ASP.NET 4.5)

Dear Friends,

A new version VS-2012 of Visual studio is coming in September. Please visit following URL for more detail

Meanwhile you can download VS2012 RC version and try.

With this version you can develop different app like Metro App, ASP.NET, Silverlight etc.

This version has many new features which i will describe later on in my post.

Thanks & Best Regards,

Rajat Jaiswal


Database Space issue in SQL server 2005 (New feature VARDECIMAL)

Hello friends,

Many times we face space issues with our database. To resolve this problem SQL Server 2005 provided one more solution which is VARDECIMAL feature.

** VARDECIMAL feature exist in SQL SERVER’s Developer & Enterprise edition.

** This feature is not available in SQL Server 2005’s Standard edition.

I hope by the name it is clear that what VARDECIMAL functionality is.

If not then please read below line VAR + Decimal = VARDECIMAL

It is just like VARCHAR features means it will consume space which is actual require to store the decimal value. It ignores null and zero value to save space

. To understand it more lets implement it.

I am taking an example here

First we will check the database size without applying the VARDECIMAL Feature .

To check the current space use below command

Use Your Database name;



The above command provides you current space used by the database. Now we will check whether the VARDECIMAL feature is enabled or not to check this we can use two way go to database property and check it as shown in below fig


use below command

exec sp_db_vardecimal_storage_format

Now to enable the property on particular database either make the property true in above fig

or use following command

exec sp_db_vardecimal_storage_format ‘Your DatabaseName’, ‘ON’

Once the database has VARDECIMAL storage format.

We need to apply VARDECIMAL storage property on actual table. Before applying the feature first check the space of existing table which can be determine by following command.

Sp_spaceused table Name;

Now check whether the table has VARDECIMAL feature enable or not. To check this feature just right click on table and check table property.

Now to enable this property use following command

sp_tableoption ‘YourTableName’, ‘vardecimal storage format’, 1

Once you run this option on database you will find the property on the table is now true.

Now to check how much space gain you got use again

Sp_spaceUsed table name ;


Now compare the space with existing result and check how much you gain in terms of space.

I hope this feature will help you in some where if you are using SQL Server 2005 Enterprise edition.

In the next session I will explain what new feature available in SQL Server 2008 R2 for same space problem.

Till than

Thanks & Best Regards,

Rajat Jaiswal

How to set sql server database mode to single user from multi user and vice versa

Dear Friends,

Sometimes you want to restrict your database. You want that your database is access by only by you (Single handed) no person can access it.

To achieve this task SQL server provide a simple command with the help of this command your database will have only single connection. Below is the command which allow only single connection


Now after your maintenance you want to revert back to Multiuser mode then below is the  command which help you in that.


So enjoy.

Thanks & best regards, Rajat Jaiswal

How to find all running SQL Server Instance on a machine

Hello friends,

Many times it happened with me I forgot the instance name of SQL Server.

So here is a small trick which will help you in determining the entire running SQL Server instance on your machine.

You just need to run a simple command on Command prompt.

 C:\>SQLcmd -L

This simple command will provide entire running instance on your machine.

Enjoy this Trick.

Happy weekend.

Thanks & Best Regards,

 Rajat Jaiswal

How to incorporate word press theme in my Razor Blog

Hello friends,
As you know currently I am working on Razor. So I am trying to make a WordPress blog with Razor.Net.
Now the challenging task for me is design. I am not so good in designing so it’s a big deal for me. I just thought to download the WordPress theme and incorporate in My Blog work. So thanks to  free word press theme I just downloaded the technology themes from there you can visit and see the other design.I like Mac Doc wordpress theme so here is the steps which I followed which help you also.
1) Just downloaded  the theme from any free wordpress theme sites
2) Copy all the images in your image folder of site
3) Copy CSS file in your Style folder.
4) Now open your site Layout page
5) Replace the body part of your site layout with default preview page of word press theme which you are looking currently. In my Case (free Mac theme page)
6) Then try make pieces of your design like  in my case on the default page there is a header part, footer part,  Search Box part, Archive Part, Center part (Where we will see post),Tag part, Category part.
7) So what I did I created all this part as a separate page like header.cshtml, footer.cshtml, SearchBox.cshtml, Archive.cshtml, Deafult.cshtml, TagSearch.cshtml, CategorySearch.cshtml.
8) Just cut the part from your site layout for specific items like header, site bar, content, category etc.
9) In SiteLayout page only call this pages. This is the simplest way.
10) Now if I need to incorporate any other Word press theme then I just needs to copy the theme and just need to replay site layout. This is the simplest way I found with Razor.

11) The best part is I just need to create a page cshtml and can place anywhere according to need and it will work like a word press functionality.

I hope you got some idea.
Soon I am going to upload the Blog which will help you to understand the concept of Razor more. It’s a simplest blog creation.
Rajat Jaiswal