ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
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.
 Question Submitted By :: Srikanth
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
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 ?    4 Yes 0 No
Priyanka Malondkar
 
  Re: 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
# 2
insert into table2(Column1,Column2) select Column1,Column2 
from Table1 where Column1 %2 ='0'
 
Is This Answer Correct ?    6 Yes 0 No
Meenaprasanna
 
 
 
  Re: 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
# 3
insert into table2(Column1,Column2) select Column1,Column2 
from Table1 where Column1 %2 ='0'
 
Is This Answer Correct ?    4 Yes 0 No
Mythili
 
  Re: 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
# 4
insert into table2(Column1,Column2) select Column1,Column2 
from Table1 where Column1%2 = 0
 
Is This Answer Correct ?    1 Yes 0 No
Rajesh.a
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
How to work on DTS?what is the main requirement? ivan1
Write an SQL query if u want to select the data from one block which intern reflects in another block ? thanx,do reply Covansys1
What are three SQL keywords used to change or set someone?s permissions?  3
what is web server? Satyam3
What is the difference between having and where clause?  4
Hi SQL gurus, i am working for an MNC... My team is having a problem in sql server. when user slects date prompts from jan 1st to april 30, it should display all months data like : jan aa feb bb mar cc but when it comes to april its taking data like : jan aa feb bb mar cc apr dd...and so on means its taking data again from jan to april which we dont want. we want the data only april month as we are getting jan, feb and mar... can any one write the code to relsove the issue please would be greatful if you can send to shiva_sans@yahoo.co.in and also please send your email also ...so that we will be in touch for any kind of queries ... Thanks a lot in Advance !!!  1
WHAT IS TRIGGERS IN SQL? AND WHAT IS THE BENIFIT?  5
how to give input dynamically to a insert statement in sqlserver HCL2
I have a huge amount of data which is displayed in a report. The data is viewed every day. Every day the data is displayed in 30 secs but suddenly today it is giving an timeout message today. Data has not been changed. The situation is same as yesterday. What might be the reason??? Please Answer. Satyam4
plz tell me the new features of sqlserver2000,sqlserver2002,sqlserver2005  3
write the query for taking database backup in sql Logica-CMG6
what is maximum size of temp db? iSoft4
what is the Enterprise manager(2000) and management studio (2005)?  2
What do you mean by COLLATION?  4
What are user defined datatypes and when you should go for them?  1
How To delete duplicate record from a particular table? eXensys10
What are the advantages of using sql server over ms access or why should one use sql instead of ms access Impetus1
How to display n-1 columns from n number of columns, from a single table in MS SQL server 2005?  1
What is an extended stored procedure? Can you instantiate a COM object by using T-SQL?  1
How can count the string ? for ex: If i have string like 'bhaskar' then i need like b:1 h:1 a:2 s:1 k:1 r:1 please give any idea on that TCS5
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com