使用 Visual Studio 2008 编辑 SQL 查询

发布于 2024-07-06 10:04:04 字数 316 浏览 6 评论 0原文

您能否向我推荐使用 Visual Studio 2008 Professional 编辑 SQL 查询的最佳方法?

我知道我可以从服务器资源管理器的上下文菜单中打开查询窗口并在 SQL 窗格中编辑文本。 但不幸的是,我不允许将查询保存到文件中,并且查找和替换命令在那里不起作用。

或者,我可以在 Visual Studio 编辑器中打开扩展名为 .SQL 的文本文件,获得语法突出显示和完整编辑功能,但失去执行脚本的可能性。

现在,我将查询文本从一个窗口复制到另一个窗口,然后再复制回来,但我希望有更好的解决方案。

非常感谢您的建议!

Would you recommend me the best approach to edit SQL query with Visual Studio 2008 Professional, please?

I know I can open Query window from context menu in Server Explorer and edit text in SQL Pane. But unfortunately I am not allowed to save query to a file and Find and Replace commands are not working there.

Alternatively I can open text file with extension .SQL in Visual Studio editor obtaining syntax highlighting and full editing capabilities but losing possibility to execute the script.

Now I copy query text from one window to another and back but I hope there is better solution.

Many thanks for suggestions!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蝶舞 2024-07-13 10:04:04

当我必须连接到 Sql Server 时,我使用 NetBeans,因为它具有许多功能,使其比 Visual Studio 更易于使用。 其中之一是智能感知,当您有表名的别名和大量长字段名时,它非常有用。 NetBeans 中连接和连接池的一般处理也更加清晰。 我可以继续,但建议你自己尝试一下。 您几乎肯定需要 Sql Server jdbc 驱动程序,可以从 http: //msdn.microsoft.com/en-us/data/aa937724.aspx

When I have to connect to Sql Server, I use NetBeans, as it has a number of features that make it much easier to use than Visual Studio. One of these is intellisense, which is very useful when you have an alias for a table name and lots of long field names. The general handling of connections and connection pools is also much cleaner in NetBeans. I could go on, but suggest trying it for yourself. You will almost certainly need the Sql Server jdbc driver, which can be downloaded from http://msdn.microsoft.com/en-us/data/aa937724.aspx

久光 2024-07-13 10:04:04

如果您在 Visual Studio 的解决方案中创建数据库项目,则可以为该项目设置默认数据库连接。 然后,可以针对该连接执行数据库项目中包含的任何 *.sql 文件。 我通常做的是选择要执行的文本并右键单击它,然后选择“运行选择”。

您可以在解决方案资源管理器的“数据库引用”节点下设置任意数量的数据库连接,并选择要运行查询的连接。

If you create a Database project within your solution in Visual Studio, then you can set up a default database connection for that project. Then any *.sql files that are included in the database project can be executed against that connection. What I usually do is select the text to be exectued and right-click it, then select "Run Selection".

You can set up any number of database connections under the "Database References" node in the solution explorer, and choose the one you want to run your query against.

℉絮湮 2024-07-13 10:04:04

哇,你是对的,这真的很痛苦。 您是否可以接受使用 SQL Management Studio 的本地副本(名称可能有误)? 您将在 VS 之外,但您仍然可以编辑查询并同时运行它。 绝对不是最佳选择,但总比没有好。

祝你好运。

Wow you are right, this is a real pain. Would it be acceptable for you to use a local copy of the SQL Management Studio (the name might be wrong)? You would be outside of VS but you could still edit your query and run it at the same time. Definitely not optimal but better than nothing.

Good luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文