Trim value in sql

Common questions about 1C:Query language, Query builder tool and Data composition schema

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 14, 2013
Company:

Hi all,
I try to trim value in sql that the same in sql server but I could not do it
Please help me!

 
#2
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Dinh Hung!

Please provide steps that you are performing, source and resulting values.

Plus if you are trying to manage data of the application directly in the SQL database, you might break the data consistency. It is recommended to use 1C:Enterprise platform features only to handle the data.

 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 14, 2013
Company:

Dear Admin!
This is my sql statement

Code
 "SELECT
|Emp.Code,
|Emp.Description
|FROM
|Catalog.Employees AS Emp"

After execute I have a result: Code = "A0001    " and Description = "HungDX  " but I want trim value in sql statement ex:
Code
"SELECT
|Trim(Emp.Code),
|Trim(Emp.Description)
|FROM
|Catalog.Employees AS Emp"

and result will be Code = "A0001" and Description = "HungDX"

Thanks u!

 
#4
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Dinh Hung!

It is better to keep this data trimmed than trying to process it using SQL. So I recommend you to process entire the data and change Code and Description to trimmed ones.
In more complicated cases it is better to add an additional attribute that will keep precalcualted values, updated when an item is written.

Of course remember to make a backup before doing this.

 
#5
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 14, 2013
Company:

Hi Timofey!
Thanks for your support but I think it's not a best solution.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.