Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Help with syntax

Author  Topic 

Pinto
Aged Yak Warrior

590 Posts

Posted - 2005-04-04 : 05:26:13
I have the following sql statement but I get the error

Syntax error converting the varchar value ' :: ' to a column of data type int.

when I run my asp.net page. The top version works but when I try to TicketNo to the concatenationI get the error.

Dim strSQL As String = "Select DISTINCT CallNo,TicketNo, Surname + ' :: ' + Call_desc as Ticket from tblSL_Calls where Division = 'Environmental Services' and Service = 'BULKY HOUSEHOLD COLLECTIONS' and Completed_time is null and Cancelled is null and TicketNo >0 ORDER BY CallNo asc"

Dim strSQL As String = "Select DISTINCT CallNo,TicketNo,TicketNo + ':: ' + Surname + ' :: ' + Call_desc as Ticket from tblSL_Calls where Division = 'Environmental Services' and Service = 'BULKY HOUSEHOLD COLLECTIONS' and Completed_time is null and Cancelled is null and TicketNo >0 ORDER BY CallNo asc"

nr
SQLTeam MVY

12543 Posts

Posted - 2005-04-04 : 05:28:33
Dim strSQL As String = "Select DISTINCT CallNo,TicketNo,convaert(varchar(20),TicketNo) + ':: ' + Surname + ' :: ' + Call_desc as Ticket from tblSL_Calls where Division = 'Environmental Services' and Service = 'BULKY HOUSEHOLD COLLECTIONS' and Completed_time is null and Cancelled is null and TicketNo >0 ORDER BY CallNo asc"


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2005-04-04 : 05:39:00
Brilliant - thank you so much. I cannot believe the speed with which you get a response on this forum. I wish I could help as many as help me !
Go to Top of Page
   

- Advertisement -