使用多表 SELECT 的结果填充测试数据库? (SQL Server 2005)
我想知道是否有技术或工具可以让我采用多表 SELECT 语句,完成内部和外部联接,并在运行后确定每个表中需要哪些行才能使相同的 SELECT 返回迷你版数据库中的相同行集?
理想的情况是为每个表生成一系列插入语句,然后我可以运行这些语句,作为涉及 SELECT 语句的某种单元测试的准备。
我知道外键约束可能会妨碍盲目插入,但我很好奇是否有人知道聪明的工作,包括找出每个表的适当行,放松约束,插入适当的行,然后重新启用约束?
I was wondering if there were techniques or tools out there that would let me take a multi-table SELECT statement, complete with inner and outer joins, and determine after running it exactly which rows in each table are required to make the same SELECT return the identical rowset in a mini version of the database?
The ideal would be to generate a series of insert statements for each table that I could then run as preparation for a unit test of a sort involving my SELECT statement.
I know that foreign key constraints can get in the way of blind INSERTS but was curious if anyone knows of clever work involving finding out the appropriate rows for each table, relaxing constraints, inserting the appropriate rows, then re-enabling the constraints?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论