Advertisement

05.09.2008 at 08:01AM PDT, ID: 23389600 | Points: 250
[x]
Attachment Details
devide and upload string from one  column into separate columns
Experts!
How do I strip this string that i have to separate columns?  it can be view, that will be uploaded into table.  STRING:
DCRRART3=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SDG.fgbvc.com)(PORT=3321))(CONNECT_DATA=(SERVICE_NAME=DCEYWRT3.NC.HGNB.COM)))
separate column entries will look like this:
dbName:  DCEQART3
DESCRIPTION:  null
ADDRESS:  null
PROTOCOL:   TCP
HOST:   SDG.fgbvc.com
PORT:   3321
CONNECT_DATA:  null
SERVICE_NAME:   DCEYWRT3.NC.HGNB.COM
Thanks a million!
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: marshaklana
Question Asked On: 05.09.2008
Participating Experts: 1
Points: 250
Views: 0
Translate:
Loading Advertisement...
05.09.2008 at 09:00AM PDT, ID: 21534192

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 09:03AM PDT, ID: 21534230

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 11:44AM PDT, ID: 21535467

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 11:45AM PDT, ID: 21535475

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 11:47AM PDT, ID: 21535486

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 11:51AM PDT, ID: 21535508

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 11:55AM PDT, ID: 21535541

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 12:18PM PDT, ID: 21535708

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 01:27PM PDT, ID: 21536200

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 01:36PM PDT, ID: 21536246

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 02:47PM PDT, ID: 21536581

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 05:37AM PDT, ID: 21542311

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.12.2008 at 04:42AM PDT, ID: 21545992

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.09.2008 at 09:00AM PDT, ID: 21534192
It looks like the Pattern Breas down starts at the = and ends at the following ) or (

So determining the Next position of that occurence would be the answer how to do this is by rebuilding the string everytime you get a value out.

Declare @ValString  varchar(8000)
Declare @Substring varchar(100)
Declare @LastPOs integer
declare @cnt  integer
Declare @Substr2 varchar(100)

set @Substr2 = ''

Set @valString = 'DCRRART3=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SDG.fgbvc.com)(PORT=3321))(CONNECT_DATA=(SERVICE_NAME=DCEYWRT3.NC.HGNB.COM)))'
set @cnt = 1
While @cnt < 9
      begin

      

      If  charindex('(',@valString) <  charindex(')',@valString)
            begin
            if charindex('(',@valString)- Charindex('=',@valString) > 0
                  begin
                  set @Substring = substring(@valstring,Charindex('=',@valString)+1,charindex('(',@valString)- Charindex('=',@valString)-1)
                  Set @substr2 = substring(@valstring,1,Charindex('(',@valString))
                  Set @valstring = Replace(@valstring,@substr2,'')
                  set @cnt = @cnt + 1
                  --select @valstring
                  print 'Value ' + cast(@cnt as varchar(10)) + ' :' +  @Substring
                  end
            else
                  begin
                  Set @valstring = substring(@valstring,2, 1000)
                  end
            end
      else
            begin
            if charindex('(',@valString)- Charindex('=',@valString) > 0
                  begin
                  set @Substring = substring(@valstring,Charindex('=',@valString)+1,charindex(')',@valString)-Charindex('=',@valString)-1)
                  Set @substr2 = substring(@valstring,1,Charindex(')',@valString))
                  Set @valstring = Replace(@valstring,@substr2,'')
                  set @cnt = @cnt + 1
                  --select @valstring
                  Print 'Value ' + cast(@cnt as varchar(10)) + ' :' +  @Substring
                  end
            else
                  begin
                  Set @valstring = substring(@valstring,2, 1000)
                  end      
            end
      
      
      --select 'Value ' + cast(@cnt as varchar(10)) + ' :' +  @Substring

      

      
      end
 
05.09.2008 at 09:03AM PDT, ID: 21534230
This Parese them, You can then split them up and INsert them in the Appropriate tables/Columns

 
05.09.2008 at 11:44AM PDT, ID: 21535467
Michelt,
is it function or stor proc?
 
05.09.2008 at 11:45AM PDT, ID: 21535475
never mind i see it's stor proc.
 
05.09.2008 at 11:47AM PDT, ID: 21535486
Well Actually It is neither, but Probably easiest to be turned into a stored proc. I didn't add the acual code to insert it in the tables, But that can be done conditionally, with a little tweaking. If you need additional help, let me know !
 
05.09.2008 at 11:51AM PDT, ID: 21535508
yes, I do :) need you help. can we finish it? thanks.
 
05.09.2008 at 11:55AM PDT, ID: 21535541
No Problem.

What is the Table it needs to go in Called and What does it look like... Maybe you can script it. I will then accorginly finish this stored procedure for you !
 
