Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Please give me the SP for the below scenario. I have two
tables named Table1 and Table2...I need to fetch record by
record from Table1 and insert the record in to table2 where
the value in the sno column of the table1 is even number.

Answer Posted / priyanka malondkar

First make a function like this
create function functionname(@sno int)
returns number;
declare check;
begin
check=@sno%2
if check=0
return 0;
else
return 1;


Then the query will be
declare no;
insert into Table2(a,b,c) values select (a,b,c) from Table1
where no=functionname(sno) and no=0;

Kindly check.
In case of any syntax error please excuse as i have not
checked it of sql sever.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are the different index configurations a table can have?

1037


What is cursor in ms sql server?

1090


What is an expensive query?

880


What is ems sql management studio? : sql server management studio

1035


What is difference between join and natural join?

895


How many types of keys are there?

964


When does a workload on SQL Azure get throttled?

129


What is data modification?

896


How can I track the changes or identify the latest insert-update-delete from a table?

913


what are different types of backups available in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

875


How do I start sql server?

924


What are the database objects? : SQL Server Architecture

984


Tell me what is the order in which the sql query is executed?

897


What is optimization and its types?

912


How to download and install microsoft .net framework version 2.0?

1102