I have a problem with the maintenance of a system, when inserting a new data I put a space at the beginning when it is saved. Example: entering a
I have a problem with the maintenance of a system, when inserting a new data I put a space at the beginning when it is saved. Example: entering a
From SQL Server you can help with the following functions:
LTRIM()
What helps me to eliminate spaces at the beginning of a string RTRIM()
Which helps me to eliminate spaces at the end of a string You can both work mixed and use them as in the following example
INSERT INTO tableName(columnaUno) VALUES(LTRIM(RTRIM(valorUno)));
So that although I write the following:
INSERT INTO tableName(columnaUno)
values
(LTRIM(RTRIM(' daniel '))), (' alfredo');
The final result will be
select * from tableName;
columnaUno
daniel
alfredo
pedro
Daniel although he declared himself with spaces on both sides, they were deleted by the 2 functions, as the Alfredo register was added a space but no function was passed, said space at the beginning he kept