Click here to Skip to main content
15,916,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends, Have a Good Day.

am Working on SqlServer 2005 Database. I need Query. Please help.

I have table Name with Questions, In this Questions DB I have Fields as QCode and QDescription...In this table I have almost 50 Questions. and Now I need to Copy some Selected Questions into New Table using QuestionCode.

For Example the Qcode is 101 and the QDescription is Expectation of Salary.

So, I need to copy some selected Questions into the NEW Table.

I Wrote one Query for this

Select * into NewTable from Questions where Qcode=101.

With this query I can Copy one one Row.

my problem is I need to Copy almost 10 Questions in New Table using Query.


Please help.

Thanks.
Posted
Comments
StackQ 15-Dec-12 3:58am    
If u will use "where Qcode=101" then it will copy only one row.If there will exist more records then it copy more.
or
to copy top 10 use:-Top
To copy selected column use: Select QcCode,Description into TblName from TblName

{Actually i m not getting u what u want}
StackQ 15-Dec-12 3:59am    
Explain:
my problem is I need to Copy almost 10 Questions in New Table using Query.
more....

Hi,

use this

Select * into NewTable from Questions where Qcode in (101,102,..)
 
Share this answer
 
Comments
Software Engineer 892 15-Dec-12 5:11am    
Thank you Mr.nagalkumar.........its working fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900