Re: SQL issue?

From: Allan Mitchell (allan_at_no-spam.sqldts.com)
Date: 11/11/04


Date: Thu, 11 Nov 2004 20:23:15 -0000

Here is how you do it from the format of the data you have provided

Look for the First _ character from the left of the string. This is the
position at which you start
Look for the first _ character from the right of your string and add two
places. This is there you end.
Use substring to grab the String i.e.

2004_03_11

Now use Replace to replace the _ with ''

-- 
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.Konesans.com
"Steve" <Steve@discussions.microsoft.com> wrote in message 
news:6EC01CE9-6FAE-4DC7-BC7F-EDAA959BAB69@microsoft.com...
> Hi
>
> I have column FName of varchar type.
>
> FName
> ------
> Mktg_2004_03_11Completed
> Fin_2004_03_10Test
> Acct_2004_03_09Failed
>
> I want to get get result set as
>
> FName
> ------
> 20040311
> 20040310
> 20040309
>
> I tried using replace, stuff but couldn't make it work.
>
> Plz. help
>
> Thanks 


Relevant Pages

  • Proposal: String::Format::General
    ... It provides format string parsing and output assembly, you provide the code that implements the individual conversion characters. ... Format syntax is kind of a cross between sprintf and strftime, but how close it is to each of these depends on the semantics implemented by the user. ... Note that the following is pre-alpha documentation; the interface to the output conversion code has changed since yesterday, ... conversion character, and contain a number of optional fields which may ...
    (comp.lang.perl.modules)
  • [TOMOYO #15 3/8] Common functions for TOMOYO Linux.
    ... This file contains common functions (e.g. policy I/O, pattern matching). ... Since TOMOYO Linux is a name based access control, ... TOMOYO Linux's string manipulation functions make reviewers feel crazy, ... the Linux kernel accepts all characters but NUL character ...
    (Linux-Kernel)
  • Re: Regular Expression - old regex module vs. re module
    ... If you want to include backslashes in a string, ... a one character string, which is unlikely to be what you wanted. ... formating characters before a format, then you should use a negative ... #read in and parse a format template ...
    (comp.lang.python)
  • RfD: Escaped Strings version 4
    ... the S" string can only contain printable characters, ... the S" string cannot contain the '"' character, ... as an escape character for the entry of characters that cannot be ... \b BS (backspace, ASCII 8) ...
    (comp.lang.forth)
  • RfD: Escaped Strings version 4
    ... the S" string can only contain printable characters, ... the S" string cannot contain the '"' character, ... as an escape character for the entry of characters that cannot be ... \b BS (backspace, ASCII 8) ...
    (comp.lang.forth)