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

What are indexes in sql?

562


How connect excel to sql server?

494


What is amo? : sql server analysis services, ssas

646


How do you trace the traffic hitting a sql server?

600


How to enter unicode character string literals in ms sql server?

561






How can you fetch alternate records from a table?

532


What is sql server schema compare? How we can compare two database schemas?

548


Write a SQL query to delete a table?

639


Tell me what is difference between view and materialized view?

509


Explain why variables called the most powerful component of ssis?

517


What does the update command do?

597


Can a table have 2 primary keys?

496


What do you mean by tablesample?

624


What is the default fill factor value?

567


What are the five characteristics of good data?

505