sql server - How to INSERT INTO Table with SELECT and auto incremented field -



sql server - How to INSERT INTO Table with SELECT and auto incremented field -

i trying insert table created production table - able before formula think caused duplicates , did not populate primary key(in case prospect_id properly. since auto incremented field , using select table insert help on how auto increment field in production? mkt_prospect

insert mkt_prospect(prospect_id,record_type,search_name,label_name,first_name,last_name,customer_class_code,customer_status_code,company_name,job_title,formatted_detail,address_1,address_2,city,state,postal_code,address_type_code,address_status_code,home_phone,email,addoper) select prospect_id,record_type,search_name,label_name,first,last,customer_class_code,customer_status_code,company,title,formatted_detail,address1,address2,city,state,zip,address_type_code,address_status_code,phone,email,addoper dbo.prospects search_name not null , label_name not null

if insert table specific id utilize identity insert on john hartsock said in comments. worth noting auto increment column go on other inserts (outside of scope of identity insert) above largest number.

if meant insert , have table auto generate don't include id column in insert:

insert mkt_prospect(record_type,search_name, label_name,first_name,last_name,customer_class_code, customer_status_code,company_name,job_title, formatted_detail,address_1, address_2,city,state,postal_code, address_type_code,address_status_code, home_phone,email,addoper) select record_type,search_name,label_name,first,last, customer_class_code,customer_status_code,company,title, formatted_detail,address1,address2,city,state,zip, address_type_code,address_status_code, phone,email,addoper dbo.prospects search_name not null , label_name not null

sql-server insert auto-increment

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -