Reputation: 99
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.
Upvotes: 3
Views: 4067
Reputation: 5588
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
Upvotes: 0
Reputation: 12707
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;
Upvotes: 0
Reputation: 735
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
Upvotes: 0
Reputation: 8871
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)+'.........'
Upvotes: 2
Reputation: 18629
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.
Upvotes: 0