Store Procedure in SQL Server

Store Procedure is subroutine available to Application  that access Relational Database System.
Few important things are to be noted:
  • Not like Views in Access SP (Store Procedure) are pre-compiled in database.
  • Keyword is PROC or PROCEDURE.
  • Increase the Usability in Query Optimization.
  • Store in Database.
  • Wipe out from memory after their execution.

How to code?

Open SQL-Server, Create new Database named as EmployeeDB and Table named as Employee















Add following fields names in table







Make sure ID set as auto increment and Primary Key 
Expand Tables => right-click on dbo.Employee => Edit Top 200 Rows and Add dummy data like following







To make sure data is added, click on New Query (placed at right corner), and  paste following code and Click

SELECT * FROM [EmployeeDB].[dbo].[Employee];

How to Create Store Procedure ?

·          Using same query we create store procedure .
·          Paste/Replace following code and click Execute.

CREATE PROC SPAllEmployee
AS
SELECT * FROM [EmployeeDB].[dbo].[Employee];

It create store procedure named as SPAllEmployee.
You can also see that Store Procedure file is created in Database => EmployeeDB => Programmability => Store Srocedures.
Now, 

How To Call Store?

Click New Query Paste following Code and Execute.

Exec SPAllEmployee

How to Alter Store Procedure ?

·         Using same Store Procedure SPAllEmployee we alter this SP(Store Procedure). Now we are going to change the query . Click New Query Paste Following Code and Click Execute.
ALTER PROC SPAllEmployee
AS
SELECT * FROM [EmployeeDB].[dbo].[Employee] AS E
WHERE E.City='Lahore';

Click New Query Paste Following Code and Execute
            
            Exec SPAllEmployee

See query result is changed now.

How to Drop Store Procedure? 


Simple click on New Query and Execute Following code.

DROP PROCEDURE SPALLEmployee;

How to Create Store Procedure with Parameter?


      Again create new Store Procedure named as SPnewEmployee in New Query  and Execute following lines of code.

CREATE PROC SPnewEmployee
@param varchar(50)
AS
SELECT * FROM [EmployeeDB].[DBO].[Employee] AS E
WHERE E.[City]=@param;

EXEC SPnewEmployee 'Lahore'


If you want pass two or more parameter just separated with comma.
Now create new Store Procedure in New Query and Execute following lines of code it.

CREATE PROC SPnewEmployeeTwo
@city varchar(50),
@departmentName varchar(50)
AS
SELECT * FROM [EmployeeDB].[DBO].[Employee] AS E
WHERE E.[City]= @city AND E.DepartmentName=@departmentName;

And now click New Query paste following code and then click on Execute.

EXEC SPnewEmployeeTwo @city='Lahore', @departmentName='English';




How to disable dextop icons

Hi friends this is small tricky that i often play with friends and make them fool :D

  • Just take Screenshot  of your dextop
  • Open that screen shot then right click and "set as dextop background".
  • Right Click on Dextop go to first option "View"  and make sure "Show Dextop Icons" is Unchecked .
  • Now try to click any icon... Hope you enjoying
,

Animation with Viusal Studio Blend

Open Visual Studio and make new project named Animation. Open Solution Explorer (CTRL+ALT+L ) then Right Click on Project click on Option Open in Blend ...


When Blend project is completed loaded just follow following steps.


Now Click on + button which is called Story Board .A storyboard is a graphic representation of how your animation will unfold, shot by shot.


then click on Add Key Frames.


Now we set start position of animation. For that purpose you have to drag button any position where you want. I'm just dragging out of the page.
Now Click on Key Frame's key

Now keep pressing arrow key at 0 second and drag it to 1 second of frame. Click on Button and drag to it's original position, make sure while dragging button dotted frame should be created like below Image.
Your Frame should be look like following Image. To play animation click on red encircle button and enjoy.

How to vanish hard drive with out any software

Hi ! Friends today I'm going to teach you a funny magic. Play it with your friends make them little disturb. This trick only for windows user. Following steps that you've to follow

  1. Press Start + R type diskpart then press Enter. Black window will be open.
  2. Type list volume then press Enter. Information about your drive will be appear.
  3. Now let's suppose i  want to hide drive   G . Type select volume 0 then press Enter.
  4. Now Type remove letter G then press Enter. Now go to My Computer see your G drive is vanished. :O

    Don't worry we know the magic to show drive   G  again.
  5. Type assign letter G then press Enter. See your drive show you again...


    Note: Every trick is working good. Firstly all tricks are applied then share to you. If you admit any mistake don't hesitate please contact me at basemarket786@gmail.com. I'll help you a lot.

Imrove Searching in Google.com

While you are searching in google some time you face some difficulties. e.g you want to search specific domain sites i.e .com/.net or you want that google show me only pdf/word files. Simply type word that you want to search let say "Windows Wallpaper" just increase one thing in your search is "Windows Wallpaper:net " google reads these words and show you all site of domain .net only.
if you type "learn java:pdf " google show you only pdf files where you can easily download/read online.