Link to home
Start Free TrialLog in
Avatar of rss2
rss2

asked on

SQL query or function to substring a chunk of characters wtihout splitting up important data values

Hi Experts,

I have the following select statement which is substring'ing data into chunks of 4000 characters because the column is SUPER DUPER long:
SELECT SUBSTRING( vxlicrep_sbin, ( 0*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 1*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 2*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 3*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 4*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 5*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 6*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 7*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 8*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 9*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 10*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 11*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 12*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 13*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 14*4000 ) + 1, 4000 ),
       SUBSTRING( vxlicrep_sbin, ( 15*4000 ) + 1, 4000 )
       
  FROM rs_veritaslicense2
  WHERE [hostname] = 'mfn3asff3'

Normally it works a treat, but this time it's splitting up data values into the 4000-character chunks that I'd rather not split up.

For example, in the very long column vxlicrep_sbin I have a value "LICENSE TYPE = PERMANENT_NODE_LOCK" but it just so happens that this is split in between the 4000 chunks into "LICENSE TYPE = PERM" and "ANENT_NODE_LOCK".

Could you guys suggest a better way to split up this super large data column into usable chunks of data without splitting up data items?

Thanks! REALLY URGENT!!!! I'm standing by..

rss2
Avatar of MikeToole
MikeToole
Flag of United Kingdom of Great Britain and Northern Ireland image

What's the format of the text? What logical test can be used to identify valid locations to split at?
Avatar of rss2
rss2

ASKER

Here's what the text in the column vxlicrep_sbin looks like:
(below is one sample value for vxlicrep_sbin)

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

VERITAS License Manager vxlicrep utility version 3.02.005
Copyright (C) 1996-2004 VERITAS Software Corp. All Rights reserved.

Creating a report on all VERITAS products installed on this system

-----------------***********************-----------------

License Key                         = 50222249089062708117955
Product Name                        = VERITAS File System
Key                                 = Invalid,  Expired
License Type                        = DEMO
Demo End Date                       = Sun Sep 19 04:00:00 2004
Site License                        = YES

Features :=
VXFS                                = Enabled


-----------------***********************-----------------

License Key                         = 00194956550480519594652
Product Name                        = VERITAS File System
Key                                 = Invalid,  Expired
License Type                        = DEMO
Demo End Date                       = Sun Oct 24 04:00:00 2004
Site License                        = YES

Features :=
VXFS                                = Enabled


-----------------***********************-----------------

License Key                         = R8PG-OMNP-6CRU-PPPP-XU3N-D2OP-PPRP-P36
Product Name                        = VERITAS Volume Manager
Serial Number                       = 17615
License Type                        = PERMANENT_NODE_LOCK
OEM ID                              = 22
Node Lock Type                      = (Hostid and Architecture ID)

Features :=

VxVM                                = Enabled
CPU Count                           = Not Restricted
Platform                            = un-used
Version                             = un-used


-----------------***********************-----------------

License Key                         = 32P9-ZFRW-D47D-CPYK-EZPP-P4XV-3BOP
Product Name                        = VERITAS Storage Foundation Standard
Serial Number                       = 51390
License Type                        = PERMANENT_NODE_LOCK
OEM ID                              = 22
Node Lock Type                      = (Hostid and Architecture ID)
Editions Product                    = YES

Features :=
VxVM#VERITAS Volume Manager         = Enabled
CPU Count#VERITAS Volume Manager    = Not Restricted
VXFS#VERITAS File System            = Enabled
CPU Count#VERITAS File System       = Not Restricted
QLOG#VERITAS File System            = Enabled
PGR#VERITAS Volume Manager          = Enabled
VERITAS Foundation Suite            = Enabled

SPC Lite#VERITAS SANPoint Control   = Enabled
Storage Expert#VERITAS Volume Manager = Enabled
Platform                            = un-used
Version                             = un-used


-----------------***********************-----------------

Product Name                        = VERITAS Volume Manager
License Type                        = PERMANENT
Node Lock Type                      = (Hostid or Static IP Address)

