SQL查询不只显示结果消息 [英] Sql query doesn't display results only messages

查看:661
本文介绍了SQL查询不只显示结果消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对事务进行了sql查询,当我执行查询时,它成功了,但是它只显示一条消息,而不显示查询结果.如何更改它,以便在执行查询时显示查询结果.

继承人查询

I made an sql query for a transaction, when I execute the query it is successful however it only displays a message not the results of the query. How do I change it so the results of the query are displayed when I execute it.

Heres the query

BEGIN TRAN

UPDATE  Fish
SET FishType = 'Cod'
WHERE   id = '3'

COMMIT TRAN

推荐答案

如果没有查询,就很难弄清楚到底发生了什么.
但是,请确保在将所有where子句(来自查询)应用于表之后,可以返回值.
Without the query its quite impossible to figure out what is going on.
However, make sure you have values that can be returned after applying all the where clauses (from the query) to the tables.


正如Abhinav所说,您应该发布相关的代码段.另外,如果您正在例如调用存储过程,请检查是否没有打开NOEXEC,请参见: ^ ]
As Abhinav said, you should post the relevant pieces of code. Also if you''re for example calling a stored procedure, check that you don''t have NOEXEC on, see: SET NOEXEC[^]


Mika已经为使用OUTPUT子句提供了很好的解决方案.如果您使用的是SQL Server 2008,我只想再添加一个:
" SQL Server 2005 引入了after updateafter insertafter delete triggers的新功能,它们几乎解决了跟踪数据更改的问题.是SQL Server 2008中引入的,称为更改数据捕获(CDC). "
Mika already provide a good solution for using OUTPUT Clause. I just want to add one more if you are using SQL Server 2008:
"SQL Server 2005 introduced the new features of after update, after insert and after delete triggers that almost solved the problem of tracking changes in data. A better solution was introduced in SQL Server 2008 and is called Change Data Capture (CDC)." Ref. : Introduction to Change Data Capture (CDC) in SQL Server 2008


这篇关于SQL查询不只显示结果消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