473,409 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

select cast help needed

What is the correct syntax for querying the first 20 characters of a
memo field?

I'm trying to
SELECT CAST (varchar(20) fieldname) as newfieldname
and i get a bunch of errors

Can someone please help me?

MS Access DB used with ColdFusion

Thanks
Jan 26 '06 #1
4 5496
I don't have access installed but, I think you can just use the left
function...

SELECT left(fieldName, 20) as newFieldName

Jan 26 '06 #2
Thank you.
That works for one field. What if I wanted to get the first 20
characters from multiple fields? I'm trying to display the first few
lines of few articles. Each article has its own field in the db. Any ideas?
KenJ wrote:
I don't have access installed but, I think you can just use the left
function...

SELECT left(fieldName, 20) as newFieldName

Jan 26 '06 #3
On Wed, 25 Jan 2006 20:39:45 -0500, T.M. wrote:
What is the correct syntax for querying the first 20 characters of a
memo field?

I'm trying to
SELECT CAST (varchar(20) fieldname) as newfieldname
and i get a bunch of errors

Can someone please help me?

MS Access DB used with ColdFusion

Thanks


Hi T.M.,

For Access help, you might want to post to an Access group. This group
is for SQL Server. :-)

In SQL Server, you'd use

SELECT CAST(fieldname AS varchar(20)) AS newfieldname FROM tablename

I have no idea how well that would port to Access.

--
Hugo Kornelis, SQL Server MVP
Jan 26 '06 #4
T.M. (ia************@yahoo.com) writes:
Thank you.
That works for one field. What if I wanted to get the first 20
characters from multiple fields? I'm trying to display the first few
lines of few articles. Each article has its own field in the db. Any
ideas?


comp.databases.ms-access
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jan 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jeff Sandler | last post by:
I need a MySQL select statement as part of a PHP script. I want to find rows where a certain column either starts with or equals a user-supplied string. The string will be 1 or more characters in...
2
by: alexqa2003 | last post by:
name1 field is is nvarchar(40). (1)select case when isnumeric(name1) = 1 then cast(name1 as int) else null end as name In (1) when name1 is not numeric, name is null and its type becomes...
10
by: Simon | last post by:
Hi, If I have a lot of articles, all with a unique IDs. First I would like to search for that ID, I could do SELECT * from ARTICLE where ID = xx But I also want to display the 5 articles...
2
by: T.M. | last post by:
What is the correct syntax for querying the first 20 characters of a memo field? I'm trying to SELECT CAST (varchar(20) fieldname) as newfieldname and i get a bunch of errors Can someone...
4
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
3
by: ian.l.guthrie | last post by:
I have a table consisting of two fields, OStype and OSversion, with entries like: OStype OSversion solaris 2.5 solaris 2.6 redhat 6.2 redhat 6.2 solaris 8 redhat AS4
1
by: rakeshzingade | last post by:
Hi all, I am studying network programming using Perl, while going through examples I found below 2 functions. I tried to understand myself what these below functions does except socket, bind,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.