Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Query language and DCS > Trim value in sql

Forum

Search UsersRules
Trim value in sql
#1
Just came
Points:: 0
Joined:: Jan 14, 2013

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

Profile
#2
Guest
Points::
Joined::

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.

Profile
#3
Just came
Points:: 0
Joined:: Jan 14, 2013

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!

Profile
#4
Guest
Points::
Joined::

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.

Profile
#5
Just came
Points:: 0
Joined:: Jan 14, 2013

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

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.