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
How to check if a table is being used in sql server?
How to change the password of a login name in ms sql server?
Explain transaction server distributed transaction?
what is the difference between count(*) and count(1) ?
Explain error handling in ssis?
What happens to a trigger with multiple affected rows?
What are the commands used in DCL?
What are the different types of triggers in SQL SERVER?
How to delete exactly duplicate records from a table?
What is bcp? When does it use?
What is a benefit of using an after insert trigger over using a before insert trigger?
What are basics of policy management?
What is named calculation? : sql server analysis services, ssas
How to filter out duplications in the returning rows in ms sql server?
Explain sql server service broker?