Home > Archive > Microsoft SQL Server forum > October 2005 > How do I concatenate text to a sql statement









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How do I concatenate text to a sql statement
COHENMARVIN

2005-10-27, 9:25 am

The following sql statement fails:
SELECT IdFlight, OrganizerLastName + ", " + OrganizerFirstName + "
Flt:" + FlightNumber As Concat FROM TableFlights Order By
OrganizerLastName, OrganizerFirstName
I'm trying to concatenate fields and words, but my asp.net page gives
me an error saying " Flt:" is not a field.
Thanks,
Marvin

David Portas

2005-10-27, 9:25 am

SQL delimits string literals with single quotes rather than double:

SELECT IdFlight, OrganizerLastName + ', ' + OrganizerFirstName +
'Flt:' + FlightNumber AS Concat
FROM TableFlights
ORDER BY OrganizerLastName, OrganizerFirstName ;

--
David Portas
SQL Server MVP
--

"COHENMARVIN" <cohenmarvin@hotmail.com> wrote in message
news:1129835952.069950.284810@z14g2000cwz.googlegroups.com...
> The following sql statement fails:
> SELECT IdFlight, OrganizerLastName + ", " + OrganizerFirstName + "
> Flt:" + FlightNumber As Concat FROM TableFlights Order By
> OrganizerLastName, OrganizerFirstName
> I'm trying to concatenate fields and words, but my asp.net page gives
> me an error saying " Flt:" is not a field.
> Thanks,
> Marvin
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com