我已经搜索了几天,却找不到将数据从一个数据库复制到另一个数据库的方法。
我已经提到了Copy tables from one database to another in SQL Server 和How to copy row from a table to another table if the entry does not exist in the new table in sql-进行了一些查询,结果显示[0行受影响](我仅在Source数据库中创建了一些虚拟记录,看是否是工作)
查询如下: [Column1和Column2是主键,Column1可以相同,但column2必须不同]
USE Destination
INSERT INTO Destination.dbo.Table(Column1, Column2, Column3 etc...)
SELECT * FROM Source.dbo.Table(Column1, Column2, Column3 etc...)
WHERE Source.dbo.Table.Column1= Column1 And Source.dbo.Table.Column2 Not In (Column2)
赞赏是否有人可以让我知道查询出了什么问题/我错过了提及的任何类似问题/任何方法都可以正常工作。
答案 0 :(得分:1)
我认为您可以尝试使用class TrafficLight extends React.PureComponent {
state = { lamp: null, currentcolor: "red" };
// turnLampOn event handler
turnLampOn = async () => {
while (true) {
await this.waitSomeSeconds("green", this.state.lamp.red);
// currentcolor=green wait 'green' ms and enable 'yellow'
await this.waitSomeSeconds("yellow", this.state.lamp.green);
// currentcolor=yellow wait 'yellow' ms and enable 'red'
await this.waitSomeSeconds("red", this.state.lamp.yellow);
}
};
waitSomeSeconds = (color, wait) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log(
this.props.street +
": from " +
this.state.currentcolor +
" to " +
color +
", wait=" +
wait
);
this.setState({ currentcolor: color });
resolve();
}, wait);
});
};
componentDidMount = async () => {
// connect to server on Heroku cloud
const socket = io.connect();
socket.emit("join", { streetName: this.props.street }, err => { });
// wait on 'turnLampOn'
socket.on("turnLampOn", lampData => {
console.log("turnLampOn", lampData);
// Set new lamp data and start trafficlight
if (this.state.lamp === null) {
// To resolve this error you can call `turnLampOn`
// in a callback passed to setState
this.setState({ lamp: lampData }, () => this.turnLampOn());
}
});
};
}
和exists
来实现。
not exists