sql - Insert from one table to another (different databases) -
auth2.dbo.accounts : account_id, login_name , password , other columns...
auth.dbo.account : account_id , account , password , other columns...
i want insert accounts(account_id,account,password) "auth.dbo.account" "auth2.dbo.accounts" (account_id,login_name , password) , giving other columns values want.
i hoping work , once wrote in sql management studio , got error syntax error near " select account_id auth.dbo.account"
insert [dbo].[accounts] ([account_id], [login_name], [password], [referral_id], [referral_code], [pcbang], [block], [withdraw_remain_time], [age], [auth_ok], [last_login_server_idx], [event_code], [server_list_mask], [result], [ip], [game_code], [gamecode], [login_event], [email], [security_a_1], [security_a_2], [security_a_3], [security_a_4], [security_q_1], [security_q_2], [security_q_3], [security_q_4], [votepoints], [cash], [country]) values (select account_id auth.dbo.account, n'imad', n'3cfbbd2ae3c3e416c6d00a5a12ee60e8', null, null, 0, 0, null, -1997, 1, null, null, null, null, n'::1', null, null, null, n'imad.lekal@outlook.com', null, null, null, null, null, null, null, null, 0, 189, null)
try simple insert/select
. in case account_id
auth.dbo.account
, other values constants.
insert auth2.[dbo].[accounts] ([account_id], [login_name], [password], [referral_id], [referral_code], [pcbang], [block], [withdraw_remain_time], [age], [auth_ok], [last_login_server_idx], [event_code], [server_list_mask], [result], [ip], [game_code], [gamecode], [login_event], [email], [security_a_1], [security_a_2], [security_a_3], [security_a_4], [security_q_1], [security_q_2], [security_q_3], [security_q_4], [votepoints], [cash], [country]) select account_id , n'imad', n'3cfbbd2ae3c3e416c6d00a5a12ee60e8', null, null, 0, 0, null, -1997, 1, null, null, null, null, n'::1', null, null, null, n'imad.lekal@outlook.com', null, null, null, null, null, null, null, null, 0, 189, null auth.dbo.account;
Comments
Post a Comment