Click here to Skip to main content
15,918,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
INSERT INTO dbo.CollegeDetails (CollegeAutoID,CollegeCode,CollegeName,CollegeType,InstitutionType,Address,Pincode,Location,District,AffiliatedUniversity,EstablishedYear,IsActive,AddedBy,AddedOn,CollegeCategoryAutoID,WebAddress,CollegeNameID)
SELECT (CollegeAutoID,CollegeCode,CollegeName,CollegeType,InstitutionType,Address,Pincode,Location,District,AffiliatedUniversity,EstablishedYear,IsActive,AddedBy,AddedOn,CollegeCategoryAutoID,WebAddress,CollegeNameID)
from dbo.MedicalCollegesDetails


Error raising:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ','.
Posted

Tested:

SQL
INSERT INTO dbo.CollegeDetails 
(CollegeAutoID,CollegeCode,CollegeName,CollegeType,InstitutionType,Address,Pincode,Location,District,AffiliatedUniversity,EstablishedYear,IsActive,AddedBy,AddedOn,CollegeCategoryAutoID,WebAddress,CollegeNameID)
SELECT CollegeAutoID,CollegeCode,CollegeName,CollegeType,InstitutionType,Address,Pincode,Location,District,AffiliatedUniversity,EstablishedYear,IsActive,AddedBy,AddedOn,CollegeCategoryAutoID,WebAddress,CollegeNameID
from dbo.MedicalCollegesDetails
 
Share this answer
 
v3
Try this.


SQL
INSERT INTO dbo.CollegeDetails 
SELECT (CollegeAutoID,CollegeCode,CollegeName,CollegeType,InstitutionType,Address,Pincode,Location,District,AffiliatedUniversity,EstablishedYear,IsActive,AddedBy,AddedOn,CollegeCategoryAutoID,WebAddress,CollegeNameID)
from dbo.MedicalCollegesDetails
 
Share this answer
 
v2
Comments
King Fisher 20-Feb-14 7:04am    
Column name should be match,this will not Work
Siva Hyderabad 20-Feb-14 7:06am    
yes,i checked it..he want all the columns from the below table

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