Saturday, 13 January 2018

Table as parameter SQL Server

Table as parameter SQL Server

SQL Server provides a special parameter named table parameter. Using table parameter user can pass entire table as other parameter pass to store procedure. Table parameter is better alternate of temporary table. It reduces unnecessary work and time. Which need to pass more than one row to database for save.

Table Structure


Field Name
Data Type
Roll
Int
Name
Varchar(30)
City
Varchar(40)

Store Procedure

Table Type


CREATE TYPE dbo.myDataType AS TABLE  
( roll int, 
  name varchar(30),
  city varchar(30)
 );  

Thursday, 11 January 2018

Average in dynamic structure

Q :  Write a program which asks the user to enter the name and age of persons in his group.The number of persons is not known to the user in the beginning of the program. The user keeps on entering the data till the user enters the age as zero. The program finally prints the average age.

Solution :


/*==============================
     Girfa Student Help
     Program : Age calculation in dynamic structure
     More Program : http://girfahelp.blogspot.in/p/c-language-structure-programming.html
================================*/
#include<stdio.h>
#include<conio.h>
typedef struct stu
{
     char name[20];
     int age;

Forgot & in scanf

Wednesday, 10 January 2018

Dynamic records using structure

Q : Write a program to input name of age record of a company. How many records have to input? It will ask at run time. After input complete, program will print all the records with average age.

Solution : 

/*==============================
     Girfa Student Help
     Program : Age calculation in dynamic structure
     More Program : http://girfahelp.blogspot.in/p/c-language-structure-programming.html
================================*/
#include<stdio.h>
#include<conio.h>
typedef struct stu
{
     char name[20];
     int age;
}student;
void main()
{