3

This is the query which i am using to reduce the length of the character.

these are some example char("For more information about the valid SQL Server 2005 data types that can be ... Is an integer that specifies where the substring starts. start can be of type bigint.")

if i give substring to fix the length up to 15 . the rest of the char should show like this way(...)

my sql query is this.....

select substring('For more information about the valid SQL Server 2005 data types that can be ... Is an integer that specifies where the substring starts. start can be of type bigint.',0,15) from Admin

for example: it should show like this

For more information about the valid SQL Server 2005 data.
1
  • "The rest should show like ....", is this true or do you want to shorten the string? What does not work? Commented Nov 7, 2012 at 9:08

5 Answers 5

2
select substring('For more information about the valid SQL Server 2005 data types that can be ... Is an integer that specifies where the substring starts. start can be of type bigint.',0,58)+'.........' 
Sign up to request clarification or add additional context in comments.

Comments

0

Did you mean this:

select Left('For more information about the valid SQL Server 2005 data', 15)+'...'

Specify the number of characters to be shown as the second parameter of system defined function LEFT.

Comments

0

you can use something like this:

    select substring('For more information about the valid SQL Server 2005 data types that can be ... Is an integer that specifies where the substring starts. start can be of type bigint.',0,15)+replicate('.', 25) 
from Admin 

Comments

0

If you want the output to be something like this

First_15_letters_ ... _Last_15_letters

Then here is one way to do it

select 
substring('For more information about the valid SQL Server 2005 data types that can be ... Is an integer that specifies where the substring starts. start can be of type bigint.',0,15) 

+ '...' + 

right('For more information about the valid SQL Server 2005 data types that can be ... Is an integer that specifies where the substring starts. start can be of type bigint.',15)

from Admin;

Comments

0
Please, not down from here :
=======================================================
  select substring('For more information about the valid SQL Server 2005 data types that
    can    be ... Is an integer that specifies where the substring starts. start can 
    be of type bigint.',0,15) 
--Not need "from Admin"
===============================================================
select substring(colname,0,15) from Admin
--"from Admin" Need when columnname is required 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.