Solved

Substring issues

Posted on 2006-11-20
2
348 Views
Last Modified: 2012-05-05
I have been trying to combine 2 fields together.  I have tried several different permutations of the substring command and am having no luck.  

I have defines all fields involved in this command as char.  Here is what I am trying:

insert
into lcs_out
substring('prefix,1,2)+substring(class_subject_cd,1,10)as Unique_id
from temp_table

this should be easy, but I am knocking my head against the wall.

any advice is appreciated.  

0
Comment
Question by:ericsberr
2 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17981345
>I have been trying to combine 2 fields together.

possibly you want to update an existing table/field/row:
update temp_table
set lcs_out =  substring(prefix,1,2)+substring(class_subject_cd,1,10)

or update another table:
update lcs_out
set uniqueid=  substring(t.prefix,1,2)+substring(t.class_subject_cd,1,10)
from  lcs_out l
join temp_table t
  on <some join condition>

0
 
LVL 9

Accepted Solution

by:
gpompe earned 500 total points
ID: 17981346
The syntax is fine, except you have a single quotation mark before "prefix"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question