Hi guys,
Im using this code
update acs_doc_fees_outs set
visitno=substring(adm_no,15,2)
'0000023674 - V5' the number after V can grow then I set it as 15 to
start.
Thank you so mmmuch
From: Raymond
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 27, 2004
9:43 AM
To:
[EMAIL PROTECTED]
Subject: Re: PSC SQL - splitting
data
you can use the CharIndex and the SubString function..
CHARINDEX ( SearchString , ColumnToSearch [ ,
start_location ] )
SUBSTRING ( _expression_ , start , length )
here's a sample
--[ CODE
]---------------------------------------------------------------------------------
SET NOCOUNT ON
-- Create Temp Table
SELECT TOP 0 Cast('' as varchar(30)) CODE into
#TABLE
-- Insert Dummy Data
Insert INTO #TABLE Select '0000023674 - V5'
Insert INTO #TABLE Select '0000023674 - V6'
Insert INTO #TABLE Select '0000023674 - V7'
Insert INTO #TABLE Select '0000023674 - V8'
-- Get the number you wanted
SELECT SubString(CODE,
CharIndex('V',CODE)+1, 1) As Number
FROM #TABLE
DROP TABLE #TABLE
SET NOCOUNT OFF
--[ /CODE
]---------------------------------------------------------------------------------
On Wed, 27 Oct 2004 08:33:58 +0800, miss_mystikal
<[EMAIL PROTECTED]> wrote:
>
>
>
> Hi, how to split data like this:
>
> 0000023674 - V4
>
> I want to get the number after 'V'.
>
> Can we do it in SQL? I have one table and
they are thousand records with
> similar id.
>
> Instead of using loop in VB, is there any
other way to cut the number?
>
> To unsubscribe, send an email to:
> [EMAIL PROTECTED]
>
>
>
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
>
>
> ________________________________
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/PlanetSourceCode/
>
> To unsubscribe from this group, send an email
to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to the
Yahoo! Terms of Service.
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.762 / Virus Database: 510 -
Release Date: 9/13/2004
>
To
unsubscribe, send an email to:
[EMAIL PROTECTED]
To unsubscribe, send an email to:
[EMAIL PROTECTED]
| Yahoo! Groups Sponsor |
ADVERTISEMENT
![click here]() | |
![Web Bug from http://us.adserver.yahoo.com/l?M=315388.5529720.6602079.3001176/D=groups/S=:HM/A=2372354/rand=759822884]() |
Yahoo! Groups Links
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.762 / Virus Database: 510 - Release Date: 9/13/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.762 / Virus Database: 510 - Release Date: 9/13/2004