We help IT Professionals succeed at work.

Incorrect SQL

354 Views
Last Modified: 2012-02-15
Hello,

Struggling with a simple SQL statement - this --

Select 
OrderID,
OrderID +'-'+'('+M.FirstName + ' ' +M.LastName+')'+M.ClubName+'-'+CONVERT(VARCHAR(11),OrderDate,106) As OrderDetail
from dbo.Ordertb O
inner join dbo.Member M
on O.MemberID = M.ID
where [Direct-Order] = 'Y' AND OrderStatus = 2 AND BatchID IS NULL
Order by OrderID Asc

Open in new window


Gives me this --

Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value '(' to data type int.

Appreciate any insight -

thanks
Comment
Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
the column is an INT so would char(n)  be char(4)?

Thanks

Author

Commented:
Thanks
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.