TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jes Sie
744
1.2k
281k
Concatenating sql table rows and converting a data type
Mar 26 2017 10:38 AM
I'm concatenating multiple table rows into one row. Below code is the working only with nvarchar data type but not with int.
ALTER
PROCEDURE
[dbo].[spViewConcatenatedPolicyCInoForTaxInvoice_motorOnly]
-- Add the parameters for the stored procedure here
@TaxInvoiceNumber nvarchar(50)
AS
BEGIN
DECLARE
@MotorCINo
int
SET
@MotorCINo=
''
SELECT
@MotorCINo = @MotorCINo + MotorCINo +
', '
FROM
CashierSalesDetails
WHERE
TaxInvoiceNumber = @TaxInvoiceNumber
SELECT
LEFT
(@MotorCINo,LEN(@MotorCINo)-1)
AS
PolicyCINo
END
below is the error:
Msg 245,
Level
16, State 1,
Procedure
spViewConcatenatedPolicyCInoForTaxInvoice_motorOnly, Line 17
Conversion failed
when
converting the
varchar
value
', '
to
data type
int
.
Any is greatly appreciated.
Reply
Answers (
4
)
How do I write a C# program that can run any windows system.
How to get Formula in excel from frontend using c# + vsto.