05.09.2008 at 12:18PM PDT, ID: 21535708
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
String to the first'=' is DBName, everything else is labeled.
This is a table to go in:
CREATE TABLE [dbo].[Ora_Service](
	[DBName] [varchar](50) NOT NULL,
	[Description] [varchar](500) NULL,
	[AddressList] [varchar](500) NULL,
	[Address] [varchar](500) NULL,
	[Community] [varchar](500) NULL,
	[Protocol] [varchar](50) NULL,
	[Host] [varchar](500) NULL,
	[Port] [varchar](50) NULL,
	[Connection] [varchar](500) NULL,
	[Service] [varchar](500) NULL,
	[SID] [varchar](50) NULL
) ON [PRIMARY]
Open in New Window
 
05.09.2008 at 01:27PM PDT, ID: 21536200
Okay Where do I get the Database Name ?


I will assume you pass that in the stored Procedure along with the string to Parse

!  Let's give this a try !
 
05.09.2008 at 01:36PM PDT, ID: 21536246
field name 'DbName' is whatever goes at the beginning of the string. example:
DCRRART3=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SDG.fgbvc.com)(PORT=3321))(CONNECT_DATA=(SERVICE_NAME=DCEYWRT3.NC.HGNB.COM)))
'DCRRART3'   is the data for column 'DbName'
 
 
05.09.2008 at 02:47PM PDT, ID: 21536581
Here it is..

 Sorry.. been busy at work...

create procedure usp_parse_db_values @ValString  varchar(8000)
as

--Execute the following to test
---- usp_parse_db_values 'DCRRART3=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SDG.fgbvc.com)(PORT=3321))(CONNECT_DATA=(SERVICE_NAME=DCEYWRT3.NC.HGNB.COM)))'
Declare @db varchar(100)
Declare @Substring varchar(100)
Declare @LastPOs integer
declare @cnt  integer
Declare @Substr2 varchar(100)


set @Substr2 = ''

set @cnt = 1
While @cnt <> 9
      begin

      set @Substring = ''
      set @db = substring(@valstring,1,Charindex('=',@valString)-1)
      If  charindex('(',@valString) <  charindex(')',@valString)
            begin
            if charindex('(',@valString)- Charindex('=',@valString) > 0
                  begin
                  set @Substring = substring(@valstring,Charindex('=',@valString)+1,charindex('(',@valString)- Charindex('=',@valString)-1)
                  Set @substr2 = substring(@valstring,1,Charindex('(',@valString))
                  Set @valstring = Replace(@valstring,@substr2,'')
                  
                  --select @valstring
                  --print 'Value ' + cast(@cnt as varchar(10)) + ' :' +  @Substring
                  set @cnt = @cnt + 1
                  end
            else
                  begin
                  Set @valstring = substring(@valstring,2, 1000)
                  end
            end
      else
            begin
            if charindex('(',@valString)- Charindex('=',@valString) > 0
                  begin
                  set @Substring = substring(@valstring,Charindex('=',@valString)+1,charindex(')',@valString)-Charindex('=',@valString)-1)
                  Set @substr2 = substring(@valstring,1,Charindex(')',@valString))
                  Set @valstring = Replace(@valstring,@substr2,'')
                  
                  --select @valstring
                  --Print 'Value ' + cast(@cnt as varchar(10)) + ' :' +  @Substring
                  set @cnt = @cnt + 1
                  end
            else
                  begin
                  Set @valstring = substring(@valstring,2, 1000)
                  end      
            end
            Print @db
            print '@valstring = ' + @Substring
            if @cnt -1 = 1
            begin
            insert into ora_service (dbname) values (@db)
            end
            if @cnt  -1 = 2
            begin
            update ora_service set description = @Substring where dbname = @db
            end
            if @cnt  -1 = 3
            begin
            update ora_service set ADDRESS = @Substring where dbname = @db
            end
            if @cnt  -1 = 4
            begin
            update ora_service set PROTOCOL = @Substring where dbname = @db
            end
            if @cnt  -1 = 5
            begin
            update ora_service set HOST = @Substring where dbname = @db
            end
            if @cnt  -1 = 6
            begin
            update ora_service set PORT = @Substring where dbname = @db
            end
            if @cnt  -1 = 7
            begin
            update ora_service set connection = @Substring where dbname = @db
            end
            if @cnt - 1 = 8
            begin
            update ora_service set service = @Substring where dbname = @db
            set @cnt = @cnt + 1
            end
            
      --select 'Value ' + cast(@cnt as varchar(10)) + ' :' +  @Substring

      

      
      end
 
05.11.2008 at 05:37AM PDT, ID: 21542311
the data are records that come from another table 'ORA' with one column 'ora'. How and where I refer to that table? btw, outcome of stor proc looks like it inserts dbname only, the rest looks weird and gives errors. if you run it, you'll see.
 
05.12.2008 at 04:42AM PDT, ID: 21545992
I ran it and it works on my side, Maybe it will need minor adjustments, but unless I can get access to your database, I will not be able to fix those. This is where you will have to make minor changes yourself.
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628