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 |
|
jose1lm
Yak Posting Veteran
70 Posts |
Posted - 2004-09-07 : 17:07:46
|
| How can I trim some of the characters before the results are shown? I can't use RTRIMbecause the value doesn't have a static place on where to start the trim. It needs to start trimming off the characters once it reachs the first '-'.After the trimming fuction, this is how I would like the results to look like:LinkIds | Filename1 | 050112 | 050273 | 0111364 | 149950*********************************************CREATE TABLE [dbo].[active_dwg] ( [LinkIds] [int] NOT NULL , [Filename] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Fsize] [bigint] NULL , [Fmodified] [datetime] NULL ) ON [PRIMARY]GOINSERT INTO active_dwg ([LinkIds],[Filename])VALUES ('1','05011-00-revL.pdf')INSERT INTO active_dwg ([LinkIds],[Filename])VALUES ('2','05027-XX-revD.pdf')INSERT INTO active_dwg ([LinkIds],[Filename])VALUES ('3','011136-revB.pdf')INSERT INTO active_dwg ([LinkIds],[Filename])VALUES ('4','149950-00-revA-signed.pdf')GOSELECT [LinkIds],[Filename]FROM dbo.active_dwgGODROP TABLE dbo.active_dwg*********************************************JLM |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-07 : 17:11:46
|
this should do it:select LinkIds, left(Filename, charindex('-', Filename)-1) as TrimmedFileNamefrom active_dwgGo with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|
|
|