SQL 在调试期间观察 SSIS 中的变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/582166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Watching variables in SSIS during debug
提问by Tom H
I have a project in SSIS and I've added an Execute SQL Task which sends its result out to a variable. I wanted to confirm the value because I was worried that it would try to write it out as a resultset object rather than an actual integer (in this case I'm returning a COUNT).
我在 SSIS 中有一个项目,我添加了一个执行 SQL 任务,它将结果发送到一个变量。我想确认该值,因为我担心它会尝试将其作为结果集对象而不是实际整数写出(在这种情况下,我将返回一个 COUNT)。
My first thought was just to run it in debug mode and add the global variable to my Watch window. Unfortunately, when I right-click on the Watch window, the option to "Add Variable" is greyed out. What am I missing here?
我的第一个想法是在调试模式下运行它并将全局变量添加到我的 Watch 窗口。不幸的是,当我右键单击 Watch 窗口时,“添加变量”选项是灰色的。我在这里缺少什么?
I've gotten around confirming that my variable is set correctly, so I'm not interested in methods like putting a script in to do a MsgBox with the value or anything like that. For future reference I'd like to be able to watch variables in debug mode. If there are some kind of constraints on that then I'd like to know the what and why of it all if anyone knows.
我已经开始确认我的变量设置正确,所以我对诸如将脚本放入带有值或类似值的 MsgBox 之类的方法不感兴趣。为了将来参考,我希望能够在调试模式下观察变量。如果对此有某种限制,那么如果有人知道,我想知道这一切的原因和原因。
The help is woefully inadequate on this one and every "tutorial" that I can find just says, "Add the variable to the Watch window and debug" as though there should never be a problem doing that.
在这个和我能找到的每个“教程”上的帮助都非常不足,只是说“将变量添加到监视窗口并进行调试”,好像这样做永远不会有问题。
Thanks for any insight!
感谢您的任何见解!
回答by Dave Swersky
I believe you can only add variables to the Watch window while the debugger is stopped on a breakpoint. If you set a breakpoint on a step, you should be able to enter variables into the Watch window when the breakpoint is hit. You can select the first empty row in the Watch window and enter the variable name (you may or may not get some Intellisense there, I can't remember how well that works.)
我相信您只能在调试器在断点处停止时向 Watch 窗口添加变量。如果在步骤上设置断点,则应该能够在遇到断点时在 Watch 窗口中输入变量。您可以在 Watch 窗口中选择第一个空行并输入变量名称(您可能会也可能不会在那里获得一些智能感知,我不记得它的效果如何。)
回答by internetuser0x00
Drag the variable from Variables pane to Watch pane and voila!
将变量从 Variables 窗格拖到 Watch 窗格,瞧!
回答by Jim
I know this is very old and possibly talking about an older version of Visual studio and so this might not have been an option before but anyway, my way would be when at a breakpoint use the locals window to see all current variable values ( Debug >> Windows >> Locals )
我知道这很旧,可能是在谈论旧版本的 Visual Studio,所以这可能不是以前的选项,但无论如何,我的方法是在断点处使用本地窗口查看所有当前变量值(调试 > > 窗户 >> 当地人)
回答by Robin Warhurst
Visual Studio 2013: Yes to both adding to the watch windows during debugging and dragging variables or typing them in without "user::". But before any of that would work I also needed to go to Tools > Options, then Debugging > General and had to scroll right down to the bottom of the right hand pane to be able to tick "Use Managed Compatibility Mode". Then I had to stop and restart debugging. Finally the above advice worked. Many thanks to the above and to this article: Visual Studio 2015 Debugging: Can't expand local variables?
Visual Studio 2013:是,在调试和拖动变量期间添加到监视窗口或在没有“user::”的情况下键入它们。但在任何这些工作之前,我还需要转到“工具”>“选项”,然后“调试”>“常规”,并且必须向右滚动到右侧窗格的底部才能勾选“使用托管兼容模式”。然后我不得不停止并重新启动调试。最后,上述建议奏效了。非常感谢以上内容和本文: Visual Studio 2015 调试:无法扩展局部变量?