0

我有一个会话表,其中包含

sesssion_key (PK, bigint,not null),
created(datetime, not null)
content(image, null)

现在我需要将这样的会话导入到文件中,以便可以将其导入到另一个 mssqsl 实例中。

有人知道如何做到这一点吗?

4

2 回答 2

0

Are the instances on the same server? If so, just:SELECT * into newDB.sessions FROM olddb.sessions;

If they are not on the same server, go with either of Mithrandir's suggestions

于 2013-02-06T16:20:06.867 回答
0

You could use the inport/export wizard from SSMS or the command line tool bcp. A bcp session might look like this:

Export data to a file:

 bcp databasae.schema.table out outputfile -S source_server -T -n

or

 bcp "SELECT sesssion_key, created, content FROM databasae.schema.table WHERE sesssion_key  = 0000001" queryout outputfile -S source_server -T -n

Then you can import the data to another server with the same table:

 bcp databasae.schema.table in inputfile -S destination_server -T -n
于 2013-02-06T16:20:10.133 回答