Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my query is
SQL
create table CandidateDetails as
(select c.Status,c.InterviewDate,c.InterviewerName,c.DateOfConfirmation,c.DateOfJoining,c.LastWorkday,
       c.Contact,d.DesignationOffered,d.Duration,d.SalaryOffered)
from CandidateSelection1 c join Designation d on c.CandidateId=d.DesignationId
Posted
Comments
CHill60 28-Jan-15 7:28am    
You will have had an error when you ran that - do you want to share what it was?

Assuming that this is a one off query, I would change it slightly to the following

SQL
select c.Status,c.InterviewDate,c.InterviewerName,c.DateOfConfirmation,c.DateOfJoining,c.LastWorkday, c.Contact,d.DesignationOffered,d.Duration,d.SalaryOffered
into newTableName
from CandidateSelection1 c join Designation d
on c.CandidateId=d.DesignationId


after it has created your table you will then just need to define your primary keys etc.
 
Share this answer
 
v2
Comments
Umer Akram 28-Jan-15 7:37am    
Just removed the extra ")" to avoid any syntax error. here is the updated query.rest of the logic is same.


select c.Status,c.InterviewDate,c.InterviewerName,c.DateOfConfirmation,c.DateOfJoining,c.LastWorkday, c.Contact,d.DesignationOffered,d.Duration,d.SalaryOffered
into newTableName
from CandidateSelection1 c join Designation d
on c.CandidateId=d.DesignationId
Simon_Whale 28-Jan-15 7:46am    
Thanks have updated it
Umer Akram 28-Jan-15 7:49am    
you are welcome :)
The ability to create a table as a filetable (as per your example) was introduced in SQL Server 2012 and you have tagged SQL-server-2008R2 so that won't work for you.

The easiest way to achieve what you are trying is to use SELECT INTO[^]

SQL
select c.Status,c.InterviewDate,c.InterviewerName,c.DateOfConfirmation,c.DateOfJoining,c.LastWorkday,
       c.Contact,d.DesignationOffered,d.Duration,d.SalaryOffered)
into CandidateDetails
from CandidateSelection1 c join Designation d on c.CandidateId=d.DesignationId
 
Share this answer
 

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