Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-02-25 : 09:02:05
|
| Lady writes "could anyone tell me how shell I make following query:I have table T1with column C1 nvarchar(100)I have to get full value C1 if lEN(C1)<10 AND LEFT(C1,10) +'...' if C1 more then 20 symbols.the query like this for example:C1testwhery long...my testit's again..." |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-02-25 : 09:07:20
|
| What if it's between 10 and 20?select case when len(C1)<=10 then C1 when len(C1) > 20 then left(C1,10) + '...'endfrom tblif the second bit should have been 10 then you canselect left(C1,10) + case when len(C1) > 10 then '...' else '' endfrom tbl==========================================Cursors are useful if you don't know sql.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|