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 |
|
moramoga
Starting Member
34 Posts |
Posted - 2008-01-23 : 16:08:04
|
| Hi again,For example I have this query:Select error_Description from ErrorTableLets suppose that query return 200 characters, how do I restrict it, so it only returns 50 characters or letters? |
|
|
jdaman
Constraint Violating Yak Guru
354 Posts |
Posted - 2008-01-23 : 16:17:09
|
| LEFT(error_Description, 50) |
 |
|
|
hey001us
Posting Yak Master
185 Posts |
Posted - 2008-01-23 : 16:19:33
|
| There is a 3 way as per my knowledge. you can use either oneSelect substring(error_Description,1,50) from ErrorTableSelect left(error_Description,50) from ErrorTableSelect right(error_Description,50) from ErrorTablehey |
 |
|
|
moramoga
Starting Member
34 Posts |
Posted - 2008-01-23 : 16:48:32
|
| Thank you guys |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-01-23 : 17:03:17
|
For what it is worth you could also CAST the column:DECLARE @Foo VARCHAR(10)SET @Foo = '1234567890'SELECT CAST(@Foo AS VARCHAR(5)) |
 |
|
|
|
|
|