S
S
symbyon12018-08-28 20:23:51
PHP
symbyon1, 2018-08-28 20:23:51

How to copy a column from one database to another MSSQL?

I understand that this question has been raised 100500 times, but I don’t understand mssql at all, and the essence of the problem is that:
-db1
database -user_account table -uid
column
must be copied to
-db2
database -user_data_ex table -uid
column
but also additionally add 2 more columns to db2>user_data_ex (1\epoch time, September 2\1st, 2018 also at epoch time)

$query4 = new msQuery("INSERT INTO ".$this->db2".dbo.user_data_ex(uid)," Select uid from db1.dbo.user_account where uid='".uid."');

this is how I tried to make a request and at the same time I ended up with a white screen ((((

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AUser0, 2018-08-28
@AUser0

Well, at least PHP code can you write correctly?
And how to add columns - I will not prompt, I do not know MsSQL.

A
Artyom Karetnikov, 2018-08-30
@art_karetnikov

Insert into is an insertion of data.
You need to read about alter table add column - this is practically a ready-made command for your purpose, it remains to specify the name of the column and its type

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question