Discussion:
How to use convert() or cast() function ?
(too old to reply)
ADMIN
2005-08-20 09:09:55 UTC
Permalink
I have SQL2K in the backend and visual foxpro in front end.

My sql database has a column called address and it is in memo type.

I tried following but could not get anywhere:

select cast(address as char(35))

or

select convert(char(35), address)

What is the best method ? Please help
n***@cyberia.net.lb
2005-09-03 09:05:02 UTC
Permalink
you are using an SQL Query.
you want the first 35 characters from TEXT column.
use the following in your select.

SELECT SUBSTRING(ADDRESS, 1, 35) AS Address

cast and convert works the same, but use them when you want to convert from
one type to another, for example, float to integer, datetime to
smalldatetime, char to numeric, etc..
Post by ADMIN
I have SQL2K in the backend and visual foxpro in front end.
My sql database has a column called address and it is in memo type.
select cast(address as char(35))
or
select convert(char(35), address)
What is the best method ? Please help
Loading...