REGEX and string cutting

Here's what I'm trying to do.

I'm using a java app that inserts data into my database and if I set a switch in it's configuration it will call a couple stored processes.

What I'd like to do is use a stored process to identify certain strings then split them and store them in a seperate table.

Here's the string:

Here's the table structure I would like to use

| CallSSID | ReportTime | PackNum | An1 | An2 | An3 | An4 | An5 | Dig |
| HIGHPR |2008-05-28 19:00:05| 853 | 0 | 0 | 0 | 0 | 11 | 00000000 |

This is the methode that the stored procedure is called from the app.

CREATE PROCEDURE dbo.UpdatePackets
@CallsignSSID varchar(9), (FromCall ToCall Length CRC32)
@ReportTime datetime, (Set using the java.sql.PreparedStatement.setTimestamp())
@PacketType tinyint, (0-3 (see below); setByte() dbTinyInt=true, setShort() otherwise)
@IsWx bit, (Weather packet, setBoolean() used)
@Packet varbinary(512) (May contain any byte, 0-255)
---Put your code here

- @Packet is the entire string
I know that REGEX '.:T#' will identify the strings

I had never even heard of Stored Procedures until the other day so I've got a lot of learning to do.

My first question is how do I get the stored procedure to use regex on all strings being insert into a certain table and extract to strings for further processsing?

Next what's the easiest way to breakup the string?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!