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 |
Do you know what is rank function?
How can I know what query is executing by by a particural user? (using sp id or any othe way.)
Can an entity have two primary keys?
What is an index?
How to handle errors in Stored Procedures. I want to display a message to the user in the .aspx page that is calling a stored procedure in it's code behind. please help me.
how can do you the system monitoring?
Simple example for difference between select and cursor in sql
what is the difference detween pairwise comparison subquary and non pairwise comparison subquary?
How to replace the Query Result 'Null Value' with a text ?
Explain SELF JOIN ?
What is primary key index?
Is sql server difficult to learn?