I m just trying to some write down the some sql functions which is very useful for us as we know we can do these things in asp.net also but this is good if we have some knowledge about something better while developing something. I have just used some common functions which we use in our daily life while doing programming. Hope this will help you.
*Copying the following must replace the –> ‘ from keyboard.
[--] this sign is used for commenting the queries.
–Removing the spaces
DECLARE @str VARCHAR(50)
SET @str =’ Vikram Dhawan ‘
select @str as [1. myname]
select LTRIM(@str) as [2. LTRIM]
select RTRIM(@str) as [3. RTRIM]
select LTRIM(RTRIM((@str))) as [4. LTRIM/RTRIM]
–you can use here your table column name
–select LTRIM(RTRIM((yourcolumname))) from tablename
–SYNTAX SUBSTRING(expression,starting no.,length)