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.
Answers were Sorted based on User's Feedback
Answer / meenaprasanna
insert into table2(Column1,Column2) select Column1,Column2
from Table1 where Column1 %2 ='0'
Is This Answer Correct ? | 14 Yes | 2 No |
Answer / mythili
insert into table2(Column1,Column2) select Column1,Column2
from Table1 where Column1 %2 ='0'
Is This Answer Correct ? | 13 Yes | 1 No |
Answer / rajesh.a
insert into table2(Column1,Column2) select Column1,Column2
from Table1 where Column1%2 = 0
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / 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 |
1.how to find the dead lock in sql server? 2.How to fine the memory leaks in sql server? 3.suppose transaction log file increasing what action will take ?
What is the difference between seek predicate and predicate?
What is the maximum row of a size?
What does executeupdate return?
How optimize sql query with multiple joins in sql server?
Explain database normalization?
What is outer join in sql server joins?
What do you understand by user-defined function in the sql server?
What do you understand by sql server agent?
what is curser.
what is an extended stored procedure? : Sql server database administration
What is sql server agent and what are the two modes of authentication in sql server?