SQL Server:通过电子邮件发送动态SQL查询的结果(SQL Server: emailing the results of a dynamic SQL query)
我正在尝试使用游标构建一个循环,以便向具有此类延迟的客户端发送延迟订单列表。
带光标的
WHILE
循环是正常的,我正确地获取当前的@idClient
和@idClient
过滤查询。这是我到目前为止所作的(非工作)陈述:
exec msdb..sp_send_dbmail @profile_name='sql_mail_lu', @recipients = @email, @subject = 'Your backorders', @body = 'Please find in attachment the list of your items in backorder.', @execute_query_database = 'ERPSQL', @query = ' SELECT TOP 100 NoDoc, Refer Product, Comm Ordered, isnull(Livr, 0) Delivered, BackOrder, VRef FROM erpSQL.dbo.vwBoClients WHERE idclient = ' + @idClient' , @attach_query_result_as_file = 1, @query_attachment_filename ='backorders.txt'
我的问题是:我应该如何制定
@query =
部分以使其有效?I am trying to build a loop with a cursor in order to send a list of backorders to clients having such backorders.
The
WHILE
loop with the cursor is ok, and I am fetching the current@idClient
and@idClient
.Here is the (non working) statement I made so far:
exec msdb..sp_send_dbmail @profile_name='sql_mail_lu', @recipients = @email, @subject = 'Your backorders', @body = 'Please find in attachment the list of your items in backorder.', @execute_query_database = 'ERPSQL', @query = ' SELECT TOP 100 NoDoc, Refer Product, Comm Ordered, isnull(Livr, 0) Delivered, BackOrder, VRef FROM erpSQL.dbo.vwBoClients WHERE idclient = ' + @idClient' , @attach_query_result_as_file = 1, @query_attachment_filename ='backorders.txt'
My question is: how should I formulate the
@query =
part to make it work ?
原文:https://stackoverflow.com/questions/32969584
最满意答案
在
Celsius
,toCelsuis
应该返回this
因为Temperature
已经是摄氏温度。toFahrenheit
方法应该返回一个新的Fahrenheit
实例:@Override public Temperature toCelsius() { return this; } @Override public Temperature toFahrenheit() { return new Fahrenheit(this.getValue() * 9D / 5D + 32D); }
另一种方式是
Fahrenheit
级。In
Celsius
,toCelsuis
should returnthis
because theTemperature
is already in celsius. ThetoFahrenheit
method should return a newFahrenheit
instance :@Override public Temperature toCelsius() { return this; } @Override public Temperature toFahrenheit() { return new Fahrenheit(this.getValue() * 9D / 5D + 32D); }
And the other way around for the
Fahrenheit
class.
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
是否可以从该抽象类中的方法调用抽象方法(Is it advisable to call abstract methods from a method in that Abstract Class)[2021-12-20]
除了一些要点之外,这大部分都很好: 如果抽象方法只应该从process()方法内部调用,而不是独立于任何其他外部类调用,那么它们应该受到保护,而不是公共的。 如果子类不应该改变process()的实现,因为每个进程必须遵循这个模板,那么process()方法应该是final 如果不应该从外部类调用example()方法,而只是作为子类中sendResponse()实现的一部分,则它没有理由存在于基类中。 sendResponse()已经是抽象的,因此子类可以按照它想要的方式自由地实现它。 所以强迫它也实现一 ... -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
将internal成员添加到public抽象类中使得不可能在它声明的程序集之外继承该abstract类。但是在声明程序集之外,类本身以及所有派生类仍可以使用(因为类型是public )。 假设你有一个抽象类: public abstract AMyClass { public string DoSomething() { return DoSomethingInternal(); } internal abstract string DoSomethingI ...
-
你需要声明C类是抽象的。 You Need to declare Class C is Abstract.
-
并非抽象类中的每个方法都必须是抽象的 - 当您从类派生时,派生类将继承基类中的非抽象方法。 想要在基类中提供所有派生类共有的功能是非常常见的(实际上,将共享功能拉到基类以避免重复派生类中的代码是一种很好的编程实践)。 想要在基类中提供“默认”功能,然后可以被各个派生类覆盖,这也是非常常见的。 无法实例化基类本身的事实并不重要 - 基类中的非抽象方法在(非抽象)派生类的实例上调用。 Not every method in an abstract class has to be abstract - when ...
-
在抽象方法上返回类型(Return type on abstract method)[2021-10-27]
如果你声明抽象方法,那么你不应该给身体 protected abstract bool Validate(); 如果它不是抽象方法声明,而是给出一个抽象方法的实现,那么你应该使用method方法的return语句返回bool以满足声明中的返回类型。 protected abstract bool Validate() { //The method code return false; } 抽象方法声明引入了一种新的虚拟方法,但没有提供该方法的实现。 相反,非抽象派生类需要通过覆盖该 ... -
重构抽象类中包含抽象方法的具体方法(Refactoring a concrete method in abstract class which contains an abstract method)[2024-02-21]
你为什么不这样做呢 static class Helper { public static void ConcreteMethodB(AbstractClass caller) { //Huge code unrelated to this class caller.AbstractMethodA(); } } 然后在AbstractClass中 abstract class AbstractClass { public abstract void AbstractMeth ... -
抽象类中的C#抽象方法,其子类返回不同的类型(C# abstract method in abstract class with children that return different types)[2022-09-11]
您可以使用泛型完成此操作,并且仍然维护一个非泛型接口,您可以在不需要知道返回类型的任何地方引用它,例如: public interface IContent { object GetContent(); } public abstract class Content: IContent { public abstract T GetContent(); object IContent.GetContent() { return this.GetCo ... -
在Celsius , toCelsuis应该返回this因为Temperature已经是摄氏温度。 toFahrenheit方法应该返回一个新的Fahrenheit实例: @Override public Temperature toCelsius() { return this; } @Override public Temperature toFahrenheit() { return new Fahrenheit(this.getValue() * 9D / 5D + 32D); } ...