T-SQL 中的类似形状查询
我想编写一个 T-SQL 语句,将数据结构化以加载到 Ado.Net 数据集中,就像使用 ADO SHAPE 命令一样。 T-SQL中有类似的东西吗?
我的想法是从主表中选择多行,并从子表中选择所有相关记录。该数据将被加载到数据集中,然后我将创建关系并使用 GetChildRows()。
最直接的解决方案是从主表中选择记录到临时表中,然后使用“select * from child_table where ParentID in (select Id from #temp)”。但在更复杂的场景中,代码会变得相当难看。
有更好的解决方案吗?
I would like to write a T-SQL statement, that structures data to be loaded into a Ado.Net DataSet like it was possible with the ADO SHAPE command. Is there something similar in T-SQL?
My idea is to select multiple rows from a main table and all related records from a child table. That data would get loaded in to a DataSet and then I would create relations and use GetChildRows().
The most straight forward solution would be to select records from the main table into a temp table and then use "select * from child_table where ParentID in (select Id from #temp)". But in more complex scenarios the code will become quite ugly.
Is there a better solution available?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案很简单:根本不可能! :-(
The answer is quite simple: It's not possible at all! :-(