How can we help you today? Enter your search term here... Search Login to submit a new ticket Check ticket status Start a new topic Discussions VistaDB Feature Requests Planned Support accumulating variable changes within a query J John Tamburo started a topic over 7 years ago There are several cases in SQL where it's necessary to update a variable once per row in a result, accumulating all of the changes together.A sample of code that works in SQL Server:DECLARE @InvoicesList VARCHAR(1024) SELECT @InvoicesList = COALESCE(@InvoicesList + ', ', '') + pay.[InvoiceNumber] FROM Payments AS pay WHERE pay.Order_id = @orderId ORDER BY pay.[InvoiceNumber] RETURN @InvoicesList'VistaDB presently returns the last column value. Please vote this up! Login to post a comment More topics in Feature Requests Support for SELECT INTO syntax DataBuilder: Export to CSV Overload DDA put methods to accept nullable values VistaDB 5 and EF 6 Code First Server Edition DataBuilder Enhancements DataBuilder - Generate SQL Script for stored procs & udfs VistaDB DataBuilder Table Grid Enhancements Export Of Content In Print Control Window Request SQL Generated Statement From VistaDB Data Builder See all 16 topics
John Tamburo
There are several cases in SQL where it's necessary to update a variable once per row in a result, accumulating all of the changes together.
A sample of code that works in SQL Server:
'
VistaDB presently returns the last column value. Please vote this up!