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
What security features are available for stored procedure?
What is the data tier application?
What is right outer join in sql server joins?
how can you check the level of fragmentation on a table? : Sql server administration
what is an extended stored procedure? : Sql server database administration
How to specify the collation for a character data type in ms sql server?
Explain about link server in sql server?
Define left outer join in sql server joins?
Can group functions be used in the order by clause in ms sql server?
What is sql service broker?
What are the differences between clustered and non-clustered index?
What are blobs, tables, and Queues? Is SQL is the standard way to query blobs, tables, and queues?
How except clause is differs from not in clause?
Explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?
What are types of storage modes? : sql server analysis services, ssas