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



Please give me the SP for the below scenario. I have two tables named Table1 and Table2...I need to..

Answer / meenaprasanna

insert into table2(Column1,Column2) select Column1,Column2
from Table1 where Column1 %2 ='0'

Is This Answer Correct ?    14 Yes 2 No

Please give me the SP for the below scenario. I have two tables named Table1 and Table2...I need to..

Answer / mythili

insert into table2(Column1,Column2) select Column1,Column2
from Table1 where Column1 %2 ='0'

Is This Answer Correct ?    13 Yes 1 No

Please give me the SP for the below scenario. I have two tables named Table1 and Table2...I need to..

Answer / rajesh.a

insert into table2(Column1,Column2) select Column1,Column2
from Table1 where Column1%2 = 0

Is This Answer Correct ?    8 Yes 0 No




Please give me the SP for the below scenario. I have two tables named Table1 and Table2...I need to..

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

Post New Answer



More SQL Server Interview Questions

Define candidate key, alternate key, composite key.

13 Answers   Infosys, Software India,


how to insert the values in 5 table at a time with triggers . if u have any solution then co-operate me ?

1 Answers  


What is difference between TRUNCATE and DELETE statement

12 Answers   CTS,


if 3 duplicate records in a table,i want to delete 2 duplicate records by keeping 1 duplicate and 1 original as it is,how?

5 Answers  


Please give me queries for the following 1. To get the count of duplicate records. 2. A query to delete the duplicate records.

3 Answers   247Customer,






Syntax to find the used space and free space of the Data file in a database(SQL Server). Following queries didn't give the exact Used space and Free Space Information sp_spaceused;DBCC showfilestats;exec MyDbName.dbo.sp_spaceused;SP_HELPFILE Can any one tell me the query for how to find the exact used data file space and free space in a Data File?

2 Answers   Cognizant,


Delete duplicate rows from a table without primary key by using a single query Table Employee empname salary A 200 B 300 A 200 C 400 D 500 D 500 Output should be A 200 B 300 C 400 D 500

14 Answers  


1. SELECT SUM(sal) as “Gross Salary” from EMPLOYEES; 2. SELECT MAX(sal) as “Highest Salary” from EMPLOYEES; ouput should be in table format

2 Answers  


how can i lock the column in the table

2 Answers   Accenture,


What is a SQL Server Temporary Table?

1 Answers   Wipro,


What are the Pre Requisites when you apply Srvice Packs?

1 Answers   IBM,


How get current date in SQL server 2000

4 Answers   Polaris, Cap Gemini,






Categories