Features :=
Dynamic Lun Expansion               = Enabled
Hardware assisted copy              = Enabled
Cross-platform Data Sharing         = Enabled
PGR                                 = Enabled
PGR_TRAINING                        = Enabled



-----------------***********************-----------------

Product Name                        = VERITAS File System
License Type                        = PERMANENT
Node Lock Type                      = (Hostid or Static IP Address)

Features :=
File Change Log                     = Enabled
Cross-platform Data Sharing         = Enabled
Extra-Big File Systems              = Enabled
Multi-Volume Support                = Enabled



-----------------***********************-----------------

License Key                         = R8PE-T68P-CR3O-IUCN-IGC3-PPRP-C3TB-RC6
Product Name                        = VERITAS Volume Manager
Serial Number                       = 51390
License Type                        = PERM ANENT_NODE_LOCK
OEM ID                              = 22
Node Lock Type                      = (Hostid and Architecture ID)
Point Product                       = YES

Features :=

Storage Expert                      = Enabled
VxVM                                = Enabled
CPU Count                           = Not Restricted
PGR                                 = Enabled
Platform                            = un-used
Version                             = un-used


-----------------***********************-----------------

License Key                         = P4PH-APT6-8RPN-PYUC-NIGJ-P4XX-R
Product Name                        = VERITAS File System
Serial Number                       = 51390
License Type                        = PERMANENT_NODE_LOCK
OEM ID                              = 22
Node Lock Type                      = (Hostid and Architecture ID)
Point Product                       = YES

Features :=
VXFS                                = Enabled
QLOG                                = Enabled

CPU Count                           = Not Restricted
Platform                            = un-used
Version                             = un-used


-----------------***********************-----------------

License Key                         = N8PV-3FRB-8R3P-JH3P-C7LP-POUU-XP
Product Name                        = VERITAS SANPoint Control
Serial Number                       = 51390
License Type                        = PERMANENT_NODE_LOCK
OEM ID                              = 22
Node Lock Type                      = (Hostid and Architecture ID)
Point Product                       = YES

Features :=
Host Tier Platform                  = 0 Hosts
Language                            = English
Switch Port Bundles                 = 0 Ports
SPC Lite                            = Enabled

Total Number of Hosts Managed       = 0
Functional Tier                     = Advanced


-----------------***********************-----------------

License Key                         = I2PU-DP6R-UR32-IW8C-ULLI-GP34-OUEX-3
Product Name                        = VERITAS Storage Foundation Standard HA
Serial Number                       = 22349
License Type                        = PERMANENT_NODE_LOCK
OEM ID                              = 22
Node Lock Type                      = (Hostid and Architecture ID)
Editions Product                    = YES

Features :=
VxVM#VERITAS Volume Manager         = Enabled
CPU Count#VERITAS Volume Manager    = Not Restricted
CPU Count#VERITAS File System       = Not Restricted
Platform                            = Solaris

VXFS#VERITAS File System            = Enabled
Version                             = 3.5
Tier#VERITAS Cluster Server         = Unused
Mode#VERITAS Cluster Server         = VCS
VERITAS Foundation Suite HA         = Enabled
SPC Lite#VERITAS SANPoint Control   = Enabled
Storage Expert#VERITAS Volume Manager = Enabled
QLOG#VERITAS File System            = Enabled
PGR#VERITAS Volume Manager          = Enabled


-----------------***********************-----------------

License Key                         = P4P9-NRRC-PR3N-ZEXO-RTYP-OUUY-R
Product Name                        = VERITAS File System
Serial Number                       = 22349
License Type                        = PERMANENT_NODE_LOCK
OEM ID                              = 22
Node Lock Type                      = (Hostid and Architecture ID)
Point Product                       = YES

Features :=
VXFS                                = Enabled
QLOG                                = Enabled

CPU Count                           = Not Restricted
Platform                            = un-used
Version                             = un-used


-----------------***********************-----------------

License Key                         = IJZE-6YPU-8PPR-RFRP-PBDI-XACP-4C
Product Name                        = VERITAS Storage Foundation Standard HA
Serial Number                        = 41256
License Type                        = PERMANENT
OEM ID                              = 81
Editions Product                    = YES

