473,320 Members | 1,951 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,320 software developers and data experts.

Concat two fields but force first field fixed length in SQL query

Hi,

I'm trying to concatenate filed SOBID (fixed length of 10 characters,
even if blank) with SOBID again, but first four characters)

The result should be some spaces of the data in field SOBID is less
then 10 characters long.
This needs to be done in an sql statement. I've been looking for a
solution but can;t find it.

SOBID contains characters

This is where i got:
Expr1: Format([SOBID],"0000AAAAAA") & Left([SOBID],4)

Doesn't work, there doesn't seem to be a real format option for
formatting text, there are those for formatting nrs, dates, currencies.
Basically i need Fixedlenght 10 SOBID & Left([SOBID],4)
So spaces after sobid if less then 10 chars of data, all in an sql
statement offcourse :)

1501PROD 1501
1501SAPEHR1501

The name of the function would help a lot.

thanks,
Steve

Jun 1 '06 #1
1 6230
ho****@hotmail.com wrote:
Hi,

I'm trying to concatenate filed SOBID (fixed length of 10 characters,
even if blank) with SOBID again, but first four characters)

The result should be some spaces of the data in field SOBID is less
then 10 characters long.
This needs to be done in an sql statement. I've been looking for a
solution but can;t find it.

SOBID contains characters

This is where i got:
Expr1: Format([SOBID],"0000AAAAAA") & Left([SOBID],4)

Doesn't work, there doesn't seem to be a real format option for
formatting text, there are those for formatting nrs, dates, currencies.
Basically i need Fixedlenght 10 SOBID & Left([SOBID],4)
So spaces after sobid if less then 10 chars of data, all in an sql
statement offcourse :)

1501PROD 1501
1501SAPEHR1501

The name of the function would help a lot.

thanks,
Steve

Left(Sobid & Space(10),10) & Left(Sobid & space(4),4)
Jun 1 '06 #2

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

Similar topics

6
by: AAVF | last post by:
Hi We have a problem with a query. An Access database links via ODBC to a UNIX server. To speed things, we use the ODBC to load the relevant tables to the local PC that runs Access so that...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
3
by: dchristjohn | last post by:
I am currently developing a small windows application using Visual Basic via Visual Studio 2005. My database resides on a SQL 2000 server. I have a table with three fields: id (int, Not Null)...
2
by: Frank Swarbrick | last post by:
I'm just learning about embedded SQL, so be gentle... My basic question is, if I use a fixed length host variable for a column defined as VARCHAR, will trailing spaces be removed (or not) upon...
2
by: rcamarda | last post by:
Hello, I need to alter fields in all my tables of a given database, and I would to do this via a t-sql script. Example, I want to change all fields called SESSION_ID to char(6). The field is...
6
by: Barry Edmund Wright | last post by:
Hi, We are having a large cheque run printed by an outside printer. The printer asked us to give him the layout of the fields to print on a form and send it to him. As an example the form looks...
8
by: Wingot | last post by:
Hey, I have a program I am trying to write using Visual C#, SQL Server 2005/2008, and Visual Studio 2008, and one part of it includes a Schema called Client. Inside this schema, three tables...
5
by: Rowan | last post by:
Hi, I am somewhat new to .net and c#. (What I learned in previous co has to be unlearned). I am doing something that seems simple but I think there is a better way than how I learned to do it. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.