Posts

Showing posts from November, 2011

Temporary Tables

Temporary Tables Introduction Temporary Tables are a great T-SQL feature that lets you store and process intermediate results by using the same selection, update, and join capabilities that you can use with typical SQL Server tables. Types of Temporary Tables in SQL You can create two types of temporary tables in SQL, local and global temporary tables. The two types of temporary tables, local and global, differ from each other in their names, their visibility, and their availability. Local Temporary Tables Local temporary tables prefix with single number sign (#) as the first character of their names, like (#table_name). Local temporary tables are visible only in the current session OR you can say that they are visible only to the current connection for the user. They are deleted when the user disconnects from instances of Microsoft SQL Server.   Global Temporary Tables Global temporary tables prefix with double number sign (##) as the first character of their names, like (##table_name

A program that calculates factorial of a number input by user

// Stacklink.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int _tmain( int argc, _TCHAR* argv[]) {                     int num, fact = 1, index;             cout<< "Input value for which factorial is required " ;             cin>>num;             index = num;                   cout<<endl;            cout<<num<< "! = " ;             while (index > 0)             {                 if (index == 1)                     cout<<index<<endl;                 else                    cout<<index<< " * " ;                 fact *= index;                 index--;             }             cout<< "\nFactorial of " <<num<< " is " <<fact<<endl; }

A program that generates table of a number input by user

// Stacklink.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int _tmain( int argc, _TCHAR* argv[]) {                   int table, tbl_value,index=1;             cout<< "Input value for which table is required " ;             cin>>table;                   cout<<endl;             cout<< "Input value upto which table is required " ;                   cin>> tbl_value;             while (index < tbl_value+1)             {                 cout<<table<< " * " << index<< " = " <<table * index<<endl;                 index++;             } }

Queue Implemented With LinkList

#include "stdafx.h" #include <iostream> using namespace std; class node {       private :       int val;       node *next; public :       void setvalue( int x)       {             val=x;       }       int getvalue()       {             return val;       }       void setnext(node *a)       {             next=a;       }       node * getnext()       {             return next;       } }; class Queue { private :             node* rear;       node* front;       int size; public :       Queue()       {             rear=NULL;             size=0;             front=NULL;       }       void push( int temp)             {                   node *n= new node();       n->setvalue(temp);       n->setnext(NULL);       if (size==0)       {                         front=rear=n;       }                   else       {                         rear->setnext(n);             rear=n;       }                               size++;                   }             i