Features :=
VxVM#VERITAS Volume Manager         = Enabled
CPU Count#VERITAS Volume Manager    = Not Restricted
CPU Count#VERITAS File System       = Not Restricted
Platform                            = Solaris

VXFS#VERITAS File System            = Enabled
Version                             = 4.1
Tier#VERITAS Cluster Server         = Unused
Mode#VERITAS Cluster Server         = VCS
VERITAS Foundation Suite HA         = Enabled
Storage Expert#VERITAS Volume Manager = Enabled
QLOG#VERITAS File System            = Enabled
PGR#VERITAS Volume Manager          = Enabled


-----------------***********************-----------------

Product Name                        = VERITAS Volume Manager
License Type                        = PERMANENT

Features :=
Dynamic Lun Expansion               = Enabled
Hardware assisted copy              = Enabled
Cross-platform Data Sharing         = Enabled
PGR                                 = Enabled
PGR_TRAINING                        = Enabled



-----------------***********************-----------------

Product Name                        = VERITAS File System
License Type                        = PERMANENT

Features :=
File Change Log                     = Enabled
Cross-platform Data Sharing         = Enabled
Extra-Big File Systems              = Enabled
Multi-Volume Support                = Enabled



-----------------***********************-----------------

License Key                         = R8PE-ZONZ-DCWC-R3AR-OX8Z-CCPP-6NPO-UU6
Product Name                        = VERITAS Volume Manager
Serial Number                       = 22349
License Type                        = PERMANENT_NODE_LOCK
OEM ID                              = 22
Node Lock Type                      = (Hostid and Architecture ID)
Point Product                       = YES

Features :=

Storage Expert                      = Enabled
VxVM                                = Enabled
CPU Count                           = Not Restricted
PGR                                 = Enabled
Platform                            = un-used
Version                             = un-used


-----------------***********************-----------------

License Key                         = N8PE-ZIJ6-XZPC-8IW8-CWFR-P3TB-RC
Product Name                        = VERITAS SANPoint Control
Serial Number                       = 22349
License Type                        = PERMANENT_NODE_LOCK
OEM ID                              = 22
Node Lock Type                      = (Hostid and Architecture ID)
Point Product                       = YES

Features :=
Host Tier Platform                  = 0 Hosts
Language                            = English
Switch Port Bundles                 = 0 Ports
SPC Lite                            = Enabled

Total Number of Hosts Managed       = 0
Functional Tier                     = Advanced


-----------------***********************-----------------

License Key                         = RRZE-WC6X-PZRC-RNAP-CCPP-6NPP-RN3
Product Name                        = VERITAS Volume Manager
Serial Number                       = 41256
License Type                        = PERMANENT
OEM ID                              = 81
Point Product                       = YES

Features :=

Storage Expert                      = Enabled
VxVM                                = Enabled
CPU Count                           = Not Restricted
PGR                                 = Enabled
Platform                            = un-used
Version                             = un-used


-----------------***********************-----------------

License Key                         = PZZ9-APRB-DCTN-ZPNA-PUPN-PC
Product Name                        = VERITAS File System
Serial Number                       = 41256
License Ty pe                        = PERMANENT
OEM ID                              = 81
Point Product                       = YES

Features :=
VXFS                                = Enabled
QLOG                                = Enabled

CPU Count                           = Not Restricted
Platform                            = un-used
Version                             = un-used


-----------------***********************-----------------

License Key                         = PJZE-TDKN-UCNC-3RRP-PYZ2-U
Product Name                        = VERITAS Cluster Server
Serial Number                       = 41256
License Type                        = PERMANENT
OEM ID                              = 81
Point Product                       = YES

Features :=
Platform                            = Solaris
Version                             = 5
Tier                                = Unused
Reserved                            = 0

Mode                                = VCS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
Avatar of rss2

ASKER

To start with, the "---------***********---------" things can be used as delmiters..how would I put each line in between them into rows in a table?
Avatar of rss2

ASKER

Actually, that part is fine.. putting stuff in between into rows of a table.

I just want to know how I can split up this very large data without splitting up data items.
We've seen this data before.  Did you have no luck using vbscript to split the file and insert individual records?
Avatar of rss2

ASKER

No luck
Ok.... What other data identifies the information?  The file name?
Avatar of rss2

ASKER

The raw data has two columns: hostname, vxlicrep_sbin

I envision a two-stage process.

First stage:
I would like to put the data into another table that looks like this:
HOSTNAME, VXLI_data
..where vxli_data is the looooong ntext data in vxlicrep_sbin separated into rows, delimited by the "--------************----------" things.

Second stage:
I would then take the data from the first stage table (i.e. License Key                         = PZZ9-APRB-DCTN-ZPNA-PUPN-PC
Product Name                        = VERITAS File System
Serial Number                       = 41256
License Ty pe                        = PERMANENT)
..and put each row belonging to a hostname into another table, that would look like this:
HOSTNAME   LICENSE_KEY  PRODUCT_NAME   SERIAL_NUMBER
xyz123        PZZ9-APRB-DCTN-ZPNA-PUPN-PC   VERITAS File System    41256
etc..

SUCH a pain :(
Avatar of rss2

ASKER

There aren't any other delimiters in the ntext column vxlicrep_sbin, other than general char(13) and char(10) and the "-------**********-------" thing.
I don't see a HOSTNAME in the file, but here's a script that will do a basic split.
Dim splitStr, x, y
splitStr  = "-----------------***********************-----------------"
 
Dim dbServer
Dim dbName
Dim dbUserName
Dim dbPassword
 
dbServer   = "YourServer"
dbName     = "YourDb"
dbUserName = "YourUser"
dbPassword = "YourPassword"
dbFile     = "d:\yourFile.txt"
 
Dim dbConnStr
dbConnStr = "Provider=SQLOLEDB; Data Source=" & dbServer & "; Initial Catalog=" & dbName & "; User ID=" & dbUserName & "; Password=" & dbPassword & ";"
 
Dim fso, File, fileContents, dbItems, LineInfo, tLine, lPart, rPart
Set fso = CreateObject("scripting.filesystemobject")
Set File = fso.opentextfile(dbFile, 1)
fileContents = file.readall
dbItems = split(FileContents, splitStr)
 
Dim dbConn
Set dbConn = CreateObject("adodb.connection")
dbConn.connectionstring = dbConnStr
For x = LBound(dbItems)+1 To UBound(dbItems) 
     
     LineInfo = split(dbItems(x),vbcrlf)
     For y = LBound(lineInfo) To UBound(lineinfo)
          tLine=Trim(lineinfo(y))
          
          'wscript.echo lineinfo(y)
          If InStr(tLine,"=")>0 Then
               lPart = Left(tLine, InStr(tLine,"=")-1)
               rPart = Mid(tLine, InStr(tLine,"=")+1, Len(tLine)-Len(lpart))
          
          wscript.echo lPart
          wscript.echo rPart     
          'dbconn.execute ("insert into dbStuff (HostName, LicenseInfo, LicenseData) values ('" & dbFile & "', '" & lPart & "', '" & rPart & "')")          
          End If
          
          
          
     Next
 
     'wscript.echo dbItems(x)
     
Next
 
Set fso=Nothing
Set dbConn=Nothing

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rss2

ASKER

I like it.. I'm testing it now.. but it doesn't like wscript. Do I need to reference something for that to work in my code?
Avatar of rss2

ASKER

Nevermind I'm just skipping the wscript's..

but it doesn't like the dbConn.Execute line "Run-time error 3704: Application-defined or Object-defined error.."
What version of wscript?  There's nothing in there that is dependent on anything in newer versions of the windows scripting host.  But I run it with wscript and it works fine.
also... you X to identify the grouping because each set between the ___***___ lines will have the same X

add:   dbconn.open
after: dbConn.connectionstring = dbConnStr

and

add:      dbconn.close
before: set dbconn=nothing
Change:
If InStr(tLine,"=")>0 Then

So that your features := line isn't treated as a record.
TO:


If InStr(tLine,"=")>0 and tLine <> "Features :=" Then

Open in new window

This script is very basic and needs a lot of customizing to match what you want.  Like instead of running the dbconn.execute, you could load each value into variables and do one insert.

Below... you would create a variable for EACH type of information... licenseKey, prouctName, serialNumber, etc.. in your VBS and insert all the records for each X at one time
For x = LBound(dbItems)+1 To UBound(dbItems) 
     
     LineInfo = split(dbItems(x),vbcrlf)
     For y = LBound(lineInfo) To UBound(lineinfo)
          tLine=Trim(lineinfo(y))
          
          'wscript.echo lineinfo(y)
          If InStr(tLine,"=")>0 Then
               lPart = Left(tLine, InStr(tLine,"=")-1)
               rPart = Mid(tLine, InStr(tLine,"=")+1, Len(tLine)-Len(lpart))
 
          if lpart = "License Key" then licenseKey = rpart
          if lpart = "Product Name" then productName = rpart
          if lpart = "Serial Number" then SerialNumber = rpart
          if lpart = "License Type" then LicenseType = rpart
 
 
          End If
          
          'bconn.execute ("insert into dbStuff (FileName, KeyRefNum, licenseKey , productName , SerialNumber , LicenseType ) values ('" & dbFile & "', " & X & ", '" & LicenseKey & "', '" & productName & "', '" & serialNumber & "', '" & LicenseType & "')")          
          
          
     Next
 
     'wscript.echo dbItems(x)
     
Next

Open in new window

Avatar of rss2

ASKER

AWESOME!!!

It's working, thank GOODNESS!! You're a LIFE saver.

Would you be willing to tweak it a bit for me??
The rawdata is in a csv file (attached).

I need to grab the hostname in the first column of the table that's receiving the inserts from your script above. AND I need a way to number the grouping of "-----*****----"

So for example:
Anything between the first "-----*****----" for a hostname would have groupnum 1
The next stuff in between "----*****----" for that same hostname would have groupnum 2.

Is that possible?
Don't see an attachment but...

Would you be willing to tweak it a bit for me??
See my last post...

I need to grab the hostname in the first column of the table that's receiving the inserts from your script above. AND I need a way to number the grouping of "-----*****----"
The groups of ___***___ will be number by the vbScript variable X

So for example:
Anything between the first "-----*****----" for a hostname would have groupnum 1
The next stuff in between "----*****----" for that same hostname would have groupnum 2.

Is that possible?
Of course... see my last post.
I just put the 4 "if lpart = "ASFSF" then ASFSF = rpart to show you how to load each type because the items seem to have different possible items.... you will have to determine what they all are.

Also... between the two next statements, you need to clear out the value for EACH local variable.  This is in case a record (or grouping of records) doesn't have a particular value.

Example in the last two items posted above...
One has "Version                             = un-used" and not the other
one has "Mode                                = VCS" and not the other


"VERSION" and "MODE" would be two more examples of items that would have a vbScript local variable, the "if lpart=" line, and have it listed in the insert statement.
For x = LBound(dbItems)+1 To UBound(dbItems) 
     
     LineInfo = split(dbItems(x),vbcrlf)
     For y = LBound(lineInfo) To UBound(lineinfo)
          tLine=Trim(lineinfo(y))
          
          'wscript.echo lineinfo(y)
          If InStr(tLine,"=")>0 Then
               lPart = Left(tLine, InStr(tLine,"=")-1)
               rPart = Mid(tLine, InStr(tLine,"=")+1, Len(tLine)-Len(lpart))
 
          if lpart = "License Key" then licenseKey = rpart
          if lpart = "Product Name" then productName = rpart
          if lpart = "Serial Number" then SerialNumber = rpart
          if lpart = "License Type" then LicenseType = rpart
 
 
          End If
          
          'bconn.execute ("insert into dbStuff (FileName, KeyRefNum, licenseKey , productName , SerialNumber , LicenseType ) values ('" & dbFile & "', " & X & ", '" & LicenseKey & "', '" & productName & "', '" & serialNumber & "', '" & LicenseType & "')")          
          
          
     Next
licensekey=""
productName=""
serialNumber=""
licenseType=""
Next

Open in new window

Avatar of rss2

ASKER

Sorry, here is the attached file.

If you open it in Excel, you have to do a cntrl+[down arrow] to see the information underneath vxlicrep-sbin column.
I would also recommend adding the line "option explicit" as the FIRST line in the vbs file to prevent variable name mix-ups.
Still no attachment.  I'll be back in a bit to help you finish this up... I have to run out.
Avatar of rss2

ASKER

I've changed your code to this, but I'm not grabbing the hostnames correctly.

(I'll send a smaller attachment. The file is actually comma-delimited, it's just that there is this very large bit of data in between two commas.


Sub EEParse()
Dim splitStr, x, y, hostsplitStr
splitStr = "-----------------***********************-----------------"
hostsplitStr = ","
Dim Groupnum As Integer

Dim dbServer
Dim dbName
Dim dbUserName
Dim dbPassword

Groupnum = 0

dbServer = "169.93.136.186"
dbName = "personal_production"
dbUserName = "tideway"
dbPassword = "1nve5tment"
dbFile = "H:\RScully\Veritas\veritaslicense.csv"
hostname = ""

Dim dbConnStr
dbConnStr = "Provider=SQLOLEDB; Data Source=" & dbServer & "; Initial Catalog=" & dbName & "; User ID=" & dbUserName & "; Password=" & dbPassword & ";"
 
Dim fso, File, fileContents, dbItems, LineInfo, tLine, lPart, rPart, hostnames
Set fso = CreateObject("scripting.filesystemobject")
Set File = fso.opentextfile(dbFile, 1)
fileContents = File.readall
dbItems = Split(fileContents, splitStr)
hostnames = Split(fileContents, hostsplitStr)

Dim dbConn
Set dbConn = CreateObject("adodb.connection")
dbConn.connectionstring = dbConnStr
dbConn.Open
For z = LBound(hostnames) + 1 To UBound(hostnames)
    If hostnames(z) <> "" And InStr(hostnames(z), "hostname") = 0 And InStr(hostnames(z), "vxlicrep_sbin") = 0 And InStr(hostnames(z), "vxlicrep_bin") = 0 And InStr(hostnames(z), "vxlicense_usr") = 0 And InStr(hostnames(z), "vxlicense") = 0 Then

    hostname = hostnames(z)
   
    For x = LBound(dbItems) + 1 To UBound(dbItems)
         Groupnum = Groupnum + 1
         LineInfo = Split(dbItems(x), vbCrLf)
         For y = LBound(LineInfo) To UBound(LineInfo)
              tLine = Trim(LineInfo(y))
             
              'wscript.echo lineinfo(y)
              If InStr(tLine, "=") > 0 Then
                   lPart = Left(tLine, InStr(tLine, "=") - 1)
                   rPart = Mid(tLine, InStr(tLine, "=") + 1, Len(tLine) - Len(lPart))
             
              'wscript.echo lPart
              'wscript.echo rPart
              dbConn.Execute ("insert into EEParse_results (HostName, LicenseInfo, LicenseData,Groupnum) values ('" & hostname & "', '" & lPart & "', '" & rPart & "','" & Groupnum & "')")
              End If
             
             
             
         Next
     
         'wscript.echo dbItems(x)
         
    Next
    End If
Next

Set fso = Nothing
dbConn.Close

Set dbConn = Nothing
End Sub
Avatar of rss2

ASKER

Here is the file again. It is tab-delimited and not comma-delimited I think?

Annoyingly, the first row of data does not have a comma after it before the hostname kcp-lw7c2b2. (but I suppose I could delete that first column).

The big data is in between quotes it looks like. So the file is like this:
hostname[tab]"lots of data"
veritaslicense-EE-small.txt
Avatar of rss2

ASKER

SORRY!!! Wait can you use this file instead? The one I gave you is not correct.

It is INDEED comma-delimited.
veritaslicense-EE-small.txt
So your fields are hostname,vxlicrep_sbin,vxlicrep_bin,vxlicense_usr,vxlicense

And since you have selected CSV, your string is in " because there can be a , in it?
On line 991 there is a "," which makes me think there are multiple different license fields.... this correct?
If so... do they need to stay in different fields?
Looks like the fields are vxlicrep_sbin and vxlicrep_bin.  Are they different? do they need to be?
Avatar of rss2

ASKER

Yes those are the fields in the comma-delimited file.

For now, I'm ignoring vxlicrep_bin, vxlicense_usr, vxlicense just to keep this simple, but I will have to do the same things for the data in those columns.

I selected csv because that is the original format of the file I received. What you see in the attached txt is a sample of the original file (Experts-Exchange does not let us attached csv files).

it just makes it more difficult.... well... different than how I was doing it.

I was only looking at host lines, and other.  and if it wasn't the host line, I treated it as a license field.  Do they need to be parsed separately or can they be processed as one field?
Avatar of rss2

ASKER

What you have done in your code already is just about perfect. It's totally what I need as far as taking the data in between the "----****----" things and putting the left part in one column and it's right part in another column.

Now, all I need is to associate each group with a hostname.

So in the txt file I attached, the hostname is just before all the stuff with the "---****----" in it.. so if you open it up in notepad you'll see
hostname,"----****---- license type          =  something          product name         = something " etc.

So could you just grab the hostname in front of the stuff in the quotes? (Sorry it's hard to explain, but basically you just about got it!!)
Avatar of rss2

ASKER

In your code, see where I added groupnum? That takes care of grouping the ----***---- sections.

So all I need is a way to grab the hostname. I can grab it, but I can't seem to loop it correctly in the code.

Here's the latest of your code that I have:
Sub EEParse()
Dim splitStr, x, y, hostsplitStr
splitStr = "-----------------***********************-----------------"
hostsplitStr = ","
Dim Groupnum As Integer

Dim dbServer
Dim dbName
Dim dbUserName
Dim dbPassword

Groupnum = 0

dbServer = "169.93.136.186"
dbName = "personal_production"
dbUserName = "tideway"
dbPassword = "1nve5tment"
dbFile = "C:\Documents and Settings\Rebecca\My Documents\RSS SYSTEMS LTD\JP Morgan Chase\veritas\veritaslicense-EE-small.txt"
hostname = ""

Dim dbConnStr
dbConnStr = "Provider=SQLOLEDB; Data Source=" & dbServer & "; Initial Catalog=" & dbName & "; User ID=" & dbUserName & "; Password=" & dbPassword & ";"
 
Dim fso, File, fileContents, dbItems, LineInfo, tLine, lPart, rPart, hostnames
Set fso = CreateObject("scripting.filesystemobject")
Set File = fso.opentextfile(dbFile, 1)
fileContents = File.readall
dbItems = Split(fileContents, splitStr)
hostnames = Split(fileContents, hostsplitStr)

Dim dbConn
Set dbConn = CreateObject("adodb.connection")
dbConn.connectionstring = dbConnStr
'dbConn.Open
For z = LBound(hostnames) + 1 To UBound(hostnames)
    If hostnames(z) <> "" And InStr(hostnames(z), "hostname") = 0 And InStr(hostnames(z), "vxlicrep_sbin") = 0 And InStr(hostnames(z), "vxlicrep_bin") = 0 And InStr(hostnames(z), "vxlicense_usr") = 0 And InStr(hostnames(z), "vxlicense") = 0 Then

    hostname = hostnames(z)
   
    For x = LBound(dbItems) + 1 To UBound(dbItems)
         Groupnum = Groupnum + 1
         LineInfo = Split(dbItems(x), vbCrLf)
         For y = LBound(LineInfo) To UBound(LineInfo)
              tLine = Trim(LineInfo(y))
             
              'wscript.echo lineinfo(y)
              If InStr(tLine, "=") > 0 Then
                   lPart = Left(tLine, InStr(tLine, "=") - 1)
                   rPart = Mid(tLine, InStr(tLine, "=") + 1, Len(tLine) - Len(lPart))
             
              'wscript.echo lPart
              'wscript.echo rPart
              'dbConn.Execute ("insert into EEParse_results (HostName, LicenseInfo, LicenseData,Groupnum) values ('" & hostname & "', '" & lPart & "', '" & rPart & "','" & Groupnum & "')")
              End If
             
             
             
         Next
     
         'wscript.echo dbItems(x)
         
    Next
    End If
Next

Set fso = Nothing
'dbConn.Close

Set dbConn = Nothing
End Sub
Avatar of rss2

ASKER

Maybe first split dbItems by the "," and then when a value with "VERITAS" in it is found, split that by the "----****----" thing??
Well you can't use a straight vb split because the , can appear inside of the license text betwen the ___****___
Avatar of rss2

ASKER

This works!
AWESOME - thank you SOOO much. giving you credit now. :)

Sub EEParse()
Dim splitStr, x, y, hostsplitStr
splitStr = "-----------------***********************-----------------"
hostsplitStr = ","
Dim Groupnum As Integer

Dim dbServer
Dim dbName
Dim dbUserName
Dim dbPassword

Groupnum = 0

dbServer = "169.93.136.186"
dbName = "personal_production"
dbUserName = "tideway"
dbPassword = "1nve5tment"
dbFile = "C:\Documents and Settings\Rebecca\My Documents\RSS SYSTEMS LTD\JP Morgan Chase\veritas\veritaslicense-EE-small.txt"
hostname = ""

Dim dbConnStr
dbConnStr = "Provider=SQLOLEDB; Data Source=" & dbServer & "; Initial Catalog=" & dbName & "; User ID=" & dbUserName & "; Password=" & dbPassword & ";"
 
Dim fso, File, fileContents, dbItems, LineInfo, tLine, lPart, rPart, hostnames
Set fso = CreateObject("scripting.filesystemobject")
Set File = fso.opentextfile(dbFile, 1)
fileContents = File.readall
dbItems = Split(fileContents, splitStr)
hostnames = Split(fileContents, hostsplitStr)

Dim dbConn
Set dbConn = CreateObject("adodb.connection")
dbConn.connectionstring = dbConnStr
'dbConn.Open
For z = LBound(hostnames) + 1 To UBound(hostnames)
    If hostnames(z) <> "" And InStr(hostnames(z), "hostname") = 0 And InStr(hostnames(z), "vxlicrep_sbin") = 0 And InStr(hostnames(z), "vxlicrep_bin") = 0 And InStr(hostnames(z), "vxlicense_usr") = 0 And InStr(hostnames(z), "vxlicense") = 0 Then

        If InStr(hostnames(z), "VERITAS") > 0 Then
            dbItems = Split(hostnames(z), splitStr)
   
            For x = LBound(dbItems) + 1 To UBound(dbItems)
                 Groupnum = Groupnum + 1
                 LineInfo = Split(dbItems(x), vbCrLf)
                 For y = LBound(LineInfo) To UBound(LineInfo)
                      tLine = Trim(LineInfo(y))
                     
                      'wscript.echo lineinfo(y)
                      If InStr(tLine, "=") > 0 Then
                           lPart = Left(tLine, InStr(tLine, "=") - 1)
                           rPart = Mid(tLine, InStr(tLine, "=") + 1, Len(tLine) - Len(lPart))
                     
                      'wscript.echo lPart
                      'wscript.echo rPart
                      'dbConn.Execute ("insert into EEParse_results (HostName, LicenseInfo, LicenseData,Groupnum) values ('" & hostname & "', '" & lPart & "', '" & rPart & "','" & Groupnum & "')")
                      End If
                     
                     
                     
                 Next
             
                 'wscript.echo dbItems(x)
                 
            Next
        Else
        hostname = hostnames(z)
        End If
    End If
Next

Set fso = Nothing
'dbConn.Close

Set dbConn = Nothing
End Sub
Avatar of rss2

ASKER

Totally fantastic answer and helped me TREMENDOUSLY!!!! Many many thanks!!!!!
You should REALLY sanitize (ie. remove passwords and IPs) from your posts.
Rather than polluting this thread, if you want more thoughts on this, message